View source: R/map_tests_stf.R
| map_tests_stf | R Documentation |
This function analyses the test directory used by the Standard Testing Framework (STF), typically 'tests/testthat/', and extracts a structured representation of the unit tests contained in the directory. It identifies test files, expectations, contexts, test names, and associated line ranges.
map_tests_stf(path = "tests/testthat")
path |
Character. Path to the test directory. Defaults to '"tests/testthat"'. |
The function scans all testthat test files matching the pattern 'test*.R'. For each file, it extracts structured metadata describing the hierarchy of expectations, including:
file name
context or description
test label
expectation type
line ranges associated with each expectation
Files that contain no parseable test structure are omitted. If no valid test files are found, the function returns 'NULL'.
A consolidated 'data.frame' where each row corresponds to an expectation discovered within the STF test directory. The data frame typically contains:
Name of the test file in which the expectation appears.
The combined description and test label assigned to the expectation.
The expectation type detected (e.g., 'expect_equal').
The associated line numbers for that expectation.
This structured mapping is used by downstream STF processing functions to support skip mapping, coverage enhancement, and reporting.
list.files,
lapply,
rbind
Other stf_utility:
create_coverage_skip_stf(),
map_test(),
nest_test(),
run_covr_skip_stf()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.