r-testing

Automate R package testing workflows with testthat 3.

Updated Aug 23, 2026
One-click install
npx skills add https://github.com/jjjermiah/dot-agents --skill r-testing
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: r-testing
Source: https://github.com/jjjermiah/dot-agents/tree/main/src/dot-agents/skills/r-testing
Command: npx skills add https://github.com/jjjermiah/dot-agents --skill r-testing

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

R package authors often struggle to organize and maintain robust tests; this skill standardizes modern testing using testthat 3 to ensure reliability and coverage.

Core Features & Use Cases

  • Guidance for creating tests with testthat 3, including file structure, fixtures, and helper utilities.
  • Support for both standard test_that and BDD describe/it styles to organize unit and integration tests.
  • Best-practice patterns for fixtures, snapshot testing, and test isolation to improve reliability and maintainability.

Quick Start

Run testthat 3 for your R package to initialize tests and verify coverage.

Frequently Asked Questions about r-testing

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I structure unit tests for an R package using testthat 3?

Structure R package unit tests with testthat 3 by organizing test files into standard directories, applying setup conventions, and using helper utilities to define fixtures for test isolation. This ensures consistent test organization and maintainability across your package.

What is snapshot testing in R and when should I use it?

Snapshot testing in R captures and validates the exact output of functions to detect unexpected changes over time. Use snapshot validation to lock down complex outputs like printed tables or error messages, ensuring reliable regression checks across local and CI environments.

Can I use BDD style testing with testthat in R?

Yes, testthat supports both standard test_that blocks and BDD describe/it styles to organize unit and integration tests. This allows you to structure R package testing workflows behaviorally when specifying complex feature interactions.

How do I manage test fixtures for R package testing in CI environments?

Manage test fixtures in CI environments by following testthat 3 setup conventions and best practices for test isolation. Standardizing fixtures ensures that unit tests run reliably and consistently across both local development and automated CI pipelines.

What's the best way to initialize testthat 3 tests for an R package?

Initialize testthat 3 tests for an R package by applying the skill's automated workflow to set up file structures, helper utilities, and snapshot validation. This standardizes modern testing conventions to ensure robust reliability and code coverage from the start.