Name: CiviWiki
URL: https://github.com/LaraTifui/OpenCiviWiki
Number of lines of code and the tool used to count it: 4958 line (using lizard)
Programming language: Python
Tool used: Coverage.py
Execution:
coverage run --branch -m pytest // for the test
coverage report // to see the report
coverage html // to see the report as well as the code covered, in html form
Initial run of the tool (in terminal):
In project/accounts/tests/test_models.py I have added a test that checks if the profile has a set profile image. The function profile_image_url, had 50% branch test coverage, since a unit test already existed in the case a profile had no image associated with it, so the default image is used. After adding 1 unit tests , in order to check if the profile is correctly set when an image is associated with the profile, the function has now 100% branch coverage and the total coverage of the models.py file has raised from 57% to 86%
The commit link for the new test for function 1: https://github.com/LaraTifui/OpenCiviWiki/commit/1fa0f9baf80d0e7188b4991ccb1915d41e389588#diff-6ca9982ebb8b28073aa65d5339359b92b701121f06ac0ba9b3606b81c83bdc69
New coverage:
In project/accounts/tests/test_utils.py there is a function called get_account to which I created a test for. The function get_account, which has 3 optional parameters, had 0% test coverage. After adding 5 unit tests , in order to check each of the possible calling situations covered by the function coding, the function has now 100% branch coverage and the total coverage of the utils.py file has raised from 32% to 65%.
The commit link for the new test for function 1: https://github.com/LaraTifui/OpenCiviWiki/commit/3c1d9fb5b823a0cbf4a2b359affa05db09de8bf7
Old coverage result:
New coverage result:
Old coverage:
New coverage:
Initial run of the tool (in html form):
Final run of the tool (in html form):












