Maven Surefire
  1. Maven Surefire
  2. SUREFIRE-157

Surefire Plugin fails to handle exception thrown from TestNG @BeforeTest method

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Cannot Reproduce
    • Affects Version/s: 2.0 (2.2 plugin), 2.3
    • Fix Version/s: None
    • Component/s: TestNG support
    • Labels:
      None
    • Environment:
      Windows XP, JDK 1.5, Maven 2.0.4, TestNG 5.1

      Description

      Create a TestNG test with a method as follows:

      @BeforeTest
      public void beforeTest() {
      throw new RuntimeException("Simulate an exception from a beforeTest method");
      }

      When surefire attempts to run this test, the plugin fails with the following stack trace:

      org.apache.maven.surefire.booter.SurefireExecutionException: null; nested exception is java.lang.NullPointerException: n
      ull
      java.lang.NullPointerException
      at org.apache.maven.surefire.report.AbstractTextReporter.testFailed(AbstractTextReporter.java:106)
      at org.apache.maven.surefire.report.ReporterManager.testFailed(ReporterManager.java:299)
      at org.apache.maven.surefire.report.ReporterManager.testFailed(ReporterManager.java:281)
      at org.apache.maven.surefire.testng.TestNGReporter.onTestFailure(TestNGReporter.java:97)
      at org.testng.internal.Invoker.runTestListeners(Invoker.java:1164)
      at org.testng.internal.Invoker.runTestListeners(Invoker.java:1149)
      at org.testng.internal.Invoker.handleConfigurationFailure(Invoker.java:191)
      at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:170)
      at org.testng.SuiteRunner.privateRun(SuiteRunner.java:236)
      at org.testng.SuiteRunner.run(SuiteRunner.java:145)
      at org.testng.TestNG.createAndRunSuiteRunners(TestNG.java:901)
      at org.testng.TestNG.runSuitesLocally(TestNG.java:863)
      at org.apache.maven.surefire.testng.TestNGExecutor.executeTestNG(TestNGExecutor.java:64)
      at org.apache.maven.surefire.testng.TestNGXmlTestSuite.execute(TestNGXmlTestSuite.java:75)
      at org.apache.maven.surefire.Surefire.run(Surefire.java:129)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
      at java.lang.reflect.Method.invoke(Unknown Source)
      at org.apache.maven.surefire.booter.SurefireBooter.runSuitesInProcess(SurefireBooter.java:225)
      at org.apache.maven.surefire.booter.SurefireBooter.main(SurefireBooter.java:747)

        Activity

        mash created issue -
        Brett Porter made changes -
        Field Original Value New Value
        Affects Version/s 2.3 [ 12619 ]
        Component/s TestNG support [ 12350 ]
        Key MSUREFIRE-165 SUREFIRE-157
        Affects Version/s 2.0 (2.2 plugin) [ 12207 ]
        Project Maven 2.x Surefire Plugin [ 11148 ] Maven Surefire [ 10541 ]
        Brett Porter made changes -
        Affects Version/s 2.0 (2.2 plugin) [ 12440 ]
        Component/s TestNG support [ 12346 ]
        Affects Version/s 2.3 [ 12620 ]
        Brett Porter made changes -
        Fix Version/s 2.3 [ 12620 ]
        Brett Porter made changes -
        Fix Version/s 2.4 [ 13243 ]
        Fix Version/s 2.3 [ 12620 ]
        Dan Fabulich made changes -
        Resolution Cannot Reproduce [ 5 ]
        Status Open [ 1 ] Closed [ 6 ]
        Michael Osipov made changes -
        Fix Version/s 2.4 [ 13243 ]
        Mark Thomas made changes -
        Project Import Sun Apr 05 13:23:32 UTC 2015 [ 1428240212200 ]
        Mark Thomas made changes -
        Workflow jira [ 12727497 ] Default workflow, editable Closed status [ 12758726 ]
        Mark Thomas made changes -
        Project Import Mon Apr 06 01:36:33 UTC 2015 [ 1428284193036 ]
        Mark Thomas made changes -
        Workflow jira [ 12965627 ] Default workflow, editable Closed status [ 13003328 ]

          People

          • Assignee:
            Unassigned
            Reporter:
            mash
          • Votes:
            4 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development