Search in sources :

Example 86 with WithPlugins

use of org.jenkinsci.test.acceptance.junit.WithPlugins in project acceptance-test-harness by jenkinsci.

the class AbstractAnalysisTest method should_have_trend_graph_with_relative_links_in_pipeline.

/**
 * Builds a pipeline with an enabled publisher of the plug-in under test two times in a row. Verifies that
 * afterwards a trend graph exists that contains 6 relative links to the plug-in results (one for each priority and
 * build).
 */
@Test
@WithPlugins("workflow-aggregator")
@Issue("31202")
public void should_have_trend_graph_with_relative_links_in_pipeline() {
    Job job = runTwoTimesInARow(createPipeline());
    verifyTrendGraph(job, getNumberOfWarnings());
}
Also used : Job(org.jenkinsci.test.acceptance.po.Job) FreeStyleJob(org.jenkinsci.test.acceptance.po.FreeStyleJob) WorkflowJob(org.jenkinsci.test.acceptance.po.WorkflowJob) Issue(org.jvnet.hudson.test.Issue) AbstractJUnitTest(org.jenkinsci.test.acceptance.junit.AbstractJUnitTest) Test(org.junit.Test) WithPlugins(org.jenkinsci.test.acceptance.junit.WithPlugins)

Example 87 with WithPlugins

use of org.jenkinsci.test.acceptance.junit.WithPlugins in project acceptance-test-harness by jenkinsci.

the class AnalysisCollectorPluginTest method should_compute_annotations_on_workflow.

@Test
@WithPlugins("workflow-aggregator")
public void should_compute_annotations_on_workflow() {
    WorkflowJob job = jenkins.jobs.create(WorkflowJob.class);
    job.script.set("node {\n" + copyFileToWorkspace(job, "checkstyle-result.xml") + copyFileToWorkspace(job, "findbugs.xml") + "  step([$class: 'FindBugsPublisher', pattern: '**/findbugs.xml'])\n" + "  step([$class: 'CheckStylePublisher'])\n" + "  step([$class: 'AnalysisPublisher'])\n" + "}");
    job.sandbox.check();
    job.save();
    final Build build = job.startBuild();
    build.shouldSucceed();
    assertThat(build, hasAction("Static Analysis Warnings"));
    AnalysisCollectorAction action = new AnalysisCollectorAction(build);
    action.open();
    assertThat(action.getNumberOfWarnings(), is(FINDBUGS_ALL + CHECKSTYLE_ALL));
    assertThat(action.getNumberOfNewWarnings(), is(FINDBUGS_ALL + CHECKSTYLE_ALL));
}
Also used : Build(org.jenkinsci.test.acceptance.po.Build) AnalysisCollectorAction(org.jenkinsci.test.acceptance.plugins.analysis_collector.AnalysisCollectorAction) WorkflowJob(org.jenkinsci.test.acceptance.po.WorkflowJob) Test(org.junit.Test) WithPlugins(org.jenkinsci.test.acceptance.junit.WithPlugins)

Example 88 with WithPlugins

use of org.jenkinsci.test.acceptance.junit.WithPlugins in project acceptance-test-harness by jenkinsci.

the class AnalysisCollectorPluginTest method should_open_links_in_folder_dashboard_and_nested_views.

/**
 * Sets up a nested view that contains a dashboard view with a warnings-per-project portlet.
 * Creates a folder in this view and a multi-branch job in this folder.
 * The multi-branch job is based on a git repository with two branches (master and branch).
 * Each branch contains a Jenkinsfile and several warnings results files.
 * Builds the jobs and verifies that the portlet is correctly filled and that all links open the correct page.
 */
