-
Notifications
You must be signed in to change notification settings - Fork 321
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Better documentation of helper and setup files #1638
Comments
Setup and teardownSometimes there is truly global test setup that would be impractical to build into every single test and that might be tailored for test execution in non-interactive or remote environments. Examples:
Put such code in If any of your setup should be reversed after test execution, you should also include the necessary teardown code in Here's a
Since we are just modifying options here, we can be even more concise and use the pre-built function
|
Working on the testing chapter of R Packages has made me think that the "special files" of testthat are under-documented.
It's not very easy to find out that they exist or to get advice on how best to use them.
I suspect there should probably be a vignette for this.
As it stands, the only docs I find are here in a "Special files" section that appears in the help for
test_file()
and is inherited into the help fortest_package()
/test_local()
/test_check()
:https://testthat.r-lib.org/reference/test_file.html#special-files
Below I'm going to paste some material I originally wrote for the revision of the testing chapter of R Package, but that feels too detailed. Maybe it can be used in testthat.
The text was updated successfully, but these errors were encountered: