Getting started with unit testing in R

Automating the dev work you are probably already doing

Shannon Pileggi true
2021-11-11
Question: (39:27) How is running tests different than trying out different data types and sets on your function and debugging? Answer: It is not different at all! What I have learned from being around other talented programmers is that they don’t have amazing brains that they can hold all these different variables in… testing is about getting that stuff out of your brain so that a computer can execute it.

Figure 1: Question and answer, paraphrased, from the workshop.

blog post recording

Overview

A zoom workshop on unit testing for R-Ladies Philly.

Abstract

In this workshop, Shannon Pileggi and Gordon Shotwell discuss how to get started with unit testing in R, which is formal automated testing of functions within packages. We demonstrate handy functions in usethis and devtools, strategies for writing tests, debugging techniques, and broad concepts in function writing that facilitate a smoother testing process.

This workshop picks up exactly where we left our little ralph (aka R-Ladies Philly) package one year ago with “Your first R package in 1 hour: Tools that make R package development easy”. Participants will get the most out of this workshop if they review those materials in advance, or if they are already familiar with building R packages with devtools and usethis.

Citation

For attribution, please cite this work as

Pileggi (2021, Nov. 11). PIPING HOT DATA: Getting started with unit testing in R. Retrieved from https://www.pipinghotdata.com/workshops/2021-11-11-getting-started-with-unit-testing-in-r/

BibTeX citation

@misc{pileggi2021getting,
  author = {Pileggi, Shannon},
  title = {PIPING HOT DATA: Getting started with unit testing in R},
  url = {https://www.pipinghotdata.com/workshops/2021-11-11-getting-started-with-unit-testing-in-r/},
  year = {2021}
}