mumbleapi
mumbleapi copied to clipboard
Feat: Improve Test Suite
Problem
As the project grows we need to add in more and more test cases to early detect bugs and be confident about the feature we wrote. The current setup limits us to write test cases in a linear way which may contain repetition of code in more places and also difficult for to extend..
Approach
-
Add in coverage and pytest-cov to cover the areas covered by the test suite. This allows us to cover more parts of the code which are not covered(tested).
-
Organize the test files in a proper way.
- We may contain multiple views, multiple models, multiple serializers as the project grows. So writing unit tests for each and every thing in a single file (test_models.py, test_serializers.py, test_views.py) might not help in the long run.
- Instead we can split the test files featurewise. For eg, the test files must be created separately for different features. The naming convention would be any of these (test_<feature_name>.py, <feature_name>_test.py)
-
Add in pytest-django as our test runner. pytest-django gives us as added advantage comparing to the regular test runner. And also it comes with additional features out of the box that django test runner don't have.
Note
The above mentioned approach will help us in the long run. Would love hear feedback on this. Thanks!
@MidouWebDev @abhivemp @PraveenMalethia @divanov11 @codyseibert I would love to hear feedback from you guys.
Yep that a good suggestion and for now, Not to complicate things too much and working on refactoring too much will consume too much time! as for a regular test which Django provides are good enough for now! but this will be good for the long run! You can let me know if you can work on this!
@M-krishna coverage would be nice, and so would test for feature. 👍
@PraveenMalethia yup, I can work on this feature. And also this won't the affect MVP release. I'll break down this up and create a separate release plan. Thanks!
@M-krishna im currently working on test . So let me know what will be the difference between them .