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);
}
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));
}
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));
}
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));
}
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));
}
Aggregations