Apache::TestSmoke - Special Tests Sequence Failure Finder |
Apache::TestSmoke - Special Tests Sequence Failure Finder
# get the usage and the default values % t/SMOKE -help
# repeat all tests 5 times and try 20 random iterations # and save the report into the file 'myreport' % t/SMOKE -times=5 -iterations=20 -report=myreport
# run all tests default number of iterations, and repeat tests # default number of times % t/SMOKE
# same as above but work only the specified tests % t/SMOKE foo/bar foo/tar
# run once a sequence of tests in a non-random mode # e.g. when trying to reduce a known long sequence that fails % t/SMOKE -order=rotate -times=1 foo/bar foo/tar
# now read the created report file
When we try to test a stateless machine (i.e. all tests are independent), running all tests once ensures that all tested things properly work. However when a state machine is tested (i.e. where a run of one test may influence another test) it's not enough to run all the tests once to know that the tested features actually work. It's quite possible that if the same tests are run in a different order and/or repeated a few times, some tests may fail. This usually happens when some tests don't restore the system under test to its pristine state at the end of the run, which may influence other tests which rely on the fact that they start on pristine state, when in fact it's not true anymore. In fact it's possible that a single test may fail when run twice or three times in a sequence.
To reduce the possibility of such dependency errors, it's helpful to run random testing repeated many times with many different srand seeds. Of course if no failures get spotted that doesn't mean that there are no tests inter-dependencies, which may cause a failure in production. But random testing definitely helps to spot many problems and can give better test coverage.
When this kind of testing is used and a failure is detected there are two problems:
This utility attempts to solve both problems, and at the end of each iteration print a minimal sequence of tests causing to a failure. This doesn't always succeed, but works in many cases.
This utility:
In addition the systems build parameters are logged into the report file, so the detected problems could be reproduced.
Goto 1 and run again using a new random seed, which potentially should detect different failures.
Currently for each reduction path, the following reduction algorithms get applied:
t/SMOKE.PL is driving this module, if you don't have it, create it:
#!perl use strict; use warnings FATAL => 'all'; use FindBin; use lib "$FindBin::Bin/../Apache-Test/lib"; use lib "$FindBin::Bin/../lib"; use Apache::TestSmoke (); Apache::TestSmoke->new(@ARGV)->run;
usually Makefile.PL converts it into t/SMOKE while adjusting the perl path, but you create t/SMOKE in first place as well.
Stas Bekman
Apache::TestSmoke - Special Tests Sequence Failure Finder |