[ http://jira.codehaus.org/browse/SUREFIRE-629?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Aslak Knutsen updated SUREFIRE-629: ----------------------------------- Attachment: MavenSurefireJUnit47RunnerTestCase.java Updated test case to expose same issue in 2.6-SNAPSHOT. (only replaced the assumed faulty Class Name in the description text. Did not debug so it might be off.) Got build from http://repository.sonatype.org:8081/content/groups/sonatype-public-grid/ - 20100710.142028-8 (would be nice if you published sources for SNAPSHOTS as well) > NullPointerException in DemultiplexingRunListener, falsely report of "No > tests were executed!" > ---------------------------------------------------------------------------------------------- > > Key: SUREFIRE-629 > URL: http://jira.codehaus.org/browse/SUREFIRE-629 > Project: Maven Surefire > Issue Type: Bug > Components: Junit 4.x support > Affects Versions: 2.5 > Environment: Maven Surefire 2.5 > Surefire JUnit 4.7 > Reporter: Aslak Knutsen > Priority: Critical > Attachments: MavenSurefireJUnit47RunnerTestCase.java, > MavenSurefireJUnit47RunnerTestCase.java > > > Assumption: > The DemultiplexingRunListener assumes a Test will be Started before it Fails > or Finishes. > Reality: > JUnits ParentRunner is responsible for adding the BeforeClass/AfterClass > statements to the statement execution chain. After BeforeClass is executed, a > Statement that delegates to the abstract method: runChild(T child, > RunNotifier notifier) is called. As the JavaDoc explains: "Subclasses are > responsible for making sure that relevant test events are reported through > {...@code notifier}". When a @BeforeClass fail, the child that should handle > the relevant test events(Started, Failed, Finished) is never executed. > Result: > When Test Failed event is received in DemultiplexingRunListener without a > Started event received first, it causes a NullPointException because there is > no ClassReporter setup for that class yet. When this Exception is thrown from > the DemultiplexingRunListene, JUnit catches the exception and reports is as a > Failed test. But to avoid a wild loop, it removes the failing Listener before > calling Failed test again. Since the DemultiplexingRunListener now is removed > from the chain it will never receive the RunFinished event and the recorded > state will never be replayed on the ReportManager. > The End result: > ReporterManager falsely believe no Test were run. -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira