-
Notifications
You must be signed in to change notification settings - Fork 15
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
Generate coverage reports for our test suite and integrate it into our CI #245
Comments
I have investigated the R IntegrationFirst, It is not straight forward to integrate ## define paths
code.dir = c(".")
test.dir = c("./tests")
## define filter
test.regex = ""
## generate coverage report
test.files = unlist(sapply(test.dir, list.files, pattern = "\\.R$", full.names = TRUE))
test.files = test.files[grepl(test.regex, test.files)]
code.files = unlist(sapply(code.dir, list.files, pattern = "\\.R$", full.names = TRUE))
code.files = code.files[!code.files %in% c("./tests.R", "./showcase.R", "./install.R", "./util-init.R")]
report = covr::file_coverage(source_files = code.files, test_files = test.files) In this integration, all files ending with Browse[1]> report
Coverage: 79.17%
./util-networks-metrics.R: 0.00%
./util-plot-evaluation.R: 0.00%
./util-plot.R: 0.00%
./util-tensor.R: 0.00%
./util-bulk.R: 22.58%
./util-core-peripheral.R: 38.04%
./util-conf.R: 73.99%
./util-data.R: 85.45%
./util-misc.R: 86.13%
./util-data-misc.R: 87.50%
./util-networks.R: 92.83%
./util-read.R: 92.83%
./util-networks-misc.R: 94.12%
./util-networks-covariates.R: 94.91%
./util-split.R: 97.69%
./util-motifs.R: 98.82% Forwarding this report to their online service does not seem to work right out the box, I did not investigate the causes yet (it might be related to us using Browse[1]> cov = covr::codecov(coverage = report)
Request failed [400]. Retrying in 1 seconds...
Request failed [400]. Retrying in 1 seconds...
Browse[1]> cov
{html_document}
<html>
[1] <body><p>Could not determine repo and owner</p></body> CaveatsUnfortunately, there are some caveats of this approach that I will discuss in the following:
Lines 37 to 38 in a0c3a52
I have tried to circumvent this by adding a new file SummaryI do believe, coverage reports would greatly benefit coronet and that |
Here comes a small follow-up: Other coverage toolsI tried finding other suitable coverage tools to compare them to Integrating it in our library("testCoverage")
## define paths
code.dir = c(".")
test.dir = c("./tests")
## define filter
test.regex = ""
## generate coverage report
test.files = unlist(sapply(test.dir, list.files, pattern = "\\.R$", full.names = TRUE))
test.files = test.files[grepl(test.regex, test.files)]
code.files = unlist(sapply(code.dir, list.files, pattern = "\\.R$", full.names = TRUE))
code.files = code.files[!code.files %in% c("./tests.R", "./showcase.R", "./install.R", "./util-init.R")]
report = testCoverage::reportCoverage(sourcefiles = code.files, executionfiles = test.files)
From a first look, it seems to correctly instrument
These errors cause the coverage to be close to 0%, however I was able to receive 25% with less but still a significant amout of these weird errors earlier 🤷♂️.
|
We already had thought about that some years ago, but we never integrated or deployed it:
It would be very helpful to generate a coverage report when running our test suite, to find out which parts of coronet need more tests, which branches are uncovered yet, etc.
To not forget about this, I open this issue.
In general, there are two tasks:
testthat
andpatrick
packages that we use for testing, and identify the advantages and drawbacks of the different coverage toolsThe text was updated successfully, but these errors were encountered: