ASUnit Gotcha – Empty TestSuite Bug
This afternoon I discovered an interesting little bug in the ASUnit library which causes the TestRunner never to finish its suite of unit tests. It is fairly straightforward to reproduce too: simply, add create a TestSuite that doesn’t contain any tests and add the suite to the runner.
Though I have created an artificial example to isolate the problem, it arose in a real-world situation. I had two package folders in which I intended to create tests. I created all the AllTest TestSuites but only populated one of the packages with tests. When I tried to run the TestRunner to see the results of these tests, though they appeared to have run the TestRunner had never completed.
The source of the problem lies in the architecture of the TestSuite class, the main functionality for which is launched by the run method but which dispatches an event to indicate that it has finished performing tests in its testCompleteHandler method. However, testCompleteHandler can only ever be triggered as a consequence of a test completing in run, so if no tests are defined, the TestSuite never finishes.
Update
I posted my resolution of this problem on github, but it has since been merged to the asunit trunk, so I have removed the github repository. My solution added checks for empty TestCases and TestSuites to prevent the TestRunner trying to run them.
-
http://twitter.com/alecmce alecmce
-
http://asunit.org/ Luke Bayes
-
http://asunit.org Luke Bayes
-
http://robertpenner.com/ Robert Penner
-
http://robertpenner.com Robert Penner
-
Anonymous
-
http://blog.vizio360.co.uk simone
-
http://alecmce.com Anonymous
-
http://alecmce.com alec
-
http://www.escortsmeet.com/ erotic services
-
http://www.adhost.dk/sogemaskineoptimering.shtml søgemaskineoptimering
-
http://www.eusuperpharmacy.com/ Kamagra next day delivery


