How do I get the test harness to include the plugin I'm developing?

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

How do I get the test harness to include the plugin I'm developing?

andrew.sumner

I'm trying to write a unit test that will exercise the UI for my plugin and to do that I need to configure it's global properties.

 

I can get to the global configuration page but when I look in the config form for my plugin settings it's not there.  The wiki only touches this area very lightly so it's not been much help.

 

My code is in: 
https://github.com/andrew-sumner/inedo-proget-plugin/blob/master/src/test/java/com/inedo/proget/jenkins/DownloadPluginTests.java

 

    @Rule
    public JenkinsRule j = new JenkinsRule()
    
    @Test
    public void perform() {
        HtmlPage globalConfigPage = j.createWebClient().webClient.goTo("configure");
    
        HtmlForm form = globalConfigPage.getFormByName("config");

 

        // My plugins global properties are not found
        HtmlInput password = form.getInputByName("_.password");

 

        ....

    }


I've tried:


  • @WithPlugin("DownloadPackageBuilder.hpi") 

This issue: https://issues.jenkins-ci.org/browse/JENKINS-29181 suggests that I should be able to do this with @WithPlugin("DownloadPackageBuilder.hpi") if I can get the plugin into the plugins folder but doesn't have any ideas on how this might be achieved.


  • j.recipeLoadCurrentPlugin();

This looked promising but didn't work - possibly because I am using the Gradle JPI plugin: https://wiki.jenkins-ci.org/display/JENKINS/Gradle+JPI+Plugin


Any idea on what I might be missing?

--
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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-dev/BAY169-W63D188A0AAAA14A9F0AD10BC9D0%40phx.gbl.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: How do I get the test harness to include the plugin I'm developing?

Ulli Hafner
This looks more like a UI test rather than a unit test. Wouldn’t it be simpler to create a new test in https://github.com/jenkinsci/acceptance-test-harness
 

Am 04.04.2016 um 12:55 schrieb Andrew Sumner <[hidden email]>:

I'm trying to write a unit test that will exercise the UI for my plugin and to do that I need to configure it's global properties.

 

I can get to the global configuration page but when I look in the config form for my plugin settings it's not there.  The wiki only touches this area very lightly so it's not been much help.

 

 

    @Rule
    public JenkinsRule j = new JenkinsRule()
    
    @Test
    public void perform() {
        HtmlPage globalConfigPage = j.createWebClient().webClient.goTo("configure");
    
        HtmlForm form = globalConfigPage.getFormByName("config");

 

        // My plugins global properties are not found
        HtmlInput password = form.getInputByName("_.password");

 

        ....
    }

I've tried:

  • @WithPlugin("DownloadPackageBuilder.hpi") 

This issue: https://issues.jenkins-ci.org/browse/JENKINS-29181 suggests that I should be able to do this with @WithPlugin("DownloadPackageBuilder.hpi") if I can get the plugin into the plugins folder but doesn't have any ideas on how this might be achieved.

  • j.recipeLoadCurrentPlugin();

This looked promising but didn't work - possibly because I am using the Gradle JPI plugin: https://wiki.jenkins-ci.org/display/JENKINS/Gradle+JPI+Plugin

Any idea on what I might be missing?

-- 
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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-dev/BAY169-W63D188A0AAAA14A9F0AD10BC9D0%40phx.gbl.
For more options, visit https://groups.google.com/d/optout.

--
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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-dev/BB0EECFC-8681-4EB0-BAD6-DDF503FAFA3F%40gmail.com.
For more options, visit https://groups.google.com/d/optout.

signature.asc (506 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: How do I get the test harness to include the plugin I'm developing?

martinda
In reply to this post by andrew.sumner
 I have the same question: How do I read the jenkins global configuration values introduced by my custom plugin (or other global config values in general), in a plugin unit test.

On Monday, April 4, 2016 at 6:56:01 AM UTC-4, Andrew Sumner wrote:

I'm trying to write a unit test that will exercise the UI for my plugin and to do that I need to configure it's global properties.

 

I can get to the global configuration page but when I look in the config form for my plugin settings it's not there.  The wiki only touches this area very lightly so it's not been much help.

--
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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-dev/6d05c183-b354-4a14-b6b4-d3f495cab20e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: How do I get the test harness to include the plugin I'm developing?

Jesse Glick-4
On Mon, Feb 4, 2019 at 7:46 AM martinda <[hidden email]> wrote:
> How do I read the jenkins global configuration values introduced by my custom plugin (or other global config values in general), in a plugin unit test.

https://github.com/jenkinsci/archetypes/blob/677f8cf5b62184926a1994d76fcfb708351b70ab/global-configuration/src/main/resources/archetype-resources/src/test/java/SampleConfigurationTest.java#L32

for example. Start by playing with the archetype until you understand
how it works, then apply similar patterns to your real code.

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