I added it as a new @TestExtension in my test class. Not sure if its the
most beautiful solution, but at least its not my ugliest hack ;)
In this case I have no jelly files to worry about, but its just a matter of
moving them to the correct namespace I guess.

And in some ways it makes more sense to have the jelly files in separate
test extensions as you then separate them from any @LocalData files.

https://github.com/jenkinsci/gerrit-trigger-plugin/commit/bed6fa9907692f123e341a55281a172ffb8c03e5

/B


On Mon, Jan 5, 2015 at 1:59 PM, René Scheibe <[email protected]> wrote:

> Hi,
>
> can anybody give me some advice how to write tests that reference a Jelly
> file and implement actions in the test class?
> (With *HudsonTestCase* this works fine but with *JenkinsRule* I have no
> idea.)
>
> Example:
> *test/src/test/java/lib/form/NameRefTest.java*
>
> It references *test/src/test/resources/lib/form/NameRefTest/test1.jelly*
> and also implements *doSubmitTest1*().
>
> Just converting it to use *JenkinsRule* instead of *HudsonTestCase*
> results in a HTTP 404 error.
>
> I could not really find out how the Jelly files and actions of a test
> class are registered for a test Jenkins. I have seen that JenkinsRule and
> HudsonTestCase implement RootAction and add itself to Jenkin's actions. But
> in case of JenkinsRule this does not work as the test class itself does not
> inherit from JenkinsRule.
>
> If I implement *RootAction* in the test itself and add it to Jenkin's
> actions in a *@Before* method I can get it to work. But something else
> than *self* has to be used for *getUrlName()* because the *JenkinsRule*
> registers itself already under *self*.
>
> I think *JenkinsRule* has to be altered in a way that such tests don't
> have to implement *RootAction* and add it to Jenkin's actions.
>
> What's your suggestion?
>
> Cheers
> René
>
> --
> 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 [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/jenkinsci-dev/3cd3cdc7-9fee-4854-9b75-8201001a24cb%40googlegroups.com
> <https://groups.google.com/d/msgid/jenkinsci-dev/3cd3cdc7-9fee-4854-9b75-8201001a24cb%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>



-- 
Robert Sandell
*Software Engineer*
*CloudBees Inc.*

-- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-dev/CALzHZS2cKUi2%2BkKN8dWwzBH04OGdmyO3TqnBWuLSYkNmK_EZBw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to