@@ -174,35 +174,50 @@ performance tests (K6).
174174
175175#### Antipatterns
176176
177-
178177### E2E Tests
179178
180- These tests are executed within a browser environment (Playwright, Selenium, etc.).
181- The purpose of these tests is to make sure that interacting with the application UI
182- produces the expected result.
179+ These tests are executed within a browser environment (Playwright, Selenium,
180+ etc.). The purpose of these tests is to make sure that interacting with the
181+ application UI produces the expected result, verifying the application’s
182+ functionality from a user’s perspective.
183183
184184Usually, these tests will cover a large portion of the codebase with least
185- amount of code.
186- Because of that, they can be the first tests to be added to existing project that
187- has no tests or has low test coverage.
185+ amount of code. Because of that, they can be the first tests to be added to
186+ existing project that has no tests or has low test coverage.
188187
189- These tests should not cover all of the use cases because they are the slowest to
190- run. If we need to test edge cases, we should try to implement those at a lower
191- level (integration or unit tests).
188+ These tests should not cover all of the use cases because they are the slowest
189+ to run. If we need to test edge cases, we should try to implement those at a
190+ lower level (integration or unit tests).
192191
193192#### When to use
194- - Test user interaction with the application UI.
193+ - To validate user interactions and critical workflows in the application UI.
194+ - For testing full system integration across multiple services or components.
195195
196196#### When ** not** to use
197197- For data validation.
198198
199199#### Best practices
200+ - Focus on the most important user workflows rather than attempting exhaustive
201+ coverage.
202+ - Each test should be able to run independently, with the environment reset to a
203+ known state before every test.
200204- Performance is key in these tests. We want to run tests as often as possible
201205and good performance will allow that.
202206- Flaky tests should be immediately disabled and refactored. Flaky tests will
203- cause the team to ignore or bypass the tests and these should be dealt with immediately.
207+ cause the team to ignore or bypass the tests and these should be dealt with
208+ immediately.
209+ - Ensure consistent data states to avoid test failures due to variability in
210+ backend systems or environments.
211+ - Run tests in parallel and isolate them from external dependencies to improve
212+ speed and reliability.
213+ - Automate E2E tests in your CI/CD pipeline to catch regressions early in the
214+ deployment process.
204215
205216#### Antipatterns
217+ - Avoid trying to cover all use cases or edge cases in E2E tests; these are
218+ better suited for unit or integration tests.
219+ - Don’t bypass or disable flaky tests without fixing them, as they undermine the
220+ test suite’s reliability.
206221
207222### Performance Tests
208223
0 commit comments