Search in sources :

Example 1 with StageTestRuns

use of com.thoughtworks.go.domain.testinfo.StageTestRuns in project gocd by gocd.

the class ShineDao method failedTestsFor.

public List<TestSuite> failedTestsFor(final StageIdentifier stageId) {
    StageTestRuns stageTestRuns = getTestCount(stageId);
    final List<StageIdentifier> stageIdentifierList = Arrays.asList(stageId);
    populateFailingTests(stageTestRuns, getFailedTests(stageIdentifierList));
    populateUsers(stageTestRuns, getCommitters(stageIdentifierList));
    return stageTestRuns.failingTestSuitesForNthPipelineRun(0);
}
Also used : StageIdentifier(com.thoughtworks.go.domain.StageIdentifier) StageTestRuns(com.thoughtworks.go.domain.testinfo.StageTestRuns)

Example 2 with StageTestRuns

use of com.thoughtworks.go.domain.testinfo.StageTestRuns in project gocd by gocd.

the class ShineDaoIntegrationTest method shouldRetriveTheRightHistoricalFailureInformationForPipelinesWithSameLabel.

@Test
public void shouldRetriveTheRightHistoricalFailureInformationForPipelinesWithSameLabel() throws Exception {
    Pipeline pipeline1 = pipeline;
    failureSetup.setupPipelineInstance(true, pipeline1.getLabel(), goURLRepository);
    StageIdentifier stageId3 = failureSetup.setupPipelineInstance(true, pipeline1.getLabel(), goURLRepository).stageId;
    StageTestRuns stageTestRuns = shineDao.failedBuildHistoryForStage(stageId3, result);
    List<FailingTestsInPipeline> failingTestsInPipelines = stageTestRuns.failingTestsInPipelines();
    assertThat(failingTestsInPipelines.size(), is(3));
    FailingTestsInPipeline failingPipeline3 = failingTestsInPipelines.get(0);
    assertThat(failingPipeline3.getLabel(), is(pipeline1.getLabel()));
    assertThat(failingPipeline3.failingSuites().size(), is(0));
    FailingTestsInPipeline failingPipeline2 = failingTestsInPipelines.get(1);
    assertThat(failingPipeline2.getLabel(), is(pipeline1.getLabel()));
    assertThat(failingPipeline2.failingSuites().size(), is(0));
    FailingTestsInPipeline failingPipeline1 = failingTestsInPipelines.get(2);
    assertThat(failingPipeline1.getLabel(), is(pipeline1.getLabel()));
    List<TestSuite> suites = failingPipeline1.failingSuites();
    assertThat(suites.size(), is(1));
    assertThat(suites.get(0).countOfStatus(TestStatus.Error), is(1));
    assertThat(suites.get(0).countOfStatus(TestStatus.Failure), is(1));
}
Also used : StageIdentifier(com.thoughtworks.go.domain.StageIdentifier) TestSuite(com.thoughtworks.go.domain.testinfo.TestSuite) StageTestRuns(com.thoughtworks.go.domain.testinfo.StageTestRuns) FailingTestsInPipeline(com.thoughtworks.go.domain.testinfo.FailingTestsInPipeline) Pipeline(com.thoughtworks.go.domain.Pipeline) FailingTestsInPipeline(com.thoughtworks.go.domain.testinfo.FailingTestsInPipeline) Test(org.junit.Test)

Example 3 with StageTestRuns

use of com.thoughtworks.go.domain.testinfo.StageTestRuns in project gocd by gocd.

the class ShineDaoIntegrationTest method shouldRetriveHistoricalFailureInformation.

@Test
public void shouldRetriveHistoricalFailureInformation() throws Exception {
    Pipeline pipeline1 = pipeline;
    TestFailureSetup.SavedStage savedStage = failureSetup.setupPipelineInstance(true, null, goURLRepository);
    StageIdentifier stageId2 = savedStage.stageId;
    Pipeline pipeline2 = savedStage.pipeline;
    StageTestRuns stageTestRuns = shineDao.failedBuildHistoryForStage(stageId2, result);
    List<FailingTestsInPipeline> failingTestsInPipelines = stageTestRuns.failingTestsInPipelines();
    assertThat(failingTestsInPipelines.size(), is(2));
    FailingTestsInPipeline failingPipeline2 = failingTestsInPipelines.get(0);
    assertThat(failingPipeline2.getLabel(), is(pipeline2.getLabel()));
    assertThat(failingPipeline2.failingSuites().size(), is(0));
    FailingTestsInPipeline failingPipeline1 = failingTestsInPipelines.get(1);
    assertThat(failingPipeline1.getLabel(), is(pipeline1.getLabel()));
    assertThat(failingPipeline1.failingSuites().size(), is(1));
}
Also used : StageIdentifier(com.thoughtworks.go.domain.StageIdentifier) StageTestRuns(com.thoughtworks.go.domain.testinfo.StageTestRuns) FailingTestsInPipeline(com.thoughtworks.go.domain.testinfo.FailingTestsInPipeline) Pipeline(com.thoughtworks.go.domain.Pipeline) FailingTestsInPipeline(com.thoughtworks.go.domain.testinfo.FailingTestsInPipeline) Test(org.junit.Test)

Example 4 with StageTestRuns

use of com.thoughtworks.go.domain.testinfo.StageTestRuns 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) StageTestRuns(com.thoughtworks.go.domain.testinfo.StageTestRuns) Stage(com.thoughtworks.go.domain.Stage) JunitXML(com.thoughtworks.studios.shine.cruise.builder.JunitXML) Date(java.util.Date) Test(org.junit.Test)

Example 5 with StageTestRuns

use of com.thoughtworks.go.domain.testinfo.StageTestRuns in project gocd by gocd.

the class ShineDaoIntegrationTest method shouldContainTotalTestCounts.

@Test
public void shouldContainTotalTestCounts() throws Exception {
    StageTestRuns stageTestRuns = failingStageHistory();
    assertThat(stageTestRuns.numberOfTests(), is(4));
}
Also used : StageTestRuns(com.thoughtworks.go.domain.testinfo.StageTestRuns) Test(org.junit.Test)

Aggregations

StageTestRuns (com.thoughtworks.go.domain.testinfo.StageTestRuns)10 Test (org.junit.Test)8 StageIdentifier (com.thoughtworks.go.domain.StageIdentifier)6 FailingTestsInPipeline (com.thoughtworks.go.domain.testinfo.FailingTestsInPipeline)6 Pipeline (com.thoughtworks.go.domain.Pipeline)2 TestInformation (com.thoughtworks.go.domain.testinfo.TestInformation)2 TestSuite (com.thoughtworks.go.domain.testinfo.TestSuite)2 Stage (com.thoughtworks.go.domain.Stage)1 Modification (com.thoughtworks.go.domain.materials.Modification)1 JunitXML (com.thoughtworks.studios.shine.cruise.builder.JunitXML)1 Date (java.util.Date)1