test_srcrefs_df {covtracer}R Documentation

Create a data.frame of coverage test srcref objects

Description

Extract unit test srcrefs from a coverage object. A test name will be derived from the test source code, preferrably from a written annotation, but otherwise falling back to using a code snippet. srcrefs are unique for each expression executed within a testing suite.

Usage

test_srcrefs_df(x)

Arguments

x

A package_coverage coverage object, from which the name of the package used is extracted.

Value

A data.frame of test srcrefs extracted from a coverage object. Contains one record for each srcref with variables:

name

A character test description. For testthat tests, the desc parameter will be used, otherwise a snippet of code will be used for the test name

srcref

A srcref object describing the location of the test

test_type

A character indicating the structure of the test. One of "testthat", "call" or NULL

See Also

srcrefs test_trace_mapping

Other srcrefs_df: pkg_srcrefs_df(), trace_srcrefs_df()

Examples

options(covr.record_tests = TRUE)
pkg_path <- system.file("examplepkg", package = "covtracer")
cov <- covr::package_coverage(pkg_path)
test_srcrefs_df(cov)


[Package covtracer version 0.0.1 Index]