mumbleapi icon indicating copy to clipboard operation
mumbleapi copied to clipboard

Feat: Improve Test Suite

Open M-krishna opened this issue 3 years ago • 5 comments

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!

M-krishna avatar May 15 '21 07:05 M-krishna

@MidouWebDev @abhivemp @PraveenMalethia @divanov11 @codyseibert I would love to hear feedback from you guys.

M-krishna avatar May 15 '21 13:05 M-krishna

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!

PraveenMalethia avatar May 15 '21 18:05 PraveenMalethia

@M-krishna coverage would be nice, and so would test for feature. 👍

codyseibert avatar May 16 '21 04:05 codyseibert

@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 avatar May 16 '21 04:05 M-krishna

@M-krishna im currently working on test . So let me know what will be the difference between them .

PraveenMalethia avatar May 16 '21 07:05 PraveenMalethia