Search in sources :

Example 1 with JunitXML

use of com.thoughtworks.studios.shine.cruise.builder.JunitXML in project gocd by gocd.

the class ShineDaoIntegrationTest method shouldReturnTheTotalNumberOfFailuresAndErrorsForAPassedStage.

@Test
public void shouldReturnTheTotalNumberOfFailuresAndErrorsForAPassedStage() {
    StageIdentifier stageId = failureSetup.setupPipelineInstance(false, null, Arrays.asList(new Modification("blahUser", "revision 17", "hello@world", new Date(), "17")), new TestFailureSetup.TestResultsStubbing() {

        public void stub(Stage stage) {
            dbHelper.passStage(stage);
            JunitXML junit1 = junitXML("testSuite1", 2).failed(2).errored(1);
            junit1.registerStubContent(goURLRepository, "pipelines/" + stage.getJobInstances().get(0).getIdentifier().artifactLocator("junit") + "/junit/");
            JunitXML junit2 = junitXML("testSuite1", 2).errored(1);
            junit2.registerStubContent(goURLRepository, "pipelines/" + stage.getJobInstances().get(1).getIdentifier().artifactLocator("junit") + "/junit/");
        }
    }, new Date()).stageId;
    StageTestRuns testRuns = shineDao.failedBuildHistoryForStage(stageId, result);
    assertThat(testRuns.numberOfTests(), is(4));
    assertThat(testRuns.totalErrorCount(), is(2));
    assertThat(testRuns.totalFailureCount(), is(1));
}
Also used : StageIdentifier(com.thoughtworks.go.domain.StageIdentifier) Modification(com.thoughtworks.go.domain.materials.Modification) Stage(com.thoughtworks.go.domain.Stage) JunitXML(com.thoughtworks.studios.shine.cruise.builder.JunitXML) Date(java.util.Date) Test(org.junit.Test)

Example 2 with JunitXML

use of com.thoughtworks.studios.shine.cruise.builder.JunitXML in project gocd by gocd.

the class ShineDaoIntegrationTest method failingStageHistory.

private StageTestRuns failingStageHistory() {
    failureSetup.setupPipelineInstance(true, null, Arrays.asList(new Modification("fooUser", "revision 15", "loser@mail.com", new Date(), "15"), new Modification("RRR & DR", "revision 16", "boozer@mail.com", new Date(), "16")), new TestFailureSetup.TestResultsStubbing() {

        public void stub(Stage stage) {
            JunitXML junit1 = junitXML("testSuite1", 2).failed(2).errored(1);
            junit1.registerStubContent(goURLRepository, "pipelines/" + stage.getJobInstances().get(0).getIdentifier().artifactLocator("junit") + "/junit/");
        }
    }, new Date());
    stageId = failureSetup.setupPipelineInstance(true, null, Arrays.asList(new Modification("blahUser", "revision 17", "hello@world", new Date(), "17")), new TestFailureSetup.TestResultsStubbing() {

        public void stub(Stage stage) {
            JunitXML junit1 = junitXML("testSuite1", 2).failed(2).errored(1);
            junit1.registerStubContent(goURLRepository, "pipelines/" + stage.getJobInstances().get(0).getIdentifier().artifactLocator("junit") + "/junit/");
            JunitXML junit2 = junitXML("testSuite1", 2).errored(1);
            junit2.registerStubContent(goURLRepository, "pipelines/" + stage.getJobInstances().get(1).getIdentifier().artifactLocator("junit") + "/junit/");
        }
    }, new Date()).stageId;
    return shineDao.failedBuildHistoryForStage(stageId, result);
}
Also used : Modification(com.thoughtworks.go.domain.materials.Modification) Stage(com.thoughtworks.go.domain.Stage) JunitXML(com.thoughtworks.studios.shine.cruise.builder.JunitXML) Date(java.util.Date)

Example 3 with JunitXML

use of com.thoughtworks.studios.shine.cruise.builder.JunitXML in project gocd by gocd.

the class TestFailureSetup method setupPipelineInstance.

public SavedStage setupPipelineInstance(final boolean failStage, final String overriddenLabel, final StubGoURLRepository goURLRepository) {
    TestResultsStubbing resultStubbing = new TestResultsStubbing() {

        public void stub(Stage stage) {
            JunitXML junit1 = junitXML("testSuite1", 2).errored(2).failed(1);
            junit1.registerStubContent(goURLRepository, "pipelines/" + stage.getJobInstances().get(0).getIdentifier().artifactLocator("junit") + "/junit/");
            JunitXML junit2 = junitXML("testSuite1", 1).failed(1);
            junit2.registerStubContent(goURLRepository, "pipelines/" + stage.getJobInstances().get(1).getIdentifier().artifactLocator("junit") + "/junit/");
        }
    };
    return setupPipelineInstance(failStage, overriddenLabel, resultStubbing, new Date());
}
Also used : Stage(com.thoughtworks.go.domain.Stage) JunitXML(com.thoughtworks.studios.shine.cruise.builder.JunitXML) Date(java.util.Date)

Aggregations

Stage (com.thoughtworks.go.domain.Stage)3 JunitXML (com.thoughtworks.studios.shine.cruise.builder.JunitXML)3 Date (java.util.Date)3 Modification (com.thoughtworks.go.domain.materials.Modification)2 StageIdentifier (com.thoughtworks.go.domain.StageIdentifier)1 Test (org.junit.Test)1