External link

Automated testing with 'testthat' in practice

Automated testing with 'testthat' in practice

Abstract

You test your code. We know you do. How else are you sure that your changes don’t break the program? But after you commit, you discard those pesky scripts and throw away code. Don’t you think it’s a bit of a waste to dump all that effort that took you quite a decent chunk of your day to conjure? Well, here you are, so let’s see another way. A better way.

In the words of Hadley Wickham, author of the testthat package, “It’s not that we don’t test our code, it’s that we don’t store our tests so they can be re-run automatically.”

In this tutorial we are going to see how to accomplish this using automated unit testing, leveraging the testthat package. We’ll cover (pun intended) how much of your code went untested, with the covr package, and also we’ll learn to test functions independently of their dependencies, making use of mock functions.

We’ll also introduce Test-driven Development, or TDD.

Date
Location
Room 18.0.A09. Campus de Getafe, Calle Madrid, 126, 28903 Getafe, Madrid, Spain.

Requirements

R/RStudio + testthat and covr packages.

About the speaker

Virginia has a solid scientific background. She earned her math degree and diploma in statistics from the Universidad de Salamanca.

Extracting value from data for more than a decade. Identifying patterns, performing analysis, optimizations and predictions. Continuously learning the latest technologies to enable the business strategy

Communication and knowledge sharing have been an integral part of her duties.

She has developed her career in several sectors, and have worked for companies such as Vodafone, Tuenti, SEUR and El Confidencial. Currently, she is owner of the A.I. initiative at Indigitall.