Parameterized testing
Parameterized Tests, Fixtures
I spent some time converting groups of similar tests to single parameterized tests. These tests work identically to their non-parameterized counterpoints, but they come with a lot less boilerplate / room for error.
Changes Made
- Grouped similar tests into single parameterized tests in database_management, user_io and schema.
- Replaced "constant" variables with fixtures - this ensures that tests run independently of the ones run before them.
- Wrote custom fixtures for simulated input and menu testing, in the new conftest.py file.
- General improvements / corrections to comments.
- Implemented a basic provider main menu, and a test file for provider.py. This was mostly just so that the menu test has something to test.
Test Plan
git pull
git checkout paramaterized_testing
make test
Checklist
-
Code follows the project's coding style and conventions. -
Automated tests for the changes have been added or existing tests have been updated. -
Code coverage for new or modified code is maintained or improved. -
The code builds and runs without errors or warnings. -
Documentation has been updated to reflect the changes made. -
All discussions and feedback on the PR have been addressed. -
CI/CD pipelines pass successfully, including any required checks or tests. -
The PR has been reviewed and approved by the designated reviewers.
Additional Notes
Sorry about the large commit, but I think these'll be useful tools / examples for the rest of the team moving forward.
Edited by Danny Love