Running JUnit tests for plugins with Gradle

236 views
Skip to first unread message

Roland...@fiducia.de

unread,
Mar 1, 2013, 10:03:16 AM3/1/13
to jenkin...@googlegroups.com

Hi all,

I am developing a custom Jenkins (1.488) plugin and try to run some test cases via JUnit.
The test cases have parent class HudsonTestCase.

Unfortunately, I get the following when trying to run the tests via gradle:

java.lang.NoClassDefFoundError: hudson/tasks/Ant$AntInstallation
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Class.java:2427)
at java.lang.Class.getDeclaredMethods(Class.java:1791)
at junit.framework.TestSuite.addTestsFromTestCase(TestSuite.java:149)
at junit.framework.TestSuite.<init>(TestSuite.java:129)
at org.junit.internal.runners.JUnit38ClassRunner.<init>(JUnit38ClassRunner.java:71)
at org.junit.internal.builders.JUnit3Builder.runnerForClass(JUnit3Builder.java:14)
at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:57)
at org.junit.internal.builders.AllDefaultPossibilitiesBuilder.runnerForClass(AllDefaultPossibilitiesBuilder.java:29)
...


I found the missing class in the Jenkins ANT plugin. But when I add it as dependency then I get an InvocationTargetException:

org.jvnet.hudson.reactor.ReactorException: java.lang.Error: java.lang.reflect.InvocationTargetException
at org.jvnet.hudson.reactor.Reactor.execute(Reactor.java:246)
at jenkins.InitReactorRunner.run(InitReactorRunner.java:43)
at jenkins.model.Jenkins.executeReactor(Jenkins.java:894)
at jenkins.model.Jenkins.<init>(Jenkins.java:796)
at hudson.model.Hudson.<init>(Hudson.java:81)

...

So maybe I need to add an additional plugin dependency? Anybody who is successfully running such test cases with Gradle and can post his dependencies?
Btw., Maven has no problems running the tests.

Thanks in advance for your help.


Best regards

Roland





----------------------------------------------------------------------------------------------------------------------------------------------

Fiducia IT AG
Fiduciastraße 20
76227 Karlsruhe

Sitz der Gesellschaft: Karlsruhe
AG Mannheim HRB 100059

Vorsitzender des Aufsichtsrats: Gregor Scheller
Vorsitzender des Vorstands: Klaus-Peter Bruns
Vorstand: Jens-Olaf Bartels, Wolfgang Eckert, Carsten Pfläging, Hans-Peter Straberger

Umsatzsteuer-ID.Nr. DE143582320, http://www.fiducia.de
----------------------------------------------------------------------------------------------------------------------------------------------

Roland...@fiducia.de

unread,
Mar 5, 2013, 10:07:13 AM3/5/13
to jenkin...@googlegroups.com

Hi all,

anybody who has a running Gradle build with HudsonTestCase?


Best regards

Roland



Inaktiv: Details verbergen für Roland.Gruber---01.03.2013 16:07:22---Hi all, I am developing a custom Jenkins (1.488) plugin anRoland.Gruber---01.03.2013 16:07:22---Hi all, I am developing a custom Jenkins (1.488) plugin and try to run some test

--
You received this message because you are subscribed to the Google Groups "Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-de...@googlegroups.com.
For more options, visit
https://groups.google.com/groups/opt_out.

Reply all
Reply to author
Forward
0 new messages