knitr::opts_chunk$set(echo = TRUE)
library(test.assessr)
The generate_test_report() function provides a unified way to generate HTML test assessment reports for R packages. It supports both standard testing frameworks (STF) and non-standard testing frameworks (NSTF) as well as single testing frameworks and multi‑framework test setups, producing a structured report that combines test summaries, detailed results, and coverage information.
Run the following code
dp <- system.file("test-data", "test.package.0001_0.1.0.tar.gz", package = "test.assessr") test_results <- get_package_coverage(dp) generate_test_report( test_results, output_dir = getwd() )
Important:
output_dir is required. It must be an existing, writable directory, such as:
getwd()
"path/to/output_dir"
If output_dir is missing or invalid, the function will error.
The generated HTML file will be written to output_dir. and named using the package name and version, for example:
test_report_mypackage_1.2.3.html
Regardless of setup, every report includes:
The function automatically normalizes input so that single‑ and multi‑framework results share the same report structure.
The report distinguishes between STF and NSTF testing frameworks and presents framework‑appropriate detail sections when available.
STF results come from testthat and/or testit frameworks.
When STF data are present, the report may include:
These sections appear only when STF elements are detected, keeping reports concise when they are not relevant.
See the dplyr test report in the inst/examples folder.
NSTF reporting supports lighter‑weight or base‑R‑style testing approaches, such as:
For NSTF frameworks, the report can include:
NSTF sections are generated only when relevant elements are present in test_results.
See the MASS test report in the inst/examples folder.
When test_results indicates a multi‑framework setup:
Any scripts or data that you put into this service are public.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.