SUREFIRE-47 points out, correctly, that we're running the suite() method
twice: once to count the tests, and then again when the tests actually
run.
http://jira.codehaus.org/browse/SUREFIRE-47
This happens in JUnitTestSet; what's strange is that we don't do this in
TestNGTestSet. "getTestCount()" simply returns 1 in that case, with a
TODO "need to get this from TestNG somehow". This is filed as
SUREFIRE-94; it's minor, because "this isn't required for correct
operation of the tests, but may be if a reporter relies on the correct
number in the runStarting method (currently, it is unused)."
If so, why do we count the tests initially at all? I just tried ripping
out all implementations of getTestCount() and just adding 1 to totalTests
whenever we would have called it. It doesn't seem to have done any harm;
the only difference I can see is that in the case where you've got some
classes that look like tests, we do "execute" the test run, but when we
find no tests, the summary banner says:
Tests run: 0, Failures: 0, Errors: 0, Skipped: 0
... instead of:
No tests to run.
(It still says "No tests to run" when there are no JUnit classes at all.)
Therefore, I'm inclined to fix SUREFIRE-47 by ripping out getTestCount()
from the SurefireTestSet interface and removing its implementation from
JUnitTestSet, PojoTestSet and TestNGTestSet.
Does anyone object to this?
-Dan