My tests all passed, but Gradle says something failed

When I run “gradlew test”, it says, “There were failing tests…” But the report says all the tests passed.

If I run gradlew -i, it reports each gradle worker as successful, then again says there were failing tests.

If I run gradlew -d, I get overwhelmed by the output. :slight_smile: But buried in there are a few interesting bits:

21:23:02.239 [QUIET] [system.out] DEBUG] [org.gradle.messaging.remote.internal.Router] Received route unavailable. Message: [ConsumerUnavailable id: 3b7f8b00-19ba-46df-86c9-8f322999bff1]
21:23:02.242 [DEBUG] [TestEventLogger]
   org.gradle.api.internal.tasks.testing.TestSuiteExecutionException: Could not complete execution for test process 'Gradle Worker 1'.
21:23:02.243 [DEBUG] [TestEventLogger]
       at org.gradle.api.internal.tasks.testing.SuiteTestClassProcessor.stop(SuiteTestClassProcessor.java:60)
21:23:02.244 [DEBUG] [TestEventLogger]
       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
21:23:02.244 [DEBUG] [TestEventLogger]
       at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
21:23:02.244 [DEBUG] [TestEventLogger]
       at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
21:23:02.244 [DEBUG] [TestEventLogger]
       at java.lang.reflect.Method.invoke(Method.java:601)
21:23:02.245 [DEBUG] [TestEventLogger]
       at org.gradle.messaging.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:35)
21:23:02.246 [DEBUG] [TestEventLogger]
       at org.gradle.messaging.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:24)
21:23:02.246 [DEBUG] [TestEventLogger]
       at org.gradle.messaging.dispatch.ContextClassLoaderDispatch.dispatch(ContextClassLoaderDispatch.java:32)
21:23:02.246 [DEBUG] [TestEventLogger]
       at org.gradle.messaging.dispatch.ProxyDispatchAdapter$DispatchingInvocationHandler.invoke(ProxyDispatchAdapter.java:93)
21:23:02.247 [DEBUG] [TestEventLogger]
       at $Proxy2.stop(Unknown Source)
21:23:02.247 [DEBUG] [TestEventLogger]
       at org.gradle.api.internal.tasks.testing.worker.TestWorker.stop(TestWorker.java:113)
21:23:02.248 [DEBUG] [TestEventLogger]
       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
21:23:02.249 [DEBUG] [TestEventLogger]
       at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
21:23:02.249 [DEBUG] [TestEventLogger]
       at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
21:23:02.249 [DEBUG] [TestEventLogger]
       at java.lang.reflect.Method.invoke(Method.java:601)
21:23:02.250 [DEBUG] [TestEventLogger]
       at org.gradle.messaging.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:35)
21:23:02.250 [DEBUG] [TestEventLogger]
       at org.gradle.messaging.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:24)
21:23:02.250 [DEBUG] [TestEventLogger]
       at org.gradle.messaging.remote.internal.TypeCastDispatch.dispatch(TypeCastDispatch.java:30)
21:23:02.250 [DEBUG] [TestEventLogger]
       at org.gradle.messaging.remote.internal.WorkerProtocol.handleIncoming(WorkerProtocol.java:53)
21:23:02.250 [DEBUG] [TestEventLogger]
       at org.gradle.messaging.remote.internal.WorkerProtocol.handleIncoming(WorkerProtocol.java:31)
21:23:02.251 [DEBUG] [TestEventLogger]
       at org.gradle.messaging.remote.internal.ProtocolStack$ProtocolStage.handleIncoming(ProtocolStack.java:167)
21:23:02.251 [DEBUG] [TestEventLogger]
       at org.gradle.messaging.remote.internal.ProtocolStack$BottomStage.handleIncoming(ProtocolStack.java:277)
21:23:02.251 [DEBUG] [TestEventLogger]
       at org.gradle.messaging.remote.internal.ProtocolStack$BottomConnection$1.run(ProtocolStack.java:299)
21:23:02.251 [DEBUG] [TestEventLogger]
       at org.gradle.messaging.remote.internal.ProtocolStack$ExecuteRunnable.dispatch(ProtocolStack.java:120)
21:23:02.251 [DEBUG] [TestEventLogger]
       at org.gradle.messaging.remote.internal.ProtocolStack$ExecuteRunnable.dispatch(ProtocolStack.java:116)
21:23:02.252 [DEBUG] [TestEventLogger]
       at org.gradle.messaging.dispatch.AsyncDispatch.dispatchMessages(AsyncDispatch.java:132)
21:23:02.252 [DEBUG] [TestEventLogger]
       at org.gradle.messaging.dispatch.AsyncDispatch.access$000(AsyncDispatch.java:33)
21:23:02.252 [DEBUG] [TestEventLogger]
       at org.gradle.messaging.dispatch.AsyncDispatch$1.run(AsyncDispatch.java:72)
