Grow your data science skills at posit::conf(2024)

August 12th-14th in Seattle

New and Improved Testing

In this webinar, we’ll introduce some of the major changes coming in testthat 3.0.0. The biggest new idea in testthat 3.0.0 is the idea of an edition. You must deliberately choose to use the 3rd edition, which allows us to make breaking changes without breaking old packages. testthat 3e deprecates a number of older functions that we no longer believe are a good idea, and tweaks the behavior of expect_equal() and expect_identical() to give considerably more informative output (using the new waldo package).

 

testthat 3e also introduces the idea of snapshot tests, which record expected value in external files rather than in code. This makes them particularly well suited to testing user output and complex objects. We’ll show off the main advantages of snapshot testing, and why it’s better than our previous approaches of verify_output() and expect_known_output().

 

Finally, we’ll go over a bunch of smaller quality-of-life improvements, including tweaks to test reporting and improvements to expect_error(), expect_warning() and expect_message().

Subscribe to more inspiring open-source data science content.

We love to celebrate and help people do great data science. By subscribing, you'll get alerted whenever we publish something new.