TDD in Legacy Code - Smoke Tests
In Legacy Code, Smoke Testing is often done manually, which makes ATDD impractical. Let's see how we can introduce automated Smoke Testing as an enabler for ATDD.
🔒Hello, this is Valentina with a premium issue of the Optivem Journal. I help Engineering Leaders & Senior Software Developers apply TDD in Legacy Code. This article is part of the TDD in Legacy Code series. To get these articles in your inbox every week, subscribe:
Legacy Code has Manual Smoke Tests
In Legacy Code, it is typical that when the system is deployed to the UAT Environment, the QA Engineer might carry out a basic smoke test to ensure that the system is up-and-running, before they proceed to perform manual E2E tests.
An example of a basic end-user facing smoke test might be to open up the main page in the browser, and check that the page has loaded. The QA Engineer might also perform manual smoke testing for the backend, such as running some health check endpoint, checking if the database is running, checking whether the message broker is up and running - by manually trying to connect to the database server, manually connecting to administrative page of the message broker.
Then, when they see that the Manual Smoke Tests are passing, they can perform Manual E2E Testing.
We can’t do ATDD with Manual Smoke Tests
Since we want to adopt ATDD, we’d need to ensure that our system is up and running after it’s released before running the Acceptance Tests. The reason is that if the Smoke Tests fail, then it doesn’t make sense to run the Acceptance Tests. Since we’d want to be able to run Acceptance Tests regularly throughout the day, it’s infeasible to run manual Smoke Tests before running automated Acceptance Tests.
We need automated Smoke Tests for ATDD
That’s why we need Smoke Tests to be automated, so that we can immediately run them after deploying to any environment. Thus, after releasing the system to the Acceptance Environment, we could run Smoke Tests, and then Acceptance Tests.
Previously, we’d set up the Pipeline - we set up the Smoke Testing step within the Pipeline, but at that point, the tests were just placeholders. In this article, we’ll be writing the actual tests.
Here are the steps for writing Smoke Tests for Legacy Code. You’ll get tasks to implement in your GitHub Sandbox Project. I’ll review & provide feedback in the comments: ⬇️⬇️⬇️