Hi there,
I'd like to reinstall an old version of a particular plugin in my current
Unit Tests, then I can test the behaviour of my plugin with different
versions of some dependent plugins.
If I didn't explain myself correctly, this is how far I went:
*pom.xml*
...
<dependency>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>groovy</artifactId>
<version>2.0</version>
<scope>test</scope>
</dependency>
...
*Unit Test:*
// this is just using the WithPlugin annotation based on the groovy version 1.30
@WithPlugin("groovy.hpi")
@Test public void testJobWithSystemGroovy1() throws Exception {
FreeStyleProject project = j.createFreeStyleProject("SystemWithSandbox");
project.getBuildersList().add(new hudson.plugins.groovy.SystemGroovy(new
StringScriptSource("println 'hi'"),null,null));
assertTrue(checker.executeCheck(project));
}
// This is just using the pom dependencies: groovy plugin version 2.0
@Test public void testJobWithSystemGroovy2() throws Exception {
FreeStyleProject project = j.createFreeStyleProject("SystemWithSandbox");
project.getBuildersList().add(new hudson.plugins.groovy.SystemGroovy(new
StringScriptSource("println 'hi'"),null,null));
assertTrue(checker.executeCheck(project));
}
*Then the executeCheck method *
public boolean executeCheck(Item item) {
boolean found = false;
PluginWrapper plugin =
Jenkins.getInstance().pluginManager.getPlugin("groovy");
if (plugin==null) {
LOG.log(Level.FINE, "Plugin Groovy isn't installed");
} else {
if (plugin.getVersionNumber().isNewerThan(new
hudson.util.VersionNumber("1.30"))) {
....
}
Unfortunately, WithPlugin doesn't work as I expect since the JenkinsRule
takes the pom dependency rather than reinstalling the local one which it's
stored under: ./src/test/resources/plugins/groovy.hpi
Any ideas how I can have the same plugin but in different versions while
running the Unit Tests with the TestHarness framework?
Thanks
--
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/1e4a7d00-e82a-488e-a980-d9d1c1ba5d2b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.