I have some CucumberJVM tests that run fine in Gradle 1.3. When I run them with Gradle 1.4, I see this type of output:
16:13:40.171 [DEBUG] [org.gradle.launcher.daemon.client.DaemonClientConnection] thread 1: received class org.gradle.logging.internal.LogEvent
16:13:40.154 [ERROR] [org.gradle.messaging.actor.internal.DefaultActorFactory$NonBlockingActor] Failed to notify test output listener.
org.gradle.listener.ListenerNotificationException: Failed to notify test output listener.
at org.gradle.listener.BroadcastDispatch.dispatch(BroadcastDispatch.java:90)
at org.gradle.listener.BroadcastDispatch.dispatch(BroadcastDispatch.java:30)
at org.gradle.messaging.dispatch.ProxyDispatchAdapter$DispatchingInvocationHandler.invoke(ProxyDispatchAdapter.java:93)
at $Proxy33.onOutput(Unknown Source)
at org.gradle.api.internal.tasks.testing.results.TestListenerAdapter.output(TestListenerAdapter.java:54)
at org.gradle.api.internal.tasks.testing.results.StateTrackingTestResultProcessor.output(StateTrackingTestResultProcessor.java:79)
at org.gradle.api.internal.tasks.testing.results.AttachParentTestResultProcessor.output(AttachParentTestResultProcessor.java:45)
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:35)
at org.gradle.messaging.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:24)
at org.gradle.messaging.dispatch.FailureHandlingDispatch.dispatch(FailureHandlingDispatch.java:29)
at org.gradle.messaging.dispatch.AsyncDispatch.dispatchMessages(AsyncDispatch.java:132)
at org.gradle.messaging.dispatch.AsyncDispatch.access$000(AsyncDispatch.java:33)
at org.gradle.messaging.dispatch.AsyncDispatch$1.run(AsyncDispatch.java:72)
at org.gradle.internal.concurrent.DefaultExecutorFactory$StoppableExecutorImpl$1.run(DefaultExecutorFactory.java:66)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:680)
Caused by: java.lang.NullPointerException
at com.google.common.base.Preconditions.checkNotNull(Preconditions.java:187)
at com.google.common.base.Joiner.toString(Joiner.java:532)
at com.google.common.base.Joiner.appendTo(Joiner.java:124)
at com.google.common.base.Joiner.appendTo(Joiner.java:181)
at com.google.common.base.Joiner.join(Joiner.java:237)
at com.google.common.base.Joiner.join(Joiner.java:226)
at org.gradle.api.internal.tasks.testing.logging.AbstractTestLogger.getEventPath(AbstractTestLogger.java:83)
at org.gradle.api.internal.tasks.testing.logging.AbstractTestLogger.logEvent(AbstractTestLogger.java:54)
at org.gradle.api.internal.tasks.testing.logging.TestEventLogger.onOutput(TestEventLogger.java:61)
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:35)
at org.gradle.messaging.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:24)
at org.gradle.listener.BroadcastDispatch.dispatch(BroadcastDispatch.java:81)
... 20 more
both cuke tags in helloworld.feature run, where only the @hello tag should. The codebase from which I rather hastily ripped this actually does select the right tag to run, but somewhere in the ripping I broke it. It’s probably a oneline fix somewhere in some app config, but it does not preclude the NPE that is the original subject of this thread from appearing when run under Gradle 1.4.
For whatever happy reason, I have not had to resort to this technique. To simplify, I just have @RunWith(Cucumber.class) annotating a test class in the canonical Cucumber+Java way, and JUnit seems to do fine handling the actual scenario execution.
So why does my set of Cucumber scenarios continue to run fine, while dkowis above had to resort to a custom task?
I vaguely remember someone talking about some changes either related to cucumber or testing. We’ve done also various refactorings in the test execution. I’m afraid I cannot link you to a commit that fixed the problem
I’m getting a similar problem running JBehave stories when migrating from 1.3 to 1.6. The tests appear to all pass … the problem is generating the test report. The version of JBehave is 3.6.9.
Caused by: org.gradle.api.GradleException: Could not write XML test results for Scenario: Import new and existing students specifying max grade limit to file C:\dev\java\workspace\sm\testIntegration\build\test-results\TEST-Scenario: Import new and existing students specifying max grade limit.xml.
at org.gradle.api.internal.tasks.testing.junit.result.Binary2JUnitXmlReportGenerator$1.execute(Binary2JUnitXmlReportGenerator.java:57)
at org.gradle.api.internal.tasks.testing.junit.result.Binary2JUnitXmlReportGenerator$1.execute(Binary2JUnitXmlReportGenerator.java:48)
…
Caused by: java.lang.NullPointerException
at org.gradle.api.internal.xml.SimpleMarkupWriter.writeXmlAttributeEncoded(SimpleMarkupWriter.java:372)
at org.gradle.api.internal.xml.SimpleMarkupWriter.attribute(SimpleMarkupWriter.java:241)
That would work, but it would still be nice to have the reports.
As I do more research on this, I think it has something to do with the runner I’m using. When I use the default JBehave runner (AnnotatedEmbedderRunner) it works fine. When I use a 3rd party runner (JUnitReportingRunner) it fails.
I suspect it’s similar to the problem this commit was meant to fix in Cucumber … something is wrong with the way Gradle 1.4 expects the runners to generate descriptions for the test method names. I haven’t figured it all out yet, but I’ll keep looking at it.