Closed cchabanois closed 11 years ago
Yeah, these are internal and are not propagated to listeners. The problem is that these events lack the forked VM identifier so you wouldn't know which VM a test is running on, for example (and in case of multiple duplicated test suites this could be a problem).
Can you share some light what is your overall scenario? Maybe there is a workaround that doesn't involve fine-grained events that I could suggest?
To know progress I need to know the test hierarchy (suites and tests) and then for each test : when it starts, when it ends or fails. Each test must have an identifier
You didn't explain what you are up to, you just said what you need. JUnit tests don't have unique identifiers. Check out the Description class -- this is the only thing available about a test. It's got nothing to do with this runner, actually, it's just by-design.
I want to do what is done in eclipse when you run a junit test suite : display the progress as tests are run. I managed to do that with a junit4 RunListener. I associate each Description with an unique id. I know this is a problem if test is present more than once in the test suite but it's ok for now (there is the same problem in eclipse anyway : try a suite using the same test several times). But the standard junit ant task cannot take a RunListener as parameter (and ant's JUnitResultFormatter is limited). That's why I tried junit4 ant task but it cannot use a RunListener and aggregated events will not do the job.
You should have started from that. We can't really count individual tests because the task doesn't know how many there will be (this information is only available on the forked JVM, after a suite has been initialized which is done lazily and has to stay this way) but we can determine how many suites have already been executed and how many are still left. So you could have a crude progress over entire suites but not over individual tests.
I wanted to create a custom listener, not for reporting but to send test progress to another process. But I can't subscribe to events like TestStartedEvent ...