Test Driven Development is a trend concept nowaways and it’s getting attention even more with the utilization of Python, and its unit test frameworks. I personally use the Unit test framework [1] straight in the command line and sometimes use the watch command to periodically test the code without need to run the script by hand [2]
Steps
TDD is basically divided in the following steps:
- Add a test
- Add the new test and run seeing if it will fail
- Writes the test to pass, i.e. the function that will make it pass
- Run again the tests
- Refactor the code – i.e. adequate the code to the new needs
Structure
The tests are basied in the follow struture:
- setup
- execution
- validation
- clean up
[1] https://docs.python.org/2/library/unittest.html
[2] http://www.linfo.org/watch.html