Test Driven Development with pytest

python_tutorials

Introduction

Good software is tested software. Testing our code can help us catch bugs or unwanted behavior.

Test Driven Development (TDD) is a software development practice that requires us to incrementally write tests for features we want to add. It leverages automated testing suites, like pytest – a testing framework for Python programs.

Automated Testing

Developers usually write code, compile it if necessary, and then run the code to see if it works. This is an example of manual testing. In this method we explore what features of the program work. If you would like to be thorough with your testing, you’ll have to remember how to test the various outcomes of each feature.

What if a new developer began to add features to the project, would you have to learn their features to test it as well? New features sometimes affect older features, are you going to manually check that all previous features still function when you added a new one?

Manual testing can give us a quick boost in confidence to continue development. However, as our application grows it becomes exponentially harder and tedious to continuously test our code base manually.

Automated

To finish reading, please visit source site