openspp-modules icon indicating copy to clipboard operation
openspp-modules copied to clipboard

[WIP] Add test coverage

Open shashikala1998 opened this issue 9 months ago • 10 comments

Why is this change needed?

To add test coverages for;

  1. spp_custom_field
  2. spp_attendance
  3. spp_cycle_attendance_compliance

How was the change implemented?

New unit tests

Unit tests executed by the author

How to test manually

Related links

#779

shashikala1998 avatar Mar 16 '25 16:03 shashikala1998

Codecov Report

:x: Patch coverage is 96.34703% with 16 lines in your changes missing coverage. Please review. :white_check_mark: Project coverage is 76.85%. Comparing base (60c70be) to head (abb57fd). :warning: Report is 116 commits behind head on 17.0.

Files with missing lines Patch % Lines
...endance_compliance/tests/test_attendance_config.py 89.18% 8 Missing :warning:
...pp_attendance/tests/test_attendance_controllers.py 91.17% 6 Missing :warning:
spp_custom_field/tests/test_custom_field.py 98.37% 1 Missing and 1 partial :warning:
Additional details and impacted files
@@            Coverage Diff             @@
##             17.0     #782      +/-   ##
==========================================
+ Coverage   75.02%   76.85%   +1.82%     
==========================================
  Files         727      775      +48     
  Lines       19228    20656    +1428     
  Branches     2400     2521     +121     
==========================================
+ Hits        14426    15875    +1449     
+ Misses       4293     4211      -82     
- Partials      509      570      +61     

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

:rocket: New features to boost your workflow:
  • :snowflake: Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • :package: JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

codecov[bot] avatar Mar 24 '25 10:03 codecov[bot]

@gonzalesedwin1123 can you please take a look at the latest changes from @shashikala1998 ? Thanks!

kneckinator avatar Apr 30 '25 03:04 kneckinator

Yes @kneckinator . I will check this today.

gonzalesedwin1123 avatar May 05 '25 02:05 gonzalesedwin1123

Yes @kneckinator . I will check this today.

Great @gonzalesedwin1123 . Did you find anything or can this be merged?

kneckinator avatar May 06 '25 03:05 kneckinator

Yes @kneckinator . I will check this today.

Great @gonzalesedwin1123 . Did you find anything or can this be merged?

@kneckinator I just requested for changes from @shashikala1998 regarding the sonarqubecloud report.

gonzalesedwin1123 avatar May 07 '25 00:05 gonzalesedwin1123

Quality Gate Failed Quality Gate failed

Failed conditions 24 Security Hotspots 7.2% Duplication on New Code (required ≤ 3%)

See analysis details on SonarQube Cloud

@shashikala1998 can you fix these. I think this is important.

gonzalesedwin1123 avatar May 07 '25 00:05 gonzalesedwin1123

@shashikala1998 please check the sonarqubecloud report and make the necessary fixes. Thanks.

@shashikala1998 there are two main topics:

  • The duplicated lines in the tests; for instance, create a parametrised function to generate a attendance record in spp_cycle_attendance_compliance/tests/test_cycle_attendance.py
  • Use https in the event_data_source in the tests, to avoid false positives from the scan performed by SonarCloud

You should also change test.com to use either example.com, or any domain in the TLD .example. RFC 2606 has reserved this TLD for testing, so you can for instance use https://test.example instead of http://test.com

kneckinator avatar May 12 '25 05:05 kneckinator

@gonzalesedwin1123 @kneckinator sonarqubecloud reports issues are fixed and Quality gate passed

shashikala1998 avatar May 14 '25 03:05 shashikala1998

@gonzalesedwin1123 @kneckinator sonarqubecloud reports issues are fixed and Quality gate passed

Thanks @shashikala1998 . Can you please take a final look @gonzalesedwin1123 ?

kneckinator avatar May 27 '25 03:05 kneckinator

@kneckinator I think this PR is OK. Do you have other concerns? Otherwise, I can merge this to 17.0 but this will not be included in the Ticao release.

gonzalesedwin1123 avatar Aug 26 '25 01:08 gonzalesedwin1123