E2E Tests
E2E Tests verify System behavior in the most realistic way, by connecting to External Systems. However, they can cover only limited scenarios, and that's why we'll have few E2E 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:
What are E2E Tests?
We use E2E Tests to verify System behavior, however the scenarios are limited.
E2E Tests target the System - they span the System and External System Test Instances. They’re executed on the E2E Environment.
E2E Tests are slow. They’re limited in terms of the scenarios we can execute because we can’t fully control the External System Test Instances. Furthermore, we can’t control the System Clock either. Consequently, we’re very limited regarding scenarios that we can cover with E2E Tests, hence there’s a lot of Acceptance Criteria that we can’t even test with E2E Tests - but we can test it with Acceptance Tests.
The difference between E2E Tests and Smoke Tests is that when connecting to the External Systems, E2E Tests connect to External System Test Instances, whereas Smoke Tests can connect to either External System Test Instances or External System Stubs (depending on which environment they’re run on). Also, E2E Tests cover the critical Use Cases, to the extent that certain scenarios are possible.
If the System exposes a UI (for End Users), the E2E 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 E2E 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 E2E Tests?
Dave Farley said: “Don’t Do E2E Testing!“
The idea is to replace E2E Tests by Acceptance Tests & External System Contract Tests.
That makes E2E Tests redundant, right?
Should we completely eliminate E2E Tests.
This is problematic for two reasons: ⬇️⬇️⬇️