Helper code and files for your testthat tests - R-hub blog
If your package uses testthat for unit testing, as many packages on CRAN, you might have wondered at least once about where to put โthingsโ you wished to use in several tests: a function generating a random string, an example image, etc. In this blog post, we shall offer a round-up of how to use such code and files when testing your package. Code called in your tests Remember our post about internal functions in R packages? What about internal functions in unit tests of R packages? And code that needs to be run for tests?

