use of org.jenkinsci.test.acceptance.plugins.logparser.LogParserPublisher in project acceptance-test-harness by jenkinsci.
the class LogParserTest method checkMarkedFailedAndUnstable.
/**
* Test case:
* Check for a build to be marked as failed and another build to be marked as unstable.
*/
@Test
public void checkMarkedFailedAndUnstable() {
FreeStyleJob job = jenkins.jobs.create(FreeStyleJob.class, "simple-job");
job.configure(() -> {
job.addShellStep("echo marked as error");
LogParserPublisher lpp = job.addPublisher(LogParserPublisher.class);
lpp.setMarkOnBuildFail(true);
lpp.setRule(resource("/logparser_plugin/rules/log-parser-rule-markings"));
});
job.startBuild().waitUntilFinished().shouldFail();
job.configure(() -> {
job.addShellStep("echo marked as warning");
LogParserPublisher lpp = job.getPublisher(LogParserPublisher.class);
lpp.setMarkOnBuildFail(false);
lpp.setMarkOnUnstableWarning(true);
});
job.startBuild().waitUntilFinished().shouldBeUnstable();
}
use of org.jenkinsci.test.acceptance.plugins.logparser.LogParserPublisher in project acceptance-test-harness by jenkinsci.
the class LogParserTest method invalidRulePath.
/**
* Test information for failed log parsing.
*/
@Test
public void invalidRulePath() {
FreeStyleJob job = jenkins.jobs.create(FreeStyleJob.class, "fail-job");
// configure invalid route
job.configure(() -> {
LogParserPublisher lpp = job.addPublisher(LogParserPublisher.class);
lpp.setRule(LogParserPublisher.RuleType.PROJECT, "invalidPath");
});
Build build = job.startBuild().waitUntilFinished();
// check information on build overview
build.open();
WebElement tableRow = find(By.xpath(SUMMARY_XPATH));
WebElement logParserSummary = findLogParserSummary(tableRow);
WebElement icon = logParserSummary.findElement(By.xpath("td[1]/img"));
assertThat(icon.getAttribute("src"), containsString("graph"));
WebElement text = logParserSummary.findElement(By.xpath("td[2]"));
assertThat(text.getText(), is("Log parsing has failed"));
LogParserOutputPage outputPage = new LogParserOutputPage(build);
outputPage.open();
WebElement output = find(By.id("main-panel"));
assertThat(output.getText(), containsString("ERROR: Failed to parse console log"));
}
use of org.jenkinsci.test.acceptance.plugins.logparser.LogParserPublisher in project acceptance-test-harness by jenkinsci.
the class LogParserTest method configureSampleJob.
private Job configureSampleJob() {
FreeStyleJob job = jenkins.jobs.create(FreeStyleJob.class, "sampleJob");
// configure job
job.configure(() -> {
LogParserPublisher lpp = job.addPublisher(LogParserPublisher.class);
lpp.setRule(LogParserPublisher.RuleType.GLOBAL, parserRules.get("sampleRule"));
// write sample output
Resource sampleRule = resource("/logparser_plugin/console-outputs/sample-log");
catToConsole(job, sampleRule.url.getPath());
});
return job;
}
use of org.jenkinsci.test.acceptance.plugins.logparser.LogParserPublisher in project acceptance-test-harness by jenkinsci.
the class LogParserTest method trendVisible.
/**
* Check whether trend is visible
*/
@Test
public void trendVisible() {
FreeStyleJob job = jenkins.jobs.create(FreeStyleJob.class, "simple-job");
job.configure(() -> {
// sample use of the LogParserPublisher
LogParserPublisher lpp = job.addPublisher(LogParserPublisher.class);
lpp.setShowGraphs(true);
lpp.setRule(LogParserPublisher.RuleType.GLOBAL, parserRules.get("sampleRule"));
});
// Trend is shown after second build
job.startBuild().waitUntilFinished();
job.startBuild().waitUntilFinished();
// Check trend is visible
job.open();
WebElement trend = find(By.className("test-trend-caption"));
assertThat(trend.getText(), containsString("Log Parser Trend"));
WebElement img = find(By.xpath("//img[@src='logparser/trend']"));
assertThat(img.getAttribute("alt"), containsString("[Log Parser Chart]"));
}
Aggregations