Skip to contents

Write testthat checks next to the R functions they cover. biocroxytest generates ordinary test files and a separate long-test suite for Bioconductor packages. It builds on roxytest and uses testthat to run the generated tests.

Start with one test. Our first tutorial uses a complete small package: select samples in a requested order, generate a test, see it pass, then introduce a bug and see it fail. You can copy the example without changing your own project.

Choose your next step

I want to… Guide
Generate and run my first test First test
Apply the same assertions to memory and HDF5 inputs Named cases
Record a failed case and reproduce it Failure replay
Use checked input files Fixtures
Require cases in CI, compare runs or migrate from roxytest Workflow recipes
Find smaller paired data that retain a specific failure Failure reduction

The first three guides form a learning path. Named cases, execution reports and replay are optional: ordinary @tests and @longtests remain useful on their own. Generated tests run with standard testthat; install biocroxytest where you generate them or use its optional runners.

Installation

GitHub development build

This site documents the GitHub devel branch. Use this build for the tutorials and the unified ordinary/long-test workflow. It requires R 4.4 or newer. The first tutorial includes installation commands for its Bioconductor example dependencies.

if (!requireNamespace("BiocManager", quietly = TRUE)) install.packages("BiocManager")
if (!requireNamespace("remotes", quietly = TRUE)) install.packages("remotes")
BiocManager::install("xec-cm/biocroxytest@devel", update = FALSE)

Bioconductor release

biocroxytest has been available through Bioconductor since 3.19. Install the release compatible with your R version using BiocManager:

if (!requireNamespace("BiocManager", quietly = TRUE)) install.packages("BiocManager")
BiocManager::install("biocroxytest")

Use the Bioconductor package page and release vignette for that build; development features may not yet be available there.

How it fits into a package

Add @tests or @longtests to a function’s roxygen comments. Configure biocroxytest::tests_roclet alongside your existing roclets in DESCRIPTION, then run roxygen2::roxygenise(). Commit the generated tests with the source and run the appropriate suite.

Declaration Destination Execution
@tests tests/testthat/ devtools::test() or the ordinary package check
@longtests longtests/testthat/ Separate long-test check
@testCases The suite chosen by each named case Standard testthat or selection by case ID

The first tutorial shows the full setup, generated file and passing/failing output. For complete arguments and return values, use the function reference.

Contributing

Report bugs or propose changes through GitHub Issues. Include a minimal reproducible example when reporting a failure. Contributions follow the Bioconductor Code of Conduct.