sbabcoc / JUnit-Foundation

JUnit Foundation is a lightweight collection of JUnit watchers, interfaces, and static utility classes that supplement and augment the functionality provided by the JUnit API.
Apache License 2.0
22 stars 6 forks source link

NullPointerException after a failure in Before Class #53

Closed khaledAbbasExperitest closed 5 years ago

khaledAbbasExperitest commented 5 years ago

Scenario: Run a test with a Before class method expected to fail

Result: java.lang.NullPointerException at com.nordstrom.automation.junit.RunAnnouncer.setTestFailure(RunAnnouncer.java:136) at com.nordstrom.automation.junit.RunAnnouncer.testFailure(RunAnnouncer.java:64) at org.junit.runner.notification.SynchronizedRunListener.testFailure(SynchronizedRunListener.java:63) at org.junit.runner.notification.RunNotifier$4.notifyListener(RunNotifier.java:142) at org.junit.runner.notification.RunNotifier$SafeNotifier.run(RunNotifier.java:72) at org.junit.runner.notification.RunNotifier.fireTestFailures(RunNotifier.java:138) at org.junit.runner.notification.RunNotifier.fireTestFailure(RunNotifier.java:132) at org.junit.internal.runners.model.EachTestNotifier.addFailure(EachTestNotifier.java:23) at org.junit.runners.ParentRunner.run$original$3KEFEFXu(ParentRunner.java:369) at org.junit.runners.ParentRunner.run$original$3KEFEFXu$accessor$LACdlSbF(ParentRunner.java) at org.junit.runners.ParentRunner$auxiliary$YwrRWEJd.call(Unknown Source) at com.nordstrom.automation.junit.LifecycleHooks.callProxy(LifecycleHooks.java:338) at com.nordstrom.automation.junit.Run.intercept(Run.java:66) at org.junit.runners.ParentRunner.run(ParentRunner.java) at org.junit.runners.BlockJUnit4ClassRunner.run$accessor$MQdh69pA(BlockJUnit4ClassRunner.java) at org.junit.runners.BlockJUnit4ClassRunner$auxiliary$IptvJh1v.call(Unknown Source) at com.nordstrom.automation.junit.LifecycleHooks.callProxy(LifecycleHooks.java:338) at com.nordstrom.automation.junit.Run.intercept(Run.java:66) at org.junit.runners.BlockJUnit4ClassRunner.run(BlockJUnit4ClassRunner.java) at Utils.junit.Junit4CustomClassRunner.run$accessor$RRbPQNfc(Junit4CustomClassRunner.java) at Utils.junit.Junit4CustomClassRunner$auxiliary$F3wSCyuO.call(Unknown Source) at com.nordstrom.automation.junit.LifecycleHooks.callProxy(LifecycleHooks.java:338) at com.nordstrom.automation.junit.Run.intercept(Run.java:66) at Utils.junit.Junit4CustomClassRunner.run(Junit4CustomClassRunner.java) at Utils.junit.TestRunner.run$original$ocyOZSnB(TestRunner.java:63) at Utils.junit.TestRunner.run$original$ocyOZSnB$accessor$TphGJu42(TestRunner.java) at Utils.junit.TestRunner$auxiliary$535EKzJh.call(Unknown Source) at com.nordstrom.automation.junit.LifecycleHooks.callProxy(LifecycleHooks.java:338) at com.nordstrom.automation.junit.Run.intercept(Run.java:66) at Utils.junit.TestRunner.run(TestRunner.java) at org.junit.runner.JUnitCore.run(JUnitCore.java:137) at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:68) at com.intellij.rt.execution.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:47) at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:242) at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:70)

Please note that issue "Change tracking of "atomic" test to handle rule failures" handled a similar issue in exception thrown from a rule. The issue still reproduces in entire Suite failures, because the Map "RUNNER_TO_ATOMICTEST" is populated only from start of a test.

Can you please aid with a solution? Thanks!

sbabcoc commented 5 years ago

Thanks for reporting this issue. I'll see if I can implement a fix in the next day or two. The initial challenge is that class-level configuration methods aren't part of any atomic test.

sbabcoc commented 5 years ago

Sorry!

sbabcoc commented 5 years ago

This issue is resolved in release 11.0.1