TestNG runner in 1.7-rc-1 has an undocumented runtime dependency on JCommander

When trying to run some TestNG unit tests in 1.7-rc-1, it told me that the tests had failed, but the test report showed that 0 tests had been run. Upon further examination, I saw this in the debug log -

14:16:49.570 [DEBUG] [TestEventLogger]

org.gradle.api.internal.tasks.testing.TestSuiteExecutionException: Could not complete execution for test process ‘Gradle Worker 1’. 14:16:49.578 [INFO] [org.gradle.process.internal.DefaultExecHandle] Process ‘Gradle Worker 1’ finished with exit value 0 (state: SUCCEEDED) 14:16:49.585 [DEBUG] [TestEventLogger]

at org.gradle.api.internal.tasks.testing.SuiteTestClassProcessor.stop(SuiteTestClassProcessor.java:60) 14:16:49.599 [DEBUG] [TestEventLogger]

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 14:16:49.605 [DEBUG] [TestEventLogger]

at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) 14:16:49.612 [DEBUG] [TestEventLogger]

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) 14:16:49.618 [DEBUG] [TestEventLogger]

at java.lang.reflect.Method.invoke(Method.java:601) 14:16:49.624 [DEBUG] [TestEventLogger]

at org.gradle.messaging.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:35) 14:16:49.630 [DEBUG] [TestEventLogger]

at org.gradle.messaging.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:24) 14:16:49.637 [DEBUG] [TestEventLogger]

at org.gradle.messaging.dispatch.ContextClassLoaderDispatch.dispatch(ContextClassLoaderDispatch.java:32) 14:16:49.642 [DEBUG] [TestEventLogger]

at org.gradle.messaging.dispatch.ProxyDispatchAdapter$DispatchingInvocationHandler.invoke(ProxyDispatchAdapter.java:93) 14:16:49.649 [DEBUG] [TestEventLogger]

at com.sun.proxy.$Proxy2.stop(Unknown Source) 14:16:49.654 [DEBUG] [TestEventLogger]

at org.gradle.api.internal.tasks.testing.worker.TestWorker.stop(TestWorker.java:113) 14:16:49.660 [DEBUG] [TestEventLogger]

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 14:16:49.667 [DEBUG] [TestEventLogger]

at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) 14:16:49.673 [DEBUG] [TestEventLogger]

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) 14:16:49.680 [DEBUG] [TestEventLogger]

at java.lang.reflect.Method.invoke(Method.java:601) 14:16:49.686 [DEBUG] [TestEventLogger]

at org.gradle.messaging.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:35) 14:16:49.691 [DEBUG] [TestEventLogger]

at org.gradle.messaging.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:24) 14:16:49.698 [DEBUG] [TestEventLogger]

at org.gradle.messaging.remote.internal.hub.MessageHub$Handler.run(MessageHub.java:355) 14:16:49.704 [DEBUG] [TestEventLogger]

at org.gradle.internal.concurrent.DefaultExecutorFactory$StoppableExecutorImpl$1.run(DefaultExecutorFactory.java:66) 14:16:49.712 [DEBUG] [TestEventLogger]

at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) 14:16:49.719 [DEBUG] [TestEventLogger]

at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) 14:16:49.724 [DEBUG] [TestEventLogger]

at java.lang.Thread.run(Thread.java:722) 14:16:49.731 [DEBUG] [TestEventLogger] 14:16:49.737 [DEBUG] [TestEventLogger]

Caused by: 14:16:49.744 [DEBUG] [TestEventLogger]

java.lang.NoClassDefFoundError: com/beust/jcommander/ParameterException 14:16:49.752 [DEBUG] [TestEventLogger]

at org.gradle.api.internal.tasks.testing.testng.TestNGTestClassProcessor.stop(TestNGTestClassProcessor.java:72) 14:16:49.760 [DEBUG] [TestEventLogger]

at org.gradle.api.internal.tasks.testing.SuiteTestClassProcessor.stop(SuiteTestClassProcessor.java:58) 14:16:49.768 [DEBUG] [TestEventLogger]

… 21 more 14:16:49.774 [DEBUG] [TestEventLogger] 14:16:49.781 [DEBUG] [TestEventLogger]

Caused by: 14:16:49.788 [DEBUG] [TestEventLogger]

java.lang.ClassNotFoundException: com.beust.jcommander.ParameterException 14:16:49.794 [DEBUG] [TestEventLogger]

at java.net.URLClassLoader$1.run(URLClassLoader.java:366) 14:16:49.800 [DEBUG] [TestEventLogger]

at java.net.URLClassLoader$1.run(URLClassLoader.java:355) 14:16:49.807 [DEBUG] [TestEventLogger]

at java.security.AccessController.doPrivileged(Native Method) 14:16:49.813 [DEBUG] [TestEventLogger]

at java.net.URLClassLoader.findClass(URLClassLoader.java:354) 14:16:49.819 [DEBUG] [TestEventLogger]

at java.lang.ClassLoader.loadClass(ClassLoader.java:423) 14:16:49.825 [DEBUG] [TestEventLogger]

at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308) 14:16:49.832 [DEBUG] [TestEventLogger]

at java.lang.ClassLoader.loadClass(ClassLoader.java:356) 14:16:49.840 [DEBUG] [TestEventLogger]

… 23 more 14:16:49.849 [DEBUG] [TestEventLogger] 14:16:49.858 [DEBUG] [TestEventLogger] Test Run FAILED

If I add JCommander to the testRuntime configuration, it works fine.

Is this a change in behaviour from 1.6?

Now I can’t reproduce the problem on 1.6 or 1.7-rc1. I was also trying to get Artifactory up and running about the same time, so that might have been a factor there.

Just close/ignore for now. I’ll re-post if I see the issue come up again.