Testing Code

Created by Chia, Jonathan on Apr 09, 2022

Introduction

You already test your code manually, so why not write a few more lines of code to document and automate your tests?

Benefits of Unit Testing

  • Detect bugs earlier: Running big data projects is time consuming. You don't want to get an unexpected output after 3-hours when you could have easily avoided it.

  • Easier to update code: You will no longer be afraid of changing your code because you know what to expect.

  • Push you to organize your code: You will write cleaner code and prefer to write in DAGs instead of linearly chaining functions when you keep in mind you are gonna test your codes with isolated pieces. (use d6tflow to build data science workflows easily)

  • Give you confidence on the outputs: Bad data leads to bad decisions. Running unit tests gives you confidence on data quality. You know your code outputs what you want it to output.

- Norman Niemer, Chief Data Scientist

R

https://r-pkgs.org/tests.html

Shiny

https://mastering-shiny.org/scaling-testing.html

Python

https://towardsdatascience.com/unit-testing-for-data-scientists-dc5e0cd397fb

Unit Testing with SQL Developer 21.2 (PL/SQL)

https://docs.oracle.com/cd/E15846_01/doc.21/e15222/unit_testing.htm#RPTUG45000

Document generated by Confluence on Apr 09, 2022 16:54

Atlassian

Last updated