maven-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Kaspar Fischer (JIRA)" <j...@codehaus.org>
Subject [jira] Commented: (SUREFIRE-157) Surefire Plugin fails to handle exception thrown from TestNG @BeforeTest method
Date Wed, 04 Nov 2009 17:10:55 GMT

    [ http://jira.codehaus.org/browse/SUREFIRE-157?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=197209#action_197209
] 

Kaspar Fischer commented on SUREFIRE-157:
-----------------------------------------

I am experiencing the same problem:

org.apache.maven.surefire.booter.SurefireExecutionException: null; nested exception is java.lang.NullPointerException:
null
java.lang.NullPointerException
	at org.apache.maven.surefire.report.AbstractTextReporter.testFailed(AbstractTextReporter.java:111)
	at org.apache.maven.surefire.report.ReporterManager.testFailed(ReporterManager.java:335)
	at org.apache.maven.surefire.report.ReporterManager.testFailed(ReporterManager.java:317)
	at org.apache.maven.surefire.testng.TestNGReporter.onTestFailure(TestNGReporter.java:102)
	at org.testng.internal.Invoker.runTestListeners(Invoker.java:1433)
	at org.testng.internal.Invoker.runTestListeners(Invoker.java:1417)
	at org.testng.internal.Invoker.handleInvocationResults(Invoker.java:1152)
	at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:887)
	at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:125)
	at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:109)
	at org.testng.TestRunner.runWorkers(TestRunner.java:689)
	at org.testng.TestRunner.privateRun(TestRunner.java:566)
	at org.testng.TestRunner.run(TestRunner.java:466)
	at org.testng.SuiteRunner.runTest(SuiteRunner.java:301)
	at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:296)
	at org.testng.SuiteRunner.privateRun(SuiteRunner.java:276)
	at org.testng.SuiteRunner.run(SuiteRunner.java:191)
	at org.testng.TestNG.createAndRunSuiteRunners(TestNG.java:808)
	at org.testng.TestNG.runSuitesLocally(TestNG.java:776)
	at org.testng.TestNG.run(TestNG.java:701)
	at org.apache.maven.surefire.testng.TestNGExecutor.run(TestNGExecutor.java:64)
	at org.apache.maven.surefire.testng.TestNGDirectoryTestSuite.execute(TestNGDirectoryTestSuite.java:99)
	at org.apache.maven.surefire.Surefire.run(Surefire.java:107)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:597)
	at org.apache.maven.surefire.booter.SurefireBooter.runSuitesInProcess(SurefireBooter.java:285)
	at org.apache.maven.surefire.booter.SurefireBooter.main(SurefireBooter.java:976)

According to "mvn -o help:effective-pom" I am using

    <pluginManagement>
          <plugin>
            <artifactId>maven-surefire-plugin</artifactId>
            <version>2.4.2</version>
          </plugin>
    </pluginManagement>
    <plugins>
      <plugin>
        <artifactId>maven-surefire-plugin</artifactId>
        <version>2.4.3</version>
        <configuration>
          <forkMode>always</forkMode>
          <excludeGroups>extended</excludeGroups>
          <argLine>-javaagent:${settings.localRepository}/salve/salve-agent/2.0-beta1/salve-agent-2.0-beta1.jar</argLine>
          <useSystemClassloader>true</useSystemClassloader>
        </configuration>
      </plugin>
    </plugins>

and

        <dependency>
          <groupId>org.testng</groupId>
          <artifactId>testng</artifactId>
          <version>5.7</version>
          <classifier>jdk15</classifier>
        </dependency>

I had a look at the source, line 111 on http://svn.apache.org/viewvc/maven/surefire/tags/surefire-2.4.3/surefire-api/src/main/java/org/apache/maven/surefire/report/AbstractTextReporter.java?view=markup
...

I also found

  http://maven.apache.org/plugins/maven-surefire-plugin/examples/class-loading.html

and changed the above configuration to

  <useSystemClassloader>false</useSystemClassloader>

This didn't solved the issue for me.

Any ideas?

> Surefire Plugin fails to handle exception thrown from TestNG @BeforeTest method
> -------------------------------------------------------------------------------
>
>                 Key: SUREFIRE-157
>                 URL: http://jira.codehaus.org/browse/SUREFIRE-157
>             Project: Maven Surefire
>          Issue Type: Bug
>          Components: TestNG support
>    Affects Versions: 2.0 (2.2 plugin), 2.3
>         Environment: Windows XP, JDK 1.5, Maven 2.0.4, TestNG 5.1
>            Reporter: Manish Shah
>             Fix For: 2.4
>
>
> 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)

-- 
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

        

Mime
View raw message