[Tutor] unittest: looking for examples
Kent Johnson
kent37 at tds.net
Wed Aug 17 15:01:57 CEST 2005
Christian Meesters wrote:
> - unittests for methods of classes getting all data from a file as a
> classmethod
Not sure what you mean by this, can you give a simple example?
> - unittests for reading and saving files in a specific way (= sanity
> tests for file handling)
When I want to test a function that writes a file I usually have a collection of reference files and compare the actual results of running the function against the reference file.
To test reading a file, again I have a reference file that is read, then I test the results of the read.
Round-trip tests can be helpful too - read a file, write the data back out and compare with the original.
> Point is that I want to test such methods directly, but also that I
> cannot set up unittest in my case without getting some data from a file
> (otherwise my testing module would get way too big).
Not sure why that is a problem...
HTH
Kent
More information about the Tutor
mailing list