[fpc-pascal] order of unit tests
M.Santhoff at t-online.de
Sun Dec 7 11:10:19 CET 2008
Am Sonntag, den 07.12.2008, 09:20 +0200 schrieb Graeme Geldenhuys:
> On Sun, Dec 7, 2008 at 1:08 AM, Marc Santhoff <M.Santhoff at t-online.de> wrote:
> > Since I can save a lot of work depending on this orders I'd like to do
> > so. ;)
> Could you explain, I don't fully understand your statement.
I'd like to assume the order is fixed in this case:
Ich have two classes for a special file format. When writing tests I'd
- have one file in the format as a reference data, if
it can be read the sources are okay
- test the reader component on the reference file
- if the reader is okay, use it to re-read what the
writer component writes out
That way would avoid duplicating the code actually doing the work of
reading those files from the reader component into the unit test.
> > Is there any argument speaking against assuming fixed order behaviour?
> One of the design guidelines for unit testing is that tests must NEVER
> rely on the output of other tests. So the order of tests are really
> irrelevant. Any single tests or test suite must be able to run and
> pass without first having to run others in a set order.
Yes, I agree. But if I do the same reading process in the readers source
and in the test case I have two spots having the same code. Fixing
errors or making changes at one place only would be nice.
How could I solve this problem in a better way?
More information about the fpc-pascal