
Manually grading R code can be time-consuming. Instead, we can give students instant feedback with autograded code. Many autograding implementations exist (learnR, webR, Gradescope, EdStem Lessons, an “R package” approach, GitHub, etc.), but all require writing unit tests. $\textcolor{white}{aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa}$ This workshop will introduce approaches to unit testing for common problems (data wrangling, data import, functions, programs, vectors and lists, plots, code style, strings and regular expressions, SQL), as well as what packages and functions are useful for writing unit tests (testthat, lintr, autogradeR, base::parse, and utils::getParseData, etc), metaprogramming, how to balance test strictness (exact syntactical match) and test robustness (partial/full output matching), how to structure question prompts, and how to give useful feedback (assertr, praise) on failed tests.