Search in sources :

Example 6 with StageTestRuns

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

the class ShineDao method failedBuildHistoryForStage.

public StageTestRuns failedBuildHistoryForStage(StageIdentifier stageId, LocalizedOperationResult result) {
    try {
        StageTestRuns stageTestRuns = getTestCount(stageId);
        List<StageIdentifier> failedStageIds = stageService.findRunForStage(stageId);
        populateFailingTests(stageTestRuns, getFailedTests(failedStageIds));
        populateUsers(stageTestRuns, getCommitters(failedStageIds));
        stageTestRuns.removeDuplicateTestEntries();
        return stageTestRuns;
    } catch (RuntimeException e) {
        LOGGER.error("can not retrieve shine test history!", e);
        result.connectionError(LocalizedMessage.unableToRetrieveFailureResults());
        return new StageTestRuns(0, 0, 0);
    }
}
Also used : StageIdentifier(com.thoughtworks.go.domain.StageIdentifier) StageTestRuns(com.thoughtworks.go.domain.testinfo.StageTestRuns)

Example 7 with StageTestRuns

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

the class ShineDaoIntegrationTest method shouldContainLocatorForFailedJob.

@Test
public void shouldContainLocatorForFailedJob() throws Exception {
    StageTestRuns stageTestRuns = failingStageHistory();
    List<FailingTestsInPipeline> failingTestsInPipelines = stageTestRuns.failingTestsInPipelines();
    FailingTestsInPipeline failingPipeline7 = failingTestsInPipelines.get(0);
    FailingTestsInPipeline failingPipeline6 = failingTestsInPipelines.get(1);
    List<TestInformation> failingTests7 = failingPipeline7.failingSuites().get(0).tests();
    assertThat(failingTests7.size(), is(1));
    assertThat(failingTests7.get(0).getJobs().size(), is(2));
    assertThat(failingTests7.get(0).getJobs().get(0).getBuildName(), is("NixBuild"));
    assertThat(failingTests7.get(0).getJobs().get(0).buildLocator(), is("foo-pipeline/3/bar-stage/1/NixBuild"));
    assertThat(failingTests7.get(0).getJobs().get(1).buildLocator(), is("foo-pipeline/3/bar-stage/1/WinBuild"));
    List<TestInformation> failingTests6 = failingPipeline6.failingSuites().get(0).tests();
    assertThat(failingTests6.size(), is(2));
    assertThat(failingTests6.get(0).getJobs().size(), is(1));
    assertThat(failingTests6.get(0).getJobs().get(0).getBuildName(), is("WinBuild"));
    assertThat(failingTests6.get(0).getJobs().get(0).buildLocator(), is("foo-pipeline/2/bar-stage/1/WinBuild"));
    assertThat(failingTests6.get(1).getJobs().size(), is(1));
    assertThat(failingTests6.get(1).getJobs().get(0).getBuildName(), is("WinBuild"));
    assertThat(failingTests6.get(1).getJobs().get(0).buildLocator(), is("foo-pipeline/2/bar-stage/1/WinBuild"));
}
Also used : TestInformation(com.thoughtworks.go.domain.testinfo.TestInformation) StageTestRuns(com.thoughtworks.go.domain.testinfo.StageTestRuns) FailingTestsInPipeline(com.thoughtworks.go.domain.testinfo.FailingTestsInPipeline) Test(org.junit.Test)

Example 8 with StageTestRuns

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

the class ShineDaoIntegrationTest method shouldRetriveHistoricalFailureWithNoTests.

@Test
public void shouldRetriveHistoricalFailureWithNoTests() throws Exception {
    failureSetup.setupPipelineInstance(true, null, goURLRepository);
    StageIdentifier stageId3 = failureSetup.setupPipelineInstance(true, null, goURLRepository).stageId;
    StageTestRuns stageTestRuns = shineDao.failedBuildHistoryForStage(stageId3, result);
    List<FailingTestsInPipeline> failingTestsInPipelines = stageTestRuns.failingTestsInPipelines();
    assertThat(failingTestsInPipelines.size(), is(3));
}
Also used : StageIdentifier(com.thoughtworks.go.domain.StageIdentifier) StageTestRuns(com.thoughtworks.go.domain.testinfo.StageTestRuns) FailingTestsInPipeline(com.thoughtworks.go.domain.testinfo.FailingTestsInPipeline) Test(org.junit.Test)

Example 9 with StageTestRuns

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

the class ShineDaoIntegrationTest method shouldPopulateUsersThatTriggeredTheBuild.

@Test
public void shouldPopulateUsersThatTriggeredTheBuild() {
    StageTestRuns stageTestRuns = failingStageHistory();
    List<FailingTestsInPipeline> failingTestsInPipelines = stageTestRuns.failingTestsInPipelines();
    List<String> users = failingTestsInPipelines.get(1).users();
    assertThat(users.size(), is(2));
    assertThat(users, hasItem("fooUser"));
    assertThat(users, hasItem("RRR & DR"));
    assertThat(users.size(), is(2));
    users = failingTestsInPipelines.get(0).users();
    assertThat(users.size(), is(1));
    assertThat(users, hasItem("blahUser"));
}
Also used : StageTestRuns(com.thoughtworks.go.domain.testinfo.StageTestRuns) FailingTestsInPipeline(com.thoughtworks.go.domain.testinfo.FailingTestsInPipeline) Test(org.junit.Test)

Example 10 with StageTestRuns

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

the class ShineDaoIntegrationTest method shouldBeAbleToRetriveStageTestRunsWithLazyGraphLoader.

@Test
public void shouldBeAbleToRetriveStageTestRunsWithLazyGraphLoader() throws Exception {
    StageTestRuns stageTestRuns = shineDao.failedBuildHistoryForStage(stageId, result);
    List<FailingTestsInPipeline> failingTestsInPipelines = stageTestRuns.failingTestsInPipelines();
    assertThat(failingTestsInPipelines.toString(), failingTestsInPipelines.size(), is(1));
    List<TestSuite> suites = failingTestsInPipelines.get(0).failingSuites();
    assertThat(suites.size(), is(1));
    assertThat(suites.get(0).fullName(), is("testSuite1"));
    List<TestInformation> tests = suites.get(0).tests();
    assertThat(tests.size(), is(2));
    assertThat(tests.get(0).getName(), is("test1"));
    assertThat(tests.get(0).getStatus(), is(TestStatus.Failure));
    assertThat(tests.get(0).getJobNames(), hasItems("NixBuild", "WinBuild"));
    assertThat(tests.get(1).getName(), is("test2"));
    assertThat(tests.get(1).getStatus(), is(TestStatus.Error));
    assertThat(tests.get(1).getJobNames(), hasItems("WinBuild"));
}
Also used : TestInformation(com.thoughtworks.go.domain.testinfo.TestInformation) TestSuite(com.thoughtworks.go.domain.testinfo.TestSuite) StageTestRuns(com.thoughtworks.go.domain.testinfo.StageTestRuns) FailingTestsInPipeline(com.thoughtworks.go.domain.testinfo.FailingTestsInPipeline) 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