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 Gary S. Thompson on October 30, 2006 - 18:06:
Edward d'Auvergne wrote:

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 suggest that the unit tests are kept with their Module as it makes it easier to check what test goes with what, avoids name clashes and allows you to quickly check that there is one unit test per module...

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.


Though as Murray Rust points out not impossible ;-)

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.


+1



Edward

.



--
-------------------------------------------------------------------
Dr Gary Thompson
Astbury Centre for Structural Molecular Biology,
University of Leeds, Astbury Building,
Leeds, LS2 9JT, West-Yorkshire, UK             Tel. +44-113-3433024
email: garyt@xxxxxxxxxxxxxxx                   Fax  +44-113-2331407
-------------------------------------------------------------------






Related Messages


Powered by MHonArc, Updated Mon Oct 30 19:01:42 2006