Skip to content

Commit

Permalink
[JENKINS-30390] New test: Workflow job using Analysis Collector (with…
Browse files Browse the repository at this point in the history
… findbugs and checkstyle)
  • Loading branch information
amuniz committed Sep 27, 2015
1 parent ba5885b commit f206413
Showing 1 changed file with 32 additions and 1 deletion.
33 changes: 32 additions & 1 deletion src/test/java/plugins/AnalysisCollectorPluginTest.java
Expand Up @@ -13,13 +13,15 @@
import org.jenkinsci.test.acceptance.plugins.checkstyle.CheckStyleFreestyleSettings;
import org.jenkinsci.test.acceptance.plugins.dashboard_view.DashboardView;
import org.jenkinsci.test.acceptance.plugins.findbugs.FindBugsFreestyleSettings;
import org.jenkinsci.test.acceptance.plugins.maven.MavenInstallation;
import org.jenkinsci.test.acceptance.plugins.pmd.PmdFreestyleSettings;
import org.jenkinsci.test.acceptance.plugins.tasks.TasksFreestyleSettings;
import org.jenkinsci.test.acceptance.plugins.warnings.WarningsBuildSettings;
import org.jenkinsci.test.acceptance.po.Build;
import org.jenkinsci.test.acceptance.po.FreeStyleJob;
import org.jenkinsci.test.acceptance.po.Job;
import org.jenkinsci.test.acceptance.po.ListView;
import org.jenkinsci.test.acceptance.po.WorkflowJob;
import org.junit.Test;
import org.jvnet.hudson.test.Issue;
import org.openqa.selenium.WebElement;
Expand All @@ -29,7 +31,6 @@
import static org.jenkinsci.test.acceptance.Matchers.*;
import static org.jenkinsci.test.acceptance.plugins.analysis_collector.AnalysisPlugin.*;
import static org.jenkinsci.test.acceptance.plugins.dashboard_view.DashboardView.*;
import static org.jenkinsci.test.acceptance.po.PageObject.createRandomName;

/**
* Acceptance tests for the Static Code Analysis Collector (analysis-collector) plug-in.
Expand Down Expand Up @@ -329,6 +330,36 @@ public void should_aggregate_warnings_in_dashboard_portlet() {
assertThat(dashboard, not(hasWarningsFor(job, TASKS, TASKS_ALL)));
}

@Test
@WithPlugins({"git@2.4.0", "workflow-aggregator@1.10"})
public void should_compute_annotations_on_workflow() {
MavenInstallation.installMaven(jenkins, "M3", "3.3.3");
WorkflowJob job = jenkins.jobs.create(WorkflowJob.class);
// TODO: Job.copyResource(String) does not work for WorkflowJob, since it does not owns
// a workspace but the build does (actually it could own 0..N workspaces).
job.script.set(
"node {\n" +
" git 'https://github.com/amuniz/maven-helloworld.git'\n" +
" def mvnHome = tool 'M3'\n" +
" sh \"${mvnHome}/bin/mvn -B -Dmaven.test.failure.ignore verify\"\n" +
" step([$class: 'FindBugsPublisher', pattern: '**/findbugsXml.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(17)); // 1 from FB and 16 from CS
assertThat(action.getNumberOfNewWarnings(), is(17));
}

private AnalysisCollectorAction deselectPluginAndBuild(AnalysisPlugin plugin, Job job) {
job.configure();
AnalysisCollectorSettings publisher = job.getPublisher(AnalysisCollectorSettings.class);
Expand Down

0 comments on commit f206413

Please sign in to comment.