R-Computing-Lab / BGmisc

Functions for extended pedigree analysis
https://r-computing-lab.github.io/BGmisc/
GNU General Public License v3.0
1 stars 3 forks source link

Increase test coverage #12

Closed wjakethompson closed 7 months ago

wjakethompson commented 8 months ago

JOSS review criterion: Automated tests (openjournals/joss-reviews#6203)

Using covr::package_coverage(), I see 62.94% test coverage. This is a little lower than I think is preferred. The output below indicates the coverage by file, and there are several files with 0 or very low coverage. Not being familiar the subject matter of the package, I'm not sure whether it would be possible to write additional tests for these functions, but is something to consider.

I'd also recommend automating test coverage with a GitHub action. Right now, tests will be run as part of the R CMD CHECK action, which would indicate if a test was newly failing. However, adding a test coverage action would allow you to monitor how new PRs affect overall test coverage, which could then also be reported with a badge in the README. usethis::use_github_action("test-coverage") will set this up.

covr::package_coverage()

#> BGmisc Coverage: 62.94%
#> R/checkIDs.R: 0.00%
#> R/tweakPedigree.R: 0.00%
#> R/checkSex.R: 12.12%
#> R/helper.R: 28.57%
#> R/identification.R: 48.15%
#> R/famSizeCal.R: 50.00%
#> R/formula.R: 57.14%
#> R/family.R: 60.00%
#> R/evenInsert.R: 66.67%
#> R/plotPedigree.R: 83.33%
#> R/convertPedigree.R: 88.15%
#> R/simulatePedigree.R: 93.40%
#> R/cleanPedigree.R: 95.00%
smasongarrison commented 7 months ago

Thanks again for introducing me to covr. It's a really neat tool.

I'm pretty pleased with how high I was able to get the coverage. At this point, most of the things not covered are for handling specific kinds of data sets, file structures, or specific errors. (Such as someone trying to fit a component model using fitComponentModel that's not identified. I'll eventually task a student with implementing a check to confirm that that error message triggers)

> covr::package_coverage()
BGmisc Coverage: 85.36%
R/identifyModel.R: 62.96%
R/checkSex.R: 69.44%
R/tweakPedigree.R: 70.27%
R/helpPedigree.R: 75.00%
R/evenInsert.R: 80.00%
R/helper.R: 81.48%
R/famSizeCal.R: 85.29%
R/family.R: 88.73%
R/convertPedigree.R: 92.59%
R/plotPedigree.R: 93.33%
R/checkIDs.R: 94.74%
R/cleanPedigree.R: 95.45%
R/simulatePedigree.R: 99.43%
R/formula.R: 100.00%
wjakethompson commented 7 months ago

This looks great! Glad I could help!