B
Bil Kleb
My searching abilities are failing me today...
How does one detect an infinite loop bug with testunit?
We are writing code test-first and we have found a test which causes
an (erroneous) infinite loop, but we do not know how to write an
*automated* test to expose it -- i.e., we do not have the luxury
of using ctrl-c when this piece of testing code gets inserted into
our build/test robot.
We have been considering the following hack:
a) spawn two threads, one calling the code with the infinite
loop bug and another that merely sleeps for a period of
time much longer that the first task should ever take if
the bug weren't there.
b) raise an exception if the sleeping thread returns before
the other one.
Any tips or comments welcomed,
How does one detect an infinite loop bug with testunit?
We are writing code test-first and we have found a test which causes
an (erroneous) infinite loop, but we do not know how to write an
*automated* test to expose it -- i.e., we do not have the luxury
of using ctrl-c when this piece of testing code gets inserted into
our build/test robot.
We have been considering the following hack:
a) spawn two threads, one calling the code with the infinite
loop bug and another that merely sleeps for a period of
time much longer that the first task should ever take if
the bug weren't there.
b) raise an exception if the sleeping thread returns before
the other one.
Any tips or comments welcomed,