use of org.jenkinsci.test.acceptance.junit.WithPlugins in project acceptance-test-harness by jenkinsci.
the class AbstractAnalysisTest method should_send_mail_with_expanded_tokens.
/**
* Checks that the plug-in sends a mail after a build has been failed. The content of the mail contains several
* tokens that should be expanded in the mail with the correct values.
*/
// TODO: we should have two builds so that the numbers are different
@Test
@Issue("JENKINS-25501")
@WithPlugins("email-ext")
public void should_send_mail_with_expanded_tokens() {
// avoid JENKINS-49026
checkExtensionAreDeployed("hudson.plugins.analysis.tokens.AbstractTokenMacro", Collections.EMPTY_SET);
setUpMailer();
FreeStyleJob job = createFreeStyleJob();
P projectAction = createProjectAction(job);
job.editPublisher(projectAction.getFreeStyleSettings(), settings -> settings.setBuildFailedTotalAll("0"));
String name = projectAction.getUrl().toUpperCase();
String title = "Analysis-Result";
configureEmailNotification(job, String.format("%s: ${%s_RESULT}", title, name), String.format("%s: ${%s_COUNT}-${%s_FIXED}-${%s_NEW}", title, name, name, name));
buildFailingJob(job);
verifyReceivedMail(String.format("%s: FAILURE", title), String.format("%s: %d-0-%d", title, getNumberOfWarnings(), getNumberOfWarnings()));
}
use of org.jenkinsci.test.acceptance.junit.WithPlugins in project acceptance-test-harness by jenkinsci.
the class AnalysisCollectorPluginTest method should_aggregate_warnings_in_dashboard_portlet.
/**
* Sets up a dashboard view with a warnings-per-project portlet. Builds a job and checks if the portlet shows the
* correct number of warnings. Then one of the tools is deselected. The portlet should then show only the remaining
* number of warnings.
*/
@Test
@WithPlugins("dashboard-view")
public void should_aggregate_warnings_in_dashboard_portlet() {
// avoid JENKINS-49026
checkExtensionAreDeployed("hudson.plugins.analysis.dashboard.AbstractPortlet", Collections.EMPTY_SET);
FreeStyleJob job = createFreeStyleJob();
buildSuccessfulJob(job);
DashboardView dashboard = jenkins.views.create(DashboardView.class, createRandomName());
dashboard.configure();
dashboard.matchAllJobs();
WarningsPerProjectPortlet portlet = addWarningsPortlet(dashboard);
dashboard.save();
dashboard.open();
verifyWarningsCountInPortlet(job.name, dashboard);
// uncheck Open Tasks
dashboard.configure(() -> portlet.checkCollectedPlugin(TASKS, false));
dashboard.open();
assertThat(dashboard, not(hasWarnings(job.name, TASKS.getId(), TASKS_ALL)));
}
use of org.jenkinsci.test.acceptance.junit.WithPlugins in project acceptance-test-harness by jenkinsci.
the class AnalysisCollectorPluginTest method should_checkout_pipeline_from_git.
/**
* Creates and builds a pipeline that is version controlled in Git. Basically the same test case as
* {@link AbstractAnalysisTest#should_navigate_to_result_action_from_pipeline()}. Rather than using the script
* text box a Git repository is connected.
*/
@Test
@WithPlugins({ "git", "workflow-basic-steps", "workflow-multibranch", "workflow-job", "workflow-durable-task-step" })
@WithDocker
@WithCredentials(credentialType = WithCredentials.SSH_USERNAME_PRIVATE_KEY, values = { CREDENTIALS_ID, KEY_FILENAME })
public void should_checkout_pipeline_from_git() {
String gitRepositoryUrl = createGitRepositoryInDockerContainer();
WorkflowJob job = jenkins.getJobs().create(WorkflowJob.class);
job.setJenkinsFileRepository(gitRepositoryUrl, CREDENTIALS_ID);
job.save();
Build build = buildSuccessfulJob(job);
verifyJobResults(job, build);
}
use of org.jenkinsci.test.acceptance.junit.WithPlugins in project acceptance-test-harness by jenkinsci.
the class CheckStylePluginTest method should_show_warnings_per_user.
/**
* Verifies that blaming of warnings works on agents: creates a new project in a Git repository in a docker
* container. Registers the same docker container as slave agent to build the project. Uses the recorded build
* results in checkstyle-result.xml (no actual maven goal is invoked). Verifies that the blame information is
* correctly assigned for each of the warnings. Also checks, that the age is increased for yet another build.
*/
@Test
@WithPlugins({ "git", "dashboard-view", "analysis-core@1.88-SNAPSHOT", "ssh-slaves" })
@WithDocker
@Issue("JENKINS-6748")
@WithCredentials(credentialType = WithCredentials.SSH_USERNAME_PRIVATE_KEY, values = { CREDENTIALS_ID, CREDENTIALS_KEY })
public void should_show_warnings_per_user() {
// avoid JENKINS-49026
jenkins.restart();
DumbSlave agent = createDockerAgent();
String gitRepositoryUrl = createGitRepositoryInDockerContainer();
FreeStyleJob job = createFreeStyleJob(jenkins, null, settings -> settings.pattern.set("**/checkstyle-result.xml"));
job.configure(() -> {
job.useScm(GitScm.class).url(gitRepositoryUrl).credentials(CREDENTIALS_ID);
job.setLabelExpression(agent.getName());
});
buildSuccessfulJob(job);
CheckStyleAction action = new CheckStyleAction(job);
action.open();
SortedMap<String, Integer> expectedPeople = new TreeMap<>();
expectedPeople.put("Unknown authors", 1);
expectedPeople.put("Jenkins-ATH <jenkins-ath@example.org>", 11);
assertThat(action.getPeopleTabContents(), is(expectedPeople));
action.find(By.partialLinkText("Jenkins-ATH")).click();
assertThat(driver, hasContent("Checkstyle Warnings - Jenkins-ATH"));
action.open();
SortedMap<String, String> expectedOrigin = new TreeMap<>();
expectedOrigin.put("Main.java:0", "-");
expectedOrigin.put("Main.java:2", "Jenkins-ATH");
expectedOrigin.put("Main.java:4", "Jenkins-ATH");
expectedOrigin.put("Main.java:6", "Jenkins-ATH");
expectedOrigin.put("Main.java:9", "Jenkins-ATH");
expectedOrigin.put("Main.java:13", "Jenkins-ATH");
expectedOrigin.put("Main.java:18", "Jenkins-ATH");
expectedOrigin.put("Main.java:23", "Jenkins-ATH");
expectedOrigin.put("Main.java:24", "Jenkins-ATH");
expectedOrigin.put("Main.java:27", "Jenkins-ATH");
assertThat(action.getOriginTabContentsAsStrings(AUTHOR), is(expectedOrigin));
assertThatAgeIsAt(action, expectedOrigin, 1);
buildSuccessfulJob(job);
assertThatAgeIsAt(action, expectedOrigin, 2);
GraphConfigurationView view = action.configureTrendGraphForUser();
view.open();
view.setUserGraph();
view.save();
WebElement graph = find(getUsersTrendGraphXpath());
assertThat(graph.isDisplayed(), is(true));
verifyNoAuthors(action, true);
WebElement nothing = getElement(getUsersTrendGraphXpath());
assertThat(nothing, nullValue());
verifyNoAuthors(action, false);
}
use of org.jenkinsci.test.acceptance.junit.WithPlugins in project acceptance-test-harness by jenkinsci.
the class CheckStylePluginTest method should_resolve_environment_variables.
/**
* Verifies that environment variables are expanded in the file name pattern.
*/
@Test
@Issue("JENKINS-30735")
@WithPlugins({ "envinject", "analysis-core@1.77", "checkstyle@3.46" })
public void should_resolve_environment_variables() {
FreeStyleJob job = createFreeStyleJob(settings -> settings.pattern.set("checkstyle${ENV_DASH}result.xml"));
job.configure(() -> new EnvInjectConfig.Environment(job).properties.sendKeys("ENV_DASH=-"));
Build build = buildSuccessfulJob(job);
assertThatCheckStyleResultExists(job, build);
CheckStyleAction action = new CheckStyleAction(job);
assertThatWarningsCountInSummaryIs(action, TOTAL_NUMBER_OF_WARNINGS);
assertThatNewWarningsCountInSummaryIs(action, TOTAL_NUMBER_OF_WARNINGS);
assertThat(build.getConsole(), containsRegexp("\\[CHECKSTYLE\\] Searching for all files in .* that match the pattern checkstyle-result.xml\n"));
}
Aggregations