Skill / SKILL.md

R Testthat

posit-dev/skills

Best practices for writing R package tests with testthat version 3+. Use this skill when writing or organizing tests for an R package or when improving existing tests that use testthat. It covers test structure and expectations, self-sufficient test design, proper cleanup with withr, fixtures, mocking external dependencies, snapshot testing, and BDD-style describe/it patterns.
1 views 576 repository starsUpdated Nov 27, 2026
Overview

Best practices for writing R package tests with testthat version 3+. Use this skill when writing or organizing tests for an R package or when improving existing tests that use testthat. It covers test structure and expectations, self-sufficient test design, proper cleanup with withr, fixtures, mocking external dependencies, snapshot testing, and BDD-style describe/it patterns.

Installation & variants

Download the repository, including the skill’s supporting files.

git clone -- 'https://github.com/posit-dev/skills' skill-source

Use the complete skill-source/r-lib/r-testthat directory with your client’s skill installer.

Source directory r-lib/r-testthat

Source instructions
Read source instructions

Open to load source instructions

Original SKILL.md

Open to load the original file

Source & validation
Source status
Awaiting source check
Format validation
Format valid
Checked at
Pending source check
Content SHA-256
1ab412ca413fa9a1420e74157af3828218dafe7d15fe560c19b11986264c0d02
Discussion
Comments Be the First to Comment

Please log in to comment

    No comments yet

Related skills