Running a set of TestNG tests gradle stops further execution of tests, throws an exception[*], while it reports build as succesful in general, under the following conditions:
1. one test method throws a RuntimeException
2. An other method depends on it.
The minimal two test classes that shows this:
public class Test1 {
@Test
public void m1()
{
if ( true) throw new RuntimeException();
assert true;
}
@Test(dependsOnMethods = "m1")
public void m2()
{
assert true;
}
}
public class Test2 {
@Test
public void m1() { assert true; }
}
- run Test1 one to see the exception
- include Test2 in running to see it is not executed
- back out "dependsOnMethods" to see all tests are run
[*]:
15:15:52.587 [Dispatch org.gradle.api.internal.tasks.testing.results.AttachParentTestResultProcessor@1fce83e] INFO o.g.logging.ProgressLoggingBridge - 1 test completed, 1 failure
15:15:52.588 [Run Gradle Worker 1 Thread 4] INFO system.out - 15:15:52.588 [main] INFO o.g.a.i.t.testing.worker.TestWorker - Gradle Worker 1 finished executing tests.
15:15:52.589 [Run Gradle Worker 1 Thread 4] INFO system.out - 15:15:52.589 [main] DEBUG o.g.p.i.child.ActionExecutionWorker - Completed Gradle Worker 1.
15:15:52.625 [Run Gradle Worker 1 Thread 4] INFO system.out - 15:15:52.613 [main] DEBUG o.g.p.i.child.ActionExecutionWorker - Stopping client connection.
15:15:52.626 [Dispatch org.gradle.api.internal.tasks.testing.results.AttachParentTestResultProcessor@1fce83e] DEBUG org.gradle.api.tasks.testing.Test - Finished test 'Gradle test'
15:15:52.728 [Dispatch org.gradle.api.internal.tasks.testing.results.AttachParentTestResultProcessor@1fce83e] ERROR org.gradle.api.tasks.testing.Test - Execution for Test process 'Gradle Worker 1' FAILED
org.gradle.api.internal.tasks.testing.TestSuiteExecutionException: Could not complete execution for test process 'Gradle Worker 1'.
at org.gradle.api.internal.tasks.testing.SuiteTestClassProcessor.stop(SuiteTestClassProcessor.java:60)
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.gradle.messaging.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:32)
at org.gradle.messaging.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:23)
at org.gradle.messaging.dispatch.ContextClassLoaderDispatch.dispatch(ContextClassLoaderDispatch.java:32)
at org.gradle.messaging.dispatch.ProxyDispatchAdapter$DispatchingInvocationHandler.invoke(ProxyDispatchAdapter.java:75)
at $Proxy3.stop(Unknown Source)
at org.gradle.api.internal.tasks.testing.worker.TestWorker.stop(TestWorker.java:91)
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.gradle.messaging.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:32)
at org.gradle.messaging.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:23)
at org.gradle.messaging.remote.internal.MethodInvocationUnmarshallingDispatch.dispatch(MethodInvocationUnmarshallingDispatch.java:48)
at org.gradle.messaging.remote.internal.MethodInvocationUnmarshallingDispatch.dispatch(MethodInvocationUnmarshallingDispatch.java:25)
at org.gradle.messaging.dispatch.DiscardOnFailureDispatch.dispatch(DiscardOnFailureDispatch.java:31)
at org.gradle.messaging.dispatch.AsyncDispatch.dispatchMessages(AsyncDispatch.java:131)
at org.gradle.messaging.dispatch.AsyncDispatch.access$000(AsyncDispatch.java:35)
at org.gradle.messaging.dispatch.AsyncDispatch$1.run(AsyncDispatch.java:71)
at org.gradle.messaging.concurrent.DefaultExecutorFactory$StoppableExecutorImpl$1.run(DefaultExecutorFactory.java:63)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:885)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:907)
at java.lang.Thread.run(Thread.java:619)
Caused by: java.lang.NullPointerException: null
at org.gradle.api.internal.tasks.testing.junit.CaptureTestOutputTestResultProcessor.completed(CaptureTestOutputTestResultProcessor.java:53)
at org.gradle.api.internal.tasks.testing.testng.TestNGTestResultProcessorAdapter.onTestFinished(TestNGTestResultProcessorAdapter.java:104)
at org.gradle.api.internal.tasks.testing.testng.TestNGTestResultProcessorAdapter.onTestSkipped(TestNGTestResultProcessorAdapter.java:89)
at org.testng.internal.Invoker.runTestListeners(Invoker.java:1438)
at org.testng.internal.Invoker.runTestListeners(Invoker.java:1430)
at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:970)
at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:126)
at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:110)
at org.testng.TestRunner.runWorkers(TestRunner.java:712)
at org.testng.TestRunner.privateRun(TestRunner.java:582)
at org.testng.TestRunner.run(TestRunner.java:477)
at org.testng.SuiteRunner.runTest(SuiteRunner.java:324)
at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:319)
at org.testng.SuiteRunner.privateRun(SuiteRunner.java:292)
at org.testng.SuiteRunner.run(SuiteRunner.java:198)
at org.testng.TestNG.createAndRunSuiteRunners(TestNG.java:823)
at org.testng.TestNG.runSuitesLocally(TestNG.java:790)
at org.testng.TestNG.run(TestNG.java:708)
at org.gradle.api.internal.tasks.testing.testng.TestNGTestClassProcessor.stop(TestNGTestClassProcessor.java:95)
at org.gradle.api.internal.tasks.testing.SuiteTestClassProcessor.stop(SuiteTestClassProcessor.java:58)
... 26 common frames omitted
15:15:52.751 [Run Gradle Worker 1 Thread 2] DEBUG o.g.p.internal.DefaultExecHandle - Process finished for Gradle Worker 1.
15:15:52.786 [main] DEBUG org.gradle.api.tasks.testing.Test - Finished tests
15:15:52.788 [main] INFO o.g.logging.ProgressLoggingBridge - 1 test completed, 1 failure
15:15:52.827 [main] DEBUG o.g.a.i.tasks.SkipTaskExecuter - Finished executing task ':test'
15:15:52.827 [main] INFO o.g.logging.ProgressLoggingBridge -
15:15:52.827 [main] DEBUG o.g.e.DefaultTaskGraphExecuter - Timing: Executing the DAG took 14.372 secs
15:15:52.827 [main] INFO org.gradle.launcher.Main -
BUILD SUCCESSFUL
|