Export a failed case from run_test_plan() to an RDS file. The record
contains the case, replay command, package revision, fixture evidence,
initial R seed and RNG kind, and the observed R environment. It includes
the failure diagnostic. Review these fields before sharing the file.
Usage
write_test_replay(evidence, id, file)
replay_test_case(
file,
path = ".",
download_fixtures = FALSE,
fixture_cache = NULL,
timeout = Inf
)Arguments
- evidence
A result from
run_test_plan().- id
Exact ID of a failed named case in
evidence.- file
Path to the RDS file. Writing requires a new file in an existing directory. Replay reads the file without changing it.
- path
Path to the matching source package root.
- download_fixtures
Allow HTTPS downloads of declared fixtures when a verified copy is unavailable in the cache. Defaults to
FALSE.- fixture_cache
BiocFileCache directory.
NULLuses the package's user cache directory,tools::R_user_dir("biocroxytest", "cache").- timeout
Maximum seconds for each isolated R process, including package loading and suite hooks. Defaults to
Inf. Copying files and preparing fixtures take place before this limit starts. After a timeout the plan continues with the remaining cases. It attempts to stop child processes and records any cleanup error with the timeout. The maximum finite limit is.Machine$integer.max / 1000seconds.
Value
write_test_replay() returns the saved record invisibly.
replay_test_case() returns a run_test_plan() result with a
comparison list. It contains same_failure (whether the case
failed with matching condition types, messages and available source
locations), environment_changes (names of
changed environment fields), and original_detail.
Details
Replay from the matching package source with the recorded fixture inputs.
Replay checks the package revision and fixture availability and checksums
before running the test. It restores the initial R seed and the recorded
values of CI, NOT_CRAN and TZ in the test process.
New records use the package input manifest to verify the revision.
Older records still verify the full checkout using their original rules.
The report records environment differences. Install matching R and
package versions yourself. Control other environment settings and any
random streams maintained outside base R in your test setup.
Diagnostics containing changing values, such as randomly named files,
can prevent a match.
Use a replay file and source package you trust.
Save the record outside the source tree so the export does not change the
package revision. Run the recorded command from the source root. Update
its file path if the RDS file moves and pass fixture_cache if needed.
Examples
if (interactive() && file.exists("../case-failure.rds")) {
replay_test_case("../case-failure.rds")
}
