Accueil > Informatique [computer science] > Fortran > Test Driven Development
Test Driven Development
Test first !
mercredi 27 mars 2013, par
TDD is appropriate for scientific computing because a computing program is generally composed of a lot of functions whose returned values are well defined and can be easily tested.
- Write a unit test.
- Be sure that it fails (because you have not yet written the function !).
- Write the simplest function that can pass the test.
- Refactor the code (improve the design of the code without changing its behaviour).
- Go to 1.
Comments
If a test fails, there is a bug (in the code or in the test !)
If all tests are OK, who knows ?
Tests are like little experiments that try to falsify the program (cf. Karl Popper).
TDD is thus a scientific method for programming.
Writing tests first favours more independent modules.
And you are sure that most of the code will be covered by tests.
Ressources
- http://en.wikipedia.org/wiki/Test-driven_development
- http://www.extremeprogramming.org/
- http://en.wikipedia.org/wiki/Extreme_programming
- http://referentiel.institut-agile.fr/tdd.html
- An Approach to Scientific Software Engineering, Bruno Piar.
- Gagliardi, F., Epistemological Justification of Test Driven Development in Agile Processes. Lecture Notes in Computer Science (Including Subseries Lecture Notes in Artificial Intelligence and Lecture Notes in Bioinformatics). Vol. 4536 LNCS. 2007.
- http://en.wikipedia.org/wiki/KISS_principle