21:23:02.252 [DEBUG] [TestEventLogger]
       at org.gradle.internal.concurrent.DefaultExecutorFactory$StoppableExecutorImpl$1.run(DefaultExecutorFactory.java:66)
21:23:02.253 [DEBUG] [TestEventLogger]
       at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
21:23:02.253 [DEBUG] [TestEventLogger]
       at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
21:23:02.253 [DEBUG] [TestEventLogger]
       at java.lang.Thread.run(Thread.java:722)
21:23:02.253 [DEBUG] [TestEventLogger]
       Caused by:
21:23:02.254 [DEBUG] [TestEventLogger]
       org.testng.TestNGException:
 21:23:02.254 [DEBUG] [TestEventLogger]
       The factory method class com.sri.penrad.dataserver.Performance_Test.com.sri.penrad.dataserver.Performance_Test() threw an exception
21:23:02.254 [DEBUG] [TestEventLogger]
           at org.testng.internal.FactoryMethod.invoke(FactoryMethod.java:93)
21:23:02.254 [DEBUG] [TestEventLogger]
           at org.testng.internal.TestNGClassFinder.<init>(TestNGClassFinder.java:140)
21:23:02.254 [DEBUG] [TestEventLogger]
           at org.testng.TestRunner.initMethods(TestRunner.java:409)
21:23:02.254 [DEBUG] [TestEventLogger]
           at org.testng.TestRunner.init(TestRunner.java:235)
21:23:02.255 [DEBUG] [TestEventLogger]
           at org.testng.TestRunner.init(TestRunner.java:205)
21:23:02.255 [DEBUG] [TestEventLogger]
           at org.testng.TestRunner.<init>(TestRunner.java:153)
21:23:02.255 [DEBUG] [TestEventLogger]
           at org.testng.SuiteRunner$DefaultTestRunnerFactory.newTestRunner(SuiteRunner.java:522)
21:23:02.255 [DEBUG] [TestEventLogger]
           at org.testng.SuiteRunner.init(SuiteRunner.java:157)
21:23:02.256 [DEBUG] [TestEventLogger]
           at org.testng.SuiteRunner.<init>(SuiteRunner.java:111)
21:23:02.256 [DEBUG] [TestEventLogger]
           at org.testng.TestNG.createSuiteRunner(TestNG.java:1273)
21:23:02.256 [DEBUG] [TestEventLogger]
           at org.testng.TestNG.createSuiteRunners(TestNG.java:1260)
21:23:02.256 [DEBUG] [TestEventLogger]
           at org.testng.TestNG.runSuitesLocally(TestNG.java:1114)
21:23:02.256 [DEBUG] [TestEventLogger]
           at org.testng.TestNG.run(TestNG.java:1031)
21:23:02.257 [DEBUG] [TestEventLogger]
           at org.gradle.api.internal.tasks.testing.testng.TestNGTestClassProcessor.stop(TestNGTestClassProcessor.java:126)
21:23:02.257 [DEBUG] [TestEventLogger]
           at org.gradle.api.internal.tasks.testing.SuiteTestClassProcessor.stop(SuiteTestClassProcessor.java:58)
21:23:02.257 [DEBUG] [TestEventLogger]
           ... 31 more
21:23:02.257 [DEBUG] [TestEventLogger]
 21:23:02.258 [DEBUG] [TestEventLogger]
           Caused by:
21:23:02.258 [DEBUG] [TestEventLogger]
           java.lang.IllegalArgumentException: argument type mismatch
21:23:02.258 [DEBUG] [TestEventLogger]
               at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
21:23:02.258 [DEBUG] [TestEventLogger]
               at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
21:23:02.258 [DEBUG] [TestEventLogger]
               at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
21:23:02.259 [DEBUG] [TestEventLogger]
               at java.lang.reflect.Constructor.newInstance(Constructor.java:525)
21:23:02.259 [DEBUG] [TestEventLogger]
               at org.testng.internal.FactoryMethod.invoke(FactoryMethod.java:86)
21:23:02.259 [DEBUG] [TestEventLogger]
               ... 45 more

Clearly there’s stuff I need to fix on my side. But Gradle’s behavior is really misleading.

This is using Gradle 1.3, TestNG, forkEvery = 1, and testReport = true.

Clearly there is something wrong with the ‘Performance_Test’ constructor. Would be good to know if other environments (e.g. IDEs) deal better with this kind of error.

Yes, the underlying error is in my code. But it would be great if Gradle (or TestNG?) could tell me, “The call to the Performance_Test constructor threw an IllegalArgumentException.” Right now, Gradle says “something failed,” but the test report says everything passed.

Gradle can’t do better than TestNG here. So the question is if TestNG reports this properly. Hence my question how this gets reported in an environment other than Gradle.