Learn R Programming

SpaDES (version 1.2.0)

moduleCoverage: Calculate module coverage of unit tests

Description

Calculate the test coverage by unit tests for the module and its functions.

Usage

moduleCoverage(name, path)
"moduleCoverage"(name, path)
"moduleCoverage"(name)

Arguments

name
Character string. The module's name.
path
Character string. The path to the module directory (default is the current working directory).

Value

Return a list of two coverage objects and two data.table objects. The two coverage objects are named `moduleCoverage` and `functionCoverage`. The `moduleCoverage` object contains the percent value of unit test coverage for the module. The `functionCoverage` object contains percentage values for unit test coverage for each function defined in the module. Please use shine to view the coverage information. Two data.tables give the information of all the tested and untested functions in the module.

See Also

newModule.

Examples

Run this code
## Not run: 
#  library(igraph) # for %>%
#  library(SpaDES)
#  tmpdir <- file.path(tempdir(), "coverage")
#  modulePath <- file.path(tmpdir, "Modules") %>% checkPath(create = TRUE)
#  moduleName <- "forestAge" # sample module to test
#  downloadModule(name = moduleName, path = modulePath) # download sample module
#  testResults <- moduleCoverage(name = moduleName, path = modulePath)
#  shine(testResults$moduleCoverage)
#  shine(testResults$functionCoverage)
#  unlink(tmpdir, recursive = TRUE)
# ## End(Not run)

Run the code above in your browser using DataLab