Get access to all lessons in this course.
Package Development with R
- devtools and usethis
- Package names and authors
- Choose a license
- Setup git + GitHub
- Writing functions
- Adding functions to our package
- Using other packages
- Packages so good they get their own functions
- Organizing .R files
- roxygen2: In-Line Documentation for R
- Argument descriptions and examples
- Helper functions
- Joining documentation
- Unit tests for R
- Organizing tests
- R CMD Check
- Types of Test Files
- Test Coverage
Add data and files
- Store data and files
- Include data for tests and create RMarkdown templates
- Create other templates
- Launch and store Shiny apps
- Citations, ignoring files, and including add-ins
Types of Test Files
This lesson is locked
This lesson is called Types of Test Files, part of the Package Development with R course. This lesson is called Types of Test Files, part of the Package Development with R course.
Click on the transcript to go to that point in the video. Please note that transcripts are auto generated and may contain minor inaccuracies.
Working in the exercises.Rmd file:
Both test-count-donations.R and test-tables.R use donations_test_data. Let’s move it to a helper file. First, create the file with fs::file_create(“tests/testthat/helper-donations_data.R”).
Open it manually or use edit_file().
Move the code to create donations_test_data into helper- donations_data.R.
Remove the donations_test_data code from the two test files.
Run the tests.
The blog post Helper code and files for your testthat tests by Maëlle Salmon can be helpful to learn about types of test files.