Search in sources :

Example 6 with CheckStyleAction

use of org.jenkinsci.test.acceptance.plugins.checkstyle.CheckStyleAction in project acceptance-test-harness by jenkinsci.

the class CheckStylePluginTest method should_group_warnings_by_module.

/**
 * Builds a multi-module maven project and checks that warnings are grouped by module.
 */
// TODO: Check module details
@Test
public void should_group_warnings_by_module() {
    MavenModuleSet job = createMavenJob(CHECKSTYLE_PLUGIN_ROOT + "maven_multi_module", "clean package checkstyle:checkstyle", CheckStyleMavenSettings.class, new NullConfigurator<>());
    Node slave = createSlaveForJob(job);
    Build build = buildSuccessfulJobOnSlave(job, slave);
    assertThatCheckStyleResultExists(job, build);
    build.open();
    CheckStyleAction checkstyle = new CheckStyleAction(build);
    checkstyle.open();
    assertThat(checkstyle.getNumberOfNewWarnings(), is(24));
    assertThatModulesTabIsCorrectlyFilled(checkstyle);
}
Also used : CheckStyleAction(org.jenkinsci.test.acceptance.plugins.checkstyle.CheckStyleAction) Build(org.jenkinsci.test.acceptance.po.Build) Node(org.jenkinsci.test.acceptance.po.Node) MavenModuleSet(org.jenkinsci.test.acceptance.plugins.maven.MavenModuleSet) Test(org.junit.Test)

Example 7 with CheckStyleAction

use of org.jenkinsci.test.acceptance.plugins.checkstyle.CheckStyleAction in project acceptance-test-harness by jenkinsci.

the class CheckStylePluginTest method runBuild.

private void runBuild(final FreeStyleJob job, final int buildNumber, final Result expectedResult, final int expectedNewWarnings, final int expectedFixedWarnings, final boolean usePreviousAsReference) {
    String fileName = "checkstyle-result-build" + buildNumber + ".xml";
    editJob(CHECKSTYLE_PLUGIN_ROOT + fileName, false, job, CheckStyleFreestyleSettings.class, settings -> {
        settings.setNewWarningsThresholdUnstable("0", usePreviousAsReference);
        settings.pattern.set(fileName);
    });
    Build build = buildJobAndWait(job).shouldBe(expectedResult);
    if (expectedNewWarnings > 0) {
        assertThatCheckStyleResultExists(job, build);
        build.open();
        CheckStyleAction checkstyle = new CheckStyleAction(build);
        checkstyle.open();
        assertThat(checkstyle.getNumberOfNewWarnings(), is(expectedNewWarnings));
        assertThat(checkstyle.getNumberOfFixedWarnings(), is(expectedFixedWarnings));
    }
}
Also used : CheckStyleAction(org.jenkinsci.test.acceptance.plugins.checkstyle.CheckStyleAction) Build(org.jenkinsci.test.acceptance.po.Build)

Aggregations

CheckStyleAction (org.jenkinsci.test.acceptance.plugins.checkstyle.CheckStyleAction)7 Build (org.jenkinsci.test.acceptance.po.Build)5 Test (org.junit.Test)5 FreeStyleJob (org.jenkinsci.test.acceptance.po.FreeStyleJob)3 TreeMap (java.util.TreeMap)2 WithPlugins (org.jenkinsci.test.acceptance.junit.WithPlugins)2 MavenModuleSet (org.jenkinsci.test.acceptance.plugins.maven.MavenModuleSet)2 Issue (org.jvnet.hudson.test.Issue)2 WithCredentials (org.jenkinsci.test.acceptance.junit.WithCredentials)1 WithDocker (org.jenkinsci.test.acceptance.junit.WithDocker)1 GraphConfigurationView (org.jenkinsci.test.acceptance.plugins.analysis_core.GraphConfigurationView)1 EnvInjectConfig (org.jenkinsci.test.acceptance.plugins.envinject.EnvInjectConfig)1 DumbSlave (org.jenkinsci.test.acceptance.po.DumbSlave)1 Node (org.jenkinsci.test.acceptance.po.Node)1 WebElement (org.openqa.selenium.WebElement)1