Description Usage Arguments Details Value Author(s) See Also Examples
This function reports on the test coverage provided by a suite of unit tests on a set of source files. Either a package or a disorganised set of files may be used but if a package is being used the source must be available.
1 2 3 4 5 6 7 8 | reportCoverage(packagename = "", packagedir = getwd(), htmlwd = getwd(),
rdir = file.path(packagedir, "R"), unittestdir = file.path(packagedir,
"inst", "tests"), sourcefiles = NULL, executionfiles = NULL,
reportfile = file.path(htmlwd, "coverage_report.html"),
outputfile = file.path(htmlwd, "traceOutput.txt"), ignorelist = "",
writereport = TRUE, clean = FALSE, verbose = TRUE,
refnamespaces = NULL, isrunit = FALSE,
runitfileregexp = "^test_.+\\.[rR]$", runitfuncregexp = "^test.+")
|
packagename |
Name of package. Optional if sourcefiles and executionfiles are specified instead. |
packagedir |
Path to package directory. Optional if sourcefiles and executionfiles are specified instead. |
htmlwd |
Directory to output HTML reports. Uses getwd() by default. |
rdir |
Source code directory. Assumes |
unittestdir |
Unit test directory. Assumes
|
sourcefiles |
Character vector of absolute file paths of source code. Optional if a package is specified. |
executionfiles |
Character vector of absolute file paths of unit tests to run. Optional is a package is specified. |
reportfile |
Report filename. "test.html" by default. |
outputfile |
Output filename. "traceOutput.txt" by default. |
ignorelist |
Ignore list. Empty by default. |
clean |
Should trace tables be removed? FALSE by default. |
writereport |
Should an HTML be created? Default is TRUE. |
refnamespaces |
Vector of namespaces where ::: referecing should be intercepted. NULL by default. |
isrunit |
Are the tests RUnit? Assumes testthat by default. |
runitfileregexp |
Regexp to check runit filenames against. |
runitfuncregexp |
Regexp to check runit function names against. |
The source files and unit test files must be specified
either by passing the packagedir parameter and
letting the function use default folders or by specifiying
a vector of filenames in sourcefiles and
executionfiles.
Generated HTML reports will be opened in the default browser. An internet connection is required to download external javascript resources that enable code annotation.
List where output$A contains a matrix of trace counts and output$B contains a sublist with counts for individual unit test files.
Mango Solutions support@mango-solutions.com
vignette("testCoverage", package = "testCoverage")
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | ## Not run:
reportCoverage(
sourcefiles = system.file("examples/add/R/add.R", package = "testCoverage"),
executionfiles = system.file("examples/add/inst/tests/testthat/",
c("tests0/test_add0.R", "tests1/test_add1.R"), package = "testCoverage"))
#If the unit tests are in the inst/tests folder the unittestdir parameter is
#unnecessary.
reportCoverage(
packagedir = system.file("examples/add/", package = "testCoverage"),
unittestdir = system.file("examples/add/inst/tests/testthat/tests1",
package = "testCoverage"))
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.