Smoke Tests
Smoke Tests are help us verify whether the System is up-and-running, that's why they're executed before Acceptance Tests & E2E Tests in the Pipeline.
🔒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:
What are Smoke Tests?
We use Smoke Tests to verify that the System is up-and-running.
Smoke Tests target the System - they span the System and External System Stubs or External System Test Instances.
Smoke Tests executed on the Acceptance Environment span the External System Stubs.
Smoke Tests executed on the E2E Environment span External System Test Instances.
Smoke Tests are executed before Acceptance Tests & E2E Tests because they provide feedback. It makes sense to execute Acceptance Tests & E2E Tests only after Smoke Tests pass.
Smoke Tests are similar to E2E Tests in terms of span. The difference is that there are very few Smoke Tests, and they don’t test Use Cases, but rather basics such as whether the main page has loaded, whether login works, etc. They quickly verify that the System is up-and-running after deployment. After the Smoke Tests pass, we’re ready to run other System Level Tests (E2E Tests, Acceptance Tests, External System Contract Tests).
If the System exposes a UI (for End Users), the Smoke Test can use a Web Driver to run commands on the UI, and to do verifications via the UI:
If the System exposes a REST API (so that other systems can connect to it), the Smoke Test can use a HTTP Client to connect to the System’s REST API, and do verifications via the REST API:
If the System exposes both a UI and a REST API, then we combine the above:
Why Smoke Tests?
Suppose we just had E2E Tests (or Acceptance Tests), but didn’t have any Smoke Tests.
We run E2E Tests (or Acceptance Tests). The tests start failing. Then we start debugging, and find out it’s because deployment failed, or there’s some web server configuration error preventing us from accessing the system, or the External System Test Instances (or their Stubs) are not running, etc.
This is problematic for two reasons: ⬇️⬇️⬇️