TDD in Legacy Code - Acceptance Tests
E2E Tests cannot be used to test Acceptance Criteria because they cover only limited scenarios. That's why we need to introduce Acceptance Tests.
🔒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 often has just E2E Tests
Legacy Code often has (just) E2E Tests, typically Manual E2E Tests. Previously we showed how to automate E2E Tests and refactor them towards maintainable E2E Tests. We received a lot of benefit from this, as E2E Tests are the most realistic tests, and in this way we eliminated Manual QA Regression Testing (instead QA Engineers do Exploratory Testing).
We can’t do ATDD with E2E Tests
However, there’s still a functional problem with E2E Tests regarding End User Testing - we can NOT adequately use them to test all the Functional Acceptance Criteria in User Stories. E2E Tests can ONLY cover a subset of Functional Acceptance Criteria - the reason is because we have limited control in setting up External System Test Instances and the External System Test Instances may be non-deterministic too.
This makes it infeasible to use E2E Tests for practicing ATDD, because we can NOT translate all the functional Acceptance Criteria into E2E Tests.
We need Acceptance Tests for ATDD
That’s why we need Acceptance Tests - because through Acceptance Tests we CAN represent ALL functional Acceptance Criteria. This is necessary for ATDD, where we’d need to take a User Story and convert ALL the functional Acceptance Criteria into Acceptance Tests.
In this article, we’ll show how to migrate E2E Tests to Acceptance Tests. These Acceptance Tests act as Characterization Tests at the System Level.
Here are the steps to introduce Acceptance Tests in Legacy Code. You’ll get tasks to implement in your GitHub Sandbox Project. I’ll review & provide feedback in the comments: ⬇️⬇️⬇️