posit-dev avatar

Testing R Packages

This covers modern testthat 3+ patterns for R package testing, written by Garrick Aden-Buie. It's structured around the practical stuff: self-sufficient tests with withr for cleanup, snapshot testing for complex output, fixture patterns, and mocking with local_mocked_bindings. The guidance on test organization (mirroring your R/ structure) and the three scales of running tests (micro/mezzo/macro) is immediately useful. What I like is it pushes you toward better habits, repetition over clever abstractions, tests that work in isolation, and the load_all workflow instead of library calls. If you're writing or improving R package tests, this gives you the modern patterns without the philosophy lectures.

skills.sh installs
749
GitHub stars
562
last updated
Aug 21, 2026

Install

$ npx -y skills add posit-dev/skills --skill testing-r-packages --agent claude-code

Installs into .claude/skills of the current project.

Files

This covers modern testthat 3+ patterns for R package testing, written by Garrick Aden-Buie. It's structured around the practical stuff: self-sufficient tests with withr for cleanup, snapshot testing for complex output, fixture patterns, and mocking with local_mocked_bindings. The guidance on test organization (mirroring your R/ structure) and the three scales of running tests (micro/mezzo/macro) is immediately useful. What I like is it pushes you toward better habits, repetition over clever abstractions, tests that work in isolation, and the load_all workflow instead of library calls. If you're writing or improving R package tests, this gives you the modern patterns without the philosophy lectures.

Browse the repository on GitHub

Sponsors

Details

Repository
github.com/posit-dev/skills
Categories
Testing & QA, Documentation, Release Management
First seen
Jun 3, 2026

More from posit-dev/skills

All 19
1ruvnet avatartdd-workflowruvnet/rufloTDD London School workflow -- mock-first, outside-in test development743skills.sh installs
2mindrally avatarcypressmindrally/skillsCypress end-to-end testing best practices for web applications, covering test structure, commands, and reliability patterns.739skills.sh installs
3spatie avatarpest-testingspatie/freek.devTests applications using the Pest 4 PHP framework. Activates when writing tests, creating unit or feature tests, adding assertions, testing Livewire components,729skills.sh installs
4alirezarezvani avatarplaywright-proalirezarezvani/claude-skillsProduction-grade Playwright testing toolkit. Use when the user mentions Playwright tests, end-to-end testing, browser automation, fixing flaky tests, test migra687skills.sh installs
5aj-geddes avatarunit-testing-frameworkaj-geddes/useful-ai-promptsWrite comprehensive unit tests with high coverage using testing frameworks like Jest, pytest, JUnit, or RSpec. Use when writing tests for functions, classes, co622skills.sh installs
6wshaddix avatardotnet-testing-strategywshaddix/dotnet-skillsDeciding how to test .NET code. Unit vs integration vs E2E decision tree, test doubles.619skills.sh installs