Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GitHub Actions to check Unit Test Coverage for each package #3206

Open
meetagrawal09 opened this issue Aug 3, 2023 · 5 comments
Open

GitHub Actions to check Unit Test Coverage for each package #3206

meetagrawal09 opened this issue Aug 3, 2023 · 5 comments

Comments

@meetagrawal09
Copy link
Collaborator

Description

I would like to propose adding an action item about checking unit test coverage for packages on CI. This is a step towards always having packages cross a specific percentage of test coverage whenever new functions are added to them. This will enforce (up to some degree) the author of a new function to add tests (might be basic) for the newly added function(s). The step is necessary to always maintain package functions reliable : )

Proposed Solution

I have identified 2 approaches for this :

  1. Having line coverage as a metric. Using the covr package we can get line coverage percentages for each package which can help in deciding on how well the package has been tested.

  2. Having function coverage as a metric. Here we use file names (or file contents) in the tests/testthat directory to decide on how good the test coverage is.

Alternatives Considered

The reviewer can ask the PR author to add tests for the new functions that he/she might have added to the package(s). But that just increases the job of the reviewer.

@meetagrawal09
Copy link
Collaborator Author

I would vote for the second solution (function coverage). This is because functions do have unit tests which get skipped on CI because they need an additional setup to execute for e.g tests dependent on BETYdb. These tests won't be run by the covr package and so will not be considered while calculating line coverage.

@Aariq
Copy link
Collaborator

Aariq commented Aug 15, 2023

I would vote for the second solution (function coverage). This is because functions do have unit tests which get skipped on CI because they need an additional setup to execute for e.g tests dependent on BETYdb. These tests won't be run by the covr package and so will not be considered while calculating line coverage.

That's actually a good reason for using covr—as motivation to eventually get tests that can be run on CI (e.g. with database mocking #3066)

@Gmin2
Copy link

Gmin2 commented Dec 30, 2023

@Aariq @meetagrawal09 can i work on adding covr in the ci?

@meetagrawal09
Copy link
Collaborator Author

@Min2who, thanks for showing your interest in contributing to the issue. I am working on improving our tests without which covr will always fail in CI.
Just a side note : Try picking up issues that do not have a Topic : Discussion tag to them since these are not yet ready for implementation and rather just to take a community input on the subject.

@Gmin2
Copy link

Gmin2 commented Dec 30, 2023

@meetagrawal09 can i work on test of this files
shiny/Data-Ingest/ui_files

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants