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?
Wrote about using #googlejules to migrate an #RStats test suite to #testthat
We present an interesting case study: we migrated the test suite of our R package ๐ซ๐๐๐ผ๐ป๐ป๐ฒ๐ฐ๐ from ๐ฅ๐จ๐ป๐ถ๐ to ๐๐ฒ๐๐๐๐ต๐ฎ๐ using ๐๐-๐ฝ๐ผ๐๐ฒ๐ฟ๐ฒ๐ฑ ๐ฐ๐ผ๐ฑ๐ถ๐ป๐ด ๐ฎ๐ด๐ฒ๐ป๐๐s. We used ๐๐ผ๐ผ๐ด๐น๐ฒ ๐๐๐น๐ฒ๐, an asynchronous coding agent, to handle the repetitive, multi-file refactoring work. The process wasn't just about automation, it required careful context preparation, environment setup, and iterative prompt engineering. Key ๐๐ฎ๐ธ๐ฒ๐ฎ๐๐ฎ๐๐: โข AI agents excel at tedious, semantics-aware tasks (like fixing ๐ฆ๐น๐ฑ๐ฆ๐ค๐ต_๐ฆ๐ฒ๐ถ๐ข๐ญ argument order across dozens of files) โข Managed VM environments reduce risks while maintaining utility โข Combining different AI tools (Jules + Aider) provided robust validation through "third-party" code review This results in a faithfully migrated test suite with equivalent coverage and behavior, achieved faster and with more confidence. Read about our process, challenges, and solutions in our news post. https://lnkd.in/d-QUGDJ4 #rstats #SoftwareDevelopment #AIEngineering #TestAutomation #OpenSource
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?
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?