JenkinsRule を使用して Jenkins プラグインを単体テストしようとしています
すべてのテストは、この種のアプローチを示唆しています
package hudson.plugins.xxxx;
import hudson.model.FreeStyleBuild;
import hudson.model.FreeStyleProject;
import hudson.tasks.Shell;
import org.junit.*;
import org.jvnet.hudson.test.JenkinsRule;
public class Apptest{
@Rule public JenkinsRule jenkinsRule = new JenkinsRule();
@Test public void first() throws Exception {
FreeStyleProject project = jenkinsRule.createFreeStyleProject();
project.getBuildersList().add(new Shell("echo hello"));
FreeStyleBuild build = project.scheduleBuild2(0).get();
}
}
例に従ってhttps://wiki.jenkins-ci.org/display/JENKINS/Unit+Test
しかし、 jenkinsRule.createFreeStyleProject() は保護されたメソッドであり、呼び出すことはできません。ビルダーのテスト方法