-
Notifications
You must be signed in to change notification settings - Fork 16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Issue 174] ADR and coverage threshold #297
Merged
SammySteiner
merged 4 commits into
main
from
sammysteiner/issue-174-backend-testing-coverage
Jul 20, 2023
Merged
Changes from 3 commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
34997af
adr and coveraage threshold
SammySteiner b45ca9a
Update documentation/decisions/adr/0013-backend-testing.md
daphnegold 309d448
Merge branch 'main' into sammysteiner/issue-174-backend-testing-coverage
SammySteiner 11a28c9
remaned adr number
SammySteiner File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -111,3 +111,6 @@ markers = [ | |
|
||
[tool.coverage.run] | ||
omit = ["src/db/migrations/*.py"] | ||
|
||
[tool.coverage.report] | ||
fail_under = 80 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
# Front-end Testing & Coverage | ||
|
||
- **Status:** Accepted <!-- REQUIRED --> | ||
- **Last Modified:** 2023-07-19 <!-- REQUIRED --> | ||
- **Related Issue:** [174](https://github.com/HHS/grants-equity/issues/174) <!-- RECOMMENDED --> | ||
- **Deciders:** Sammy Steiner, Lucas Brown, Billy Daly, Andy Cochran, Daphne Gold <!-- REQUIRED --> | ||
- **Tags:** ADR <!-- OPTIONAL --> | ||
|
||
## Context and Problem Statement | ||
|
||
Back-end testing is essential in maintaining a stable and healthy codebase, creating APIs without regression, and an important part of the developer workflow. | ||
|
||
## Decision Drivers <!-- RECOMMENDED --> | ||
|
||
- **Robust:** Chosen testing frameworks should have features that offer diverse ways of verifying back-end codebase functionality, reducing the need for intensive manual testing | ||
- **Well-maintained:** Accessible tooling is well-maintained by owners and keeps up with current ecosystems in which it will be integrated. | ||
- **Ease of use:** Achieving high coverage should be attainable. ICs should be able to onboard with the tooling and execute in a reasonable time frame to maintain that coverage. | ||
- **Fast:** Running tests shouldn't take ages. | ||
|
||
## Options Considered | ||
|
||
## Unit Testing | ||
- Pytest | ||
|
||
## Test Coverage | ||
- Coverage | ||
|
||
### Pros and Cons of the Options <!-- OPTIONAL --> | ||
#### [Pytest](https://docs.pytest.org/) | ||
The pytest framework makes it easy to write small, readable tests, and can scale to support complex functional testing for applications and libraries. | ||
|
||
|
||
- **Pros** | ||
- Lightweight, well-supported and documented testing solution | ||
- Already integrated in Flask back-end template | ||
- Modular fixtures for managing small or parametrized long-lived test resources | ||
- Can run [unittest](https://docs.python.org/3/library/unittest.html) (including trial) and nose test suites out of the box | ||
- Rich plugin architecture, with over 800+ external plugins and thriving community | ||
- **Cons** | ||
- Compatibility issues with other testing frameworks means it's difficult to swap out for other frameworks | ||
|
||
#### [Coverage](https://coverage.readthedocs.io/) | ||
Coverage.py is a tool for measuring code coverage of Python programs. It monitors your program, noting which parts of the code have been executed, then analyzes the source to identify code that could have been executed but was not. | ||
|
||
- **Pros** | ||
- Fully automated | ||
- **Cons** | ||
- Code coverage is only one piece of a stable and healthy testing approach | ||
|
||
|
||
## Decision Outcome <!-- REQUIRED --> | ||
|
||
### Unit Testing | ||
**Pytest**, because it is integrated into the Nava Flask template application, well-maintained, and lightweight. Importantly, documentation is thorough and helpful information for troubleshooting can be easily accessed. | ||
|
||
### Testing Coverage | ||
**Coverage**, because it is integrated into the Nava Flask template application, well-maintained, and lightweight. Importantly, documentation is thorough and helpful information for troubleshooting can be easily accessed. | ||
|
||
We added a code coverage threshold of %80 in `api/pyproject.toml` | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🥳