@Test
@Issue({ "JENKINS-39950" })
@WithPlugins({ "dashboard-view", "nested-view", "git", "workflow-job", "workflow-cps", "workflow-basic-steps", "workflow-durable-task-step", "workflow-multibranch" })
@WithDocker
@WithCredentials(credentialType = WithCredentials.SSH_USERNAME_PRIVATE_KEY, values = { "warnings", "/org/jenkinsci/test/acceptance/docker/fixtures/GitContainer/unsafe" })
public void should_open_links_in_folder_dashboard_and_nested_views() {
    // avoid JENKINS-49026
    checkExtensionAreDeployed("hudson.plugins.analysis.dashboard.AbstractPortlet", Collections.EMPTY_SET);
    // Given
    NestedView nested = jenkins.getViews().create(NestedView.class);
    DashboardView dashboard = nested.getViews().create(DashboardView.class);
    dashboard.configure(() -> {
        dashboard.matchAllJobs();
        dashboard.checkRecurseIntoFolders();
        addWarningsPortlet(dashboard);
    });
    Folder folder = dashboard.jobs.create(Folder.class);
    folder.save();
    folder.open();
    String repoUrl = createGitRepositoryInDockerContainer();
    WorkflowMultiBranchJob job = folder.getJobs().create(WorkflowMultiBranchJob.class);
    GitBranchSource branchSource = job.addBranchSource(GitBranchSource.class);
    branchSource.setRemote(repoUrl);
    branchSource.setCredentials("warnings");
    job.save();
    job.waitForBranchIndexingFinished(20);
    // When
    List<String> jobs = Arrays.asList("master", "branch");
    for (String name : jobs) {
        buildBranch(job, name);
    }
    // Then
    dashboard.open();
    for (String name : jobs) {
        verifyWarningsCountInPortlet(name, dashboard);
    }
    for (AnalysisPlugin plugin : ANALYSIS_PLUGINS) {
        for (String name : jobs) {
            dashboard.open();
            findPortletLink(dashboard, name, plugin.getId()).click();
            assertThat(driver, hasContent(plugin.getName()));
        }
    }
}
Also used : NestedView(org.jenkinsci.test.acceptance.plugins.nested_view.NestedView) DashboardView(org.jenkinsci.test.acceptance.plugins.dashboard_view.DashboardView) CoreMatchers.containsString(org.hamcrest.CoreMatchers.containsString) Folder(org.jenkinsci.test.acceptance.po.Folder) WorkflowMultiBranchJob(org.jenkinsci.test.acceptance.po.WorkflowMultiBranchJob) GitBranchSource(org.jenkinsci.test.acceptance.plugins.workflow_multibranch.GitBranchSource) AnalysisPlugin(org.jenkinsci.test.acceptance.plugins.analysis_collector.AnalysisPlugin) Issue(org.jvnet.hudson.test.Issue) WithCredentials(org.jenkinsci.test.acceptance.junit.WithCredentials) Test(org.junit.Test) WithPlugins(org.jenkinsci.test.acceptance.junit.WithPlugins) WithDocker(org.jenkinsci.test.acceptance.junit.WithDocker)

Example 89 with WithPlugins

use of org.jenkinsci.test.acceptance.junit.WithPlugins in project acceptance-test-harness by jenkinsci.

the class CheckStylePluginTest method should_return_from_triggered_subjob.

@Test
@WithPlugins("parameterized-trigger")
@Issue("JENKINS-33162")
public void should_return_from_triggered_subjob() {
    FreeStyleJob checkstyleJob = createFreeStyleJob(settings -> settings.pattern.set(PATTERN_WITH_776_WARNINGS));
    FreeStyleJob trigger = jenkins.jobs.create();
    trigger.configure();
    TriggerCallBuildStep step = trigger.addBuildStep(TriggerCallBuildStep.class);
    BuildTriggerConfig config = step.getBuildTriggerConfig(0);
    config.projects.set(checkstyleJob.name);
    config.block.click();
    trigger.save();
    trigger.startBuild().shouldSucceed();
    Build downstream = checkstyleJob.build(1);
    downstream.shouldSucceed();
}
Also used : Build(org.jenkinsci.test.acceptance.po.Build) BuildTriggerConfig(org.jenkinsci.test.acceptance.plugins.parameterized_trigger.BuildTriggerConfig) TriggerCallBuildStep(org.jenkinsci.test.acceptance.plugins.parameterized_trigger.TriggerCallBuildStep) FreeStyleJob(org.jenkinsci.test.acceptance.po.FreeStyleJob) Issue(org.jvnet.hudson.test.Issue) Test(org.junit.Test) WithPlugins(org.jenkinsci.test.acceptance.junit.WithPlugins)

Aggregations

WithPlugins (org.jenkinsci.test.acceptance.junit.WithPlugins)89 Test (org.junit.Test)89 AbstractJUnitTest (org.jenkinsci.test.acceptance.junit.AbstractJUnitTest)71 FreeStyleJob (org.jenkinsci.test.acceptance.po.FreeStyleJob)53 Build (org.jenkinsci.test.acceptance.po.Build)39 CoreMatchers.containsString (org.hamcrest.CoreMatchers.containsString)31 Issue (org.jvnet.hudson.test.Issue)25 Job (org.jenkinsci.test.acceptance.po.Job)19 WithDocker (org.jenkinsci.test.acceptance.junit.WithDocker)15 WorkflowJob (org.jenkinsci.test.acceptance.po.WorkflowJob)15 ListView (org.jenkinsci.test.acceptance.po.ListView)13 View (org.jenkinsci.test.acceptance.po.View)13 DockerTest (org.jenkinsci.test.acceptance.junit.DockerTest)12 WithCredentials (org.jenkinsci.test.acceptance.junit.WithCredentials)11 JobDslBuildStep (org.jenkinsci.test.acceptance.plugins.job_dsl.JobDslBuildStep)10 Matchers.containsString (org.hamcrest.Matchers.containsString)9 GlobalSecurityConfig (org.jenkinsci.test.acceptance.po.GlobalSecurityConfig)9 DumbSlave (org.jenkinsci.test.acceptance.po.DumbSlave)8 Ignore (org.junit.Ignore)8 WarningsAction (org.jenkinsci.test.acceptance.plugins.warnings.WarningsAction)5