Testing Guide for nexodiff
Source:TESTING.md
This document covers testing for the nexodiff R package.
Test Structure
tests/
├── testthat.R # Main test entry point
└── testthat/
├── _snaps/ # Visual regression snapshots
├── test-comp-04.R # Pairwise comparison tests
├── test-exprdata-*.R # Expression data tests
├── test-integration-* # Integration tests
└── test-unit-* # Unit tests
Running Tests
Quick Start
devtools::test()Custom Test Runner
# Run all tests (generates test-out.xml)
Rscript run_tests.R
# Verbose output
Rscript run_tests.R --reporter summary
# Filter tests
Rscript run_tests.R exprdata
# Force reinstall
Rscript run_tests.R --force| Option | Description |
|---|---|
-f, --force
|
Force package reinstallation |
--reporter <name> |
Specify reporter (default: junit) |
<filter> |
Run tests matching filter |
Visual Regression Testing
Uses vdiffr::expect_doppelganger() to compare plots against snapshots in tests/testthat/_snaps/.
Update snapshots when plots change intentionally:
vdiffr::manage_files()Visualizing Test Results with Allure
Allure provides enhanced test visualization with interactive reports, historical trends, and execution logs.
Test Data
Test datasets are in inst/extdata/:
| Dataset | Purpose |
|---|---|
sim_inputs/test01/ |
Basic functionality |
sim_inputs/test04/ |
Large-scale simulation |
test_data1/ |
Integration tests |
Generate test data with:
test <- nexodiff::make_test_data("test01", tempdir(TRUE))