In the code we trust -Test Driven Development using Python

Renu Khandelwal
Analytics Vidhya
Published in
6 min readOct 15, 2019

--

Today Continuous Integration and Continuous Deployment(CICD) is an integral part of software development and deployment. To implement CICD for Data Science projects we first need to adopt Test Driven Development(TDD). In this blog, we will learn why do we need TDD, what is TDD, how does it work and finally implementation in Python using fixtures

Prerequisites: Basic Python knowledge and exposure to data science or software development.

Why Test-Driven Development is required?

Based on Agile Lean development practices, to deliver a robust usable software to end-users at a quick pace, we need to continuously deliver software to end-users, get their feedback, and implement the feedback and deploy to production on demand.

To ensure that our code changes have not broken any of the pre-existing functionality, we need to perform extensive unit testing, functional testing and user acceptance testing. If done manually, then is a time-consuming effort or follow a test-driven development practice.

TDD Approach

In TDD, we write a failed test case first and then writing the production code to make the test case pass. Finally, we check for any code refactoring opportunities.

--

--

Renu Khandelwal
Analytics Vidhya

A Technology Enthusiast who constantly seeks out new challenges by exploring cutting-edge technologies to make the world a better place!