Test Driven Development (TDD) with Python

Philosophy:

Having a bug in production is extremely expensive. You probably know that comparison, where a bug found during development is 100 times cheaper than finding the same bug during production. So, we should focus on finding our bugs as soon as possible. Our first line of defensive is testing.

Problem: We can test the whole application Manually. But, it's time consuming.

Solution: We need to have an Automated Testing to solve all the above problems.

Types of Automated Testing:

Unit Tests – It is a piece of a code that invokes another piece of code (unit) and checks if an output of that action is the same as the desired output.

Integration Tests – It is testing a unit without full control over all parties in the test. They are using one or more of its outside dependencies, such as a database, threads, network, time, etc.

Functional Tests – It is testing a slice of a functionality of the system, observing it as a black box and verifying the output of the system to the functional specification.

Acceptance Tests – It is testing does the system fulfill expected business and contract requirements. It is considering the system as a black box.

What is TDD:

 TDD is an evolutionary approach to building and designing software solutions which is consisting of small cycles in which we are writing a unit test, that will initially fail, and then implementing the minimum amount of code to pass that test. After that code can be refactored to follow some good principles.