R Project for Statistical Computing

Write a test that increases code coverage for an R package

Some R packages use code coverage to measure the quality of their tests suite. Code coverage is the proportion of lines of package code that are executed during the test suite. The best is 100% which means that all package code is executed during the test suite, and the worst is 0% which means that no package code is executed during the test suite. For this task your goal is to write a new test for an R package that results in increased code coverage for that package.

The first step is to find an R package on github/gitlab/etc that already uses code coverage. Typical packages will have a badge on the README which shows the current code coverage percent. For example as of this writing the re2r package has 78% code coverage, https://github.com/qinwf/re2r/#re2r

The next step is to find some package code which is not yet covered by the current test suite. Typically you can find this by clicking on the code coverage badge, and following the links to folders/files with code coverage percentages less than 100. For example in re2r as of this writing most R/*.R files have 100% code coverage https://codecov.io/gh/qinwf/re2r/tree/master/R but match.R and print.R do not have full code coverage.

The final step is to write a new test that will run the lines of code which are currently un-covered, then commit that as a new test file, then submit a pull request to the repository. This task will be considered complete when the pull request page reports that the code coverage increases.

Task tags

  • tests
  • code coverage

Students who completed this task

VE FORBRYDERNE, aserapio

Task type

  • code Code
  • done_all Quality Assurance
close

2019