use of org.jenkinsci.test.acceptance.plugins.jacoco.JacocoResultPage in project acceptance-test-harness by jenkinsci.
the class JacocoPluginTest method checkSuccessfulExecutionAndsummary.
@Test
public void checkSuccessfulExecutionAndsummary() {
MavenInstallation.installSomeMaven(jenkins);
FreeStyleJob job = jenkins.jobs.create();
{
job.copyDir(resource("/jacoco/test"));
MavenBuildStep maven = job.addBuildStep(MavenBuildStep.class);
maven.targets.set("clean package -B");
maven.properties("jacoco.version=" + getJacocoLibraryVersion(), true);
JacocoPublisher publisher = job.addPublisher(JacocoPublisher.class);
publisher.changeBuildStatus.check();
}
job.save();
Build build = job.startBuild().waitUntilFinished().shouldSucceed();
assertThat(build, hasAction("Coverage Report"));
JacocoResultPage total = new JacocoResultPage(build);
assertEquals(45.45, total.instructionCoverage(), 0.01);
assertEquals(50.0, total.branchCoverage(), 0.01);
assertEquals(33.33, total.complexityScore(), 0.01);
assertEquals(50.0, total.lineCoverage(), 0.01);
assertEquals(50.0, total.methodCoverage(), 0.01);
assertEquals(100.0, total.classCoverage(), 0.01);
JacocoResultPage pkg = new JacocoResultPage(total, "(default)/App");
assertEquals(45.45, pkg.instructionCoverage(), 0.01);
assertEquals(50.0, pkg.branchCoverage(), 0.01);
assertEquals(33.33, pkg.complexityScore(), 0.01);
assertEquals(50.0, pkg.lineCoverage(), 0.01);
assertEquals(50.0, pkg.methodCoverage(), 0.01);
assertEquals(100.0, pkg.classCoverage(), 0.01);
}
Aggregations