Search in sources :

Example 1 with EmmaPublisher

use of org.jenkinsci.test.acceptance.plugins.emma.EmmaPublisher in project acceptance-test-harness by jenkinsci.

the class EmmaPluginTest method coverage_test.

/*
     * Performs a coverage test by enabling coverage reporting and when
     * tests are run a coverage report is created.
     * The coverage report data is then verified.
     */
@Test
public void coverage_test() {
    job = jenkins.jobs.create();
    job.configure();
    job.copyDir(resource("/emma/test"));
    // In the maven build step an Emma goal is added to enable coverage reporting.
    MavenBuildStep mbs = job.addBuildStep(MavenBuildStep.class);
    mbs.targets.set("clean emma:emma package");
    EmmaPublisher ep = job.addPublisher(EmmaPublisher.class);
    ep.setReportingThresholds(100, 70, 80, 80, 80, 0, 0, 0, 0, 0);
    job.save();
    Build build = job.startBuild().waitUntilFinished().shouldSucceed();
    EmmaResultsPage resultsPage = new EmmaResultsPage(jenkins.injector, build.getConsoleUrl());
    // class    method  block   line
    List<String> expected = Arrays.asList("100.0", "50.0", "45.5", "50.0", "100.0", "50.0", "45.5", "50.0");
    resultsPage.assertHasResult(expected);
}
Also used : EmmaResultsPage(org.jenkinsci.test.acceptance.plugins.emma.EmmaResultsPage) Build(org.jenkinsci.test.acceptance.po.Build) MavenBuildStep(org.jenkinsci.test.acceptance.plugins.maven.MavenBuildStep) EmmaPublisher(org.jenkinsci.test.acceptance.plugins.emma.EmmaPublisher) AbstractJUnitTest(org.jenkinsci.test.acceptance.junit.AbstractJUnitTest) Test(org.junit.Test)

Aggregations

AbstractJUnitTest (org.jenkinsci.test.acceptance.junit.AbstractJUnitTest)1 EmmaPublisher (org.jenkinsci.test.acceptance.plugins.emma.EmmaPublisher)1 EmmaResultsPage (org.jenkinsci.test.acceptance.plugins.emma.EmmaResultsPage)1 MavenBuildStep (org.jenkinsci.test.acceptance.plugins.maven.MavenBuildStep)1 Build (org.jenkinsci.test.acceptance.po.Build)1 Test (org.junit.Test)1