- Status: Proposed
- Authors: Chris McCue
- Deciders: Abyss Team
- Date: 4/17/2024
Context
This ADR is a progression of ADR-006. The web and mobile Abyss teams have been utilizing Jest for testing, particularly Jest snapshots. Given the nature of snapshot testing, minor changes can result in a failure, causing unit tests to become outdated after only a few merges. This is primarily due to the lack of unit test validation integration into the regular development process.
Decision
- Integrate unit test validation into the development process before a PR is allowed to be merged.
- This integration will involve running and validating existing unit tests as part of the Definition of Done.
- Add auto-run during push to the PR branch. Catered to web/mobile updates.
The steps to be followed are as follows:
- Include Unit Testing in the Definition of Done.
- Allocate additional time in development tasks for checking and updating tests.
- Below are high level steps. For low level process detail steps, see here: https://uhgazure-my.sharepoint.com/:w:/g/personal/christopher_mccue_optum_com1/EdwlWP2bJzxNtDlyMhPy6J8BgLWFnkDC3yHvr2uGlTu6oQ?e=ntnIFW
- Add an "Update Tests" sub-task to every new Rally task that changes component code (whether global or local). This is expected to be a temporary measure, until the pipeline logic gets fully integrated.
- Check the "Run Unit Tests" Continuous Integration (CI) pipeline for any test failures on your development branch.
- If there are any failures, run the tests locally to verify they are also happening there.
- After running the tests, review the failures and take the necessary corrective steps - change the test, update the snapshots, or if not a relevant test anymore, delete it.
- Add the updated snapshots to the Pull Request (PR).
- Run the CI pipeline with the new snapshot PRs and ensure they are passing.
- Run and verify unit tests before any merge is conducted. Once confirmed, mark the "Run Unit Tests" sub-task as completed.
Plan
- Monitor/update before PR merge: Ensure unit tests are run regularly whenever there is a code update to the component package files.
Consequences
Pros:
- Maintains existing unit tests in an up-to-date and passing state before merging.
- Allows for early detection of bugs and improved code quality.
- Enhances overall test coverage.
- Increases confidence in code refactoring and new feature tasks.
Cons:
- May slow sprint velocity due to an increase in developer task workflow.
- As unit test suites grow, there could be a significant maintenance overhead.
- Debugging unit test snapshot failures can be challenging and time consuming if the process is not followed by all.
Revision History *
[Include Date and brief overview of discussion that led to a revision within the ADR]
* Use when applicable