mailRe: unit tests vs... the current test_suite


Others Months | Index by Date | Thread Index
>>   [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Header


Content

Posted by Edward d'Auvergne on October 30, 2006 - 16:46:
Hi Andrew
    Unit tests have been on my radar as well as I have used them under
java. As ususal having done things the wrong way round I am now
implementing unit tests for the ieee float functions. Here is my suggestion:

0. use unittest, it is a tried and tested methodology
1. if you have a file fred.py it should be accompanied by a unit test
files test_fred.py with the correct main function
2. if you have test data to go with fred.py it should be in  a directory
test_data_fred
3.  modify the relax test suite to scan the source directories for files
with the correct names and apply the tests...

I would suggest to add three directories within the 'test_suite' directory: 'unit_tests', 'system_tests', and 'regression_tests'. I would classify the current tests as system tests, although there will probably be overlap between the system and regression tests. To see the difference between the three types of test, have a look at the following links:

http://en.wikipedia.org/wiki/Software_testing
http://en.wikipedia.org/wiki/Unit_tests
http://en.wikipedia.org/wiki/System_testing
http://en.wikipedia.org/wiki/Regression_testing

The directory naming idea sounds good (point 3 may possibly be made
redundant by the unittest module).


as a general note you ought to write the unit tests first  ;-) before
coding if you want to stick to the 'true philosophy' of this methodology

so the idea is
1. suggest feature
2. define relevant unit tests
3. code unit tests
4. code feature
5. check / correct / add more unit tests as needed

Too late for most of relax ;) Retrofitting will be difficult. However as the redesign involves going through the code bit by bit, that should probably be the point of implementation! If we do this, I'm sure we'll catch literally hundreds of latent bugs in the program (most may never be encounter, but it would be a good clean out).

The suggested approach should probably be taken in the future once the
unit tests are added and after the redesign.

Edward



Related Messages


Powered by MHonArc, Updated Mon Oct 30 18:21:34 2006