ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tom Ball <Tom.B...@Sun.COM>
Subject Re: TestListener for JUnit task
Date Thu, 14 Oct 2004 17:57:26 GMT
On Thu, 2004-10-14 at 05:12, Stefan Bodewig wrote:
> If there is a way to predict the number of tests before running them,
> we could extend JUnitTest to hold that information and your new
> formatter could capture it in startTestSuite.

junit.swingui.TestRunner uses junit.framework.Test.countTestCases() to
set the total test number.  TestSuite.countTestCases() iterates over its
list of tests (which might contain other suites), so a complete count
could be made available to startTestSuite().

There are two problems I found with a custom formatter approach:  first,
JUnitTestRunner buffers all formatter output until all tests are run, so
that the test counter does nothing for a long time and then goes
immediately to 100%.  Second, NetBeans supports any ant scripts, so we
don't want to modify their scripts to add our formatter attribute.  We
just want to listen to JUnit execution without disturbing anything.

Currently I'm working on having JUnitTestRunner print TestListener event
messages as text to stdout, which get logged and filtered out by
JUnitTask's output redirectors.  This approach is less intrusive than it
sounds, and so far appears to work for both in-process and forked
without any changes to either the task's output or any formatters (since
they see the same stream as before).  I also "fire" an initial
test-count event, which gets logged and filtered like the others.

I want to test this thoroughly before submitting an enhancement request
and suggested patch, of course.

Thanks for your help,
Tom


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org


Mime
View raw message