Search in sources :

Example 26 with JobIdentifier

use of com.thoughtworks.go.domain.JobIdentifier in project gocd by gocd.

the class FailingTestsInPipelineTest method shouldOrderSuitesAlphabetically.

@Test
public void shouldOrderSuitesAlphabetically() throws Exception {
    failingTests.add("suiteB", "testA", TestStatus.Error, new JobIdentifier("", -1, "", "", "", "job-1"));
    failingTests.add("suiteA", "testA", TestStatus.Error, new JobIdentifier("", -1, "", "", "", "job-1"));
    failingTests.add("suiteZ", "testA", TestStatus.Error, new JobIdentifier("", -1, "", "", "", "job-1"));
    failingTests.add("suiteD", "testA", TestStatus.Error, new JobIdentifier("", -1, "", "", "", "job-1"));
    List<TestSuite> suites = failingTests.failingSuites();
    assertThat(suites.size(), is(4));
    assertThat(suites.get(0).fullName(), is("suiteA"));
    assertThat(suites.get(1).fullName(), is("suiteB"));
    assertThat(suites.get(2).fullName(), is("suiteD"));
    assertThat(suites.get(3).fullName(), is("suiteZ"));
}
Also used : JobIdentifier(com.thoughtworks.go.domain.JobIdentifier) Test(org.junit.Test)

Example 27 with JobIdentifier

use of com.thoughtworks.go.domain.JobIdentifier in project gocd by gocd.

the class StageTestRunsTest method removeDuplicateTestEntriesFromNonAdjacentRuns.

@Test
public void removeDuplicateTestEntriesFromNonAdjacentRuns() throws Exception {
    StageTestRuns stageTestRuns = new StageTestRuns(999, 0, 0);
    JobIdentifier jobIdentifier = new JobIdentifier(null, 1, null, null, null, "job1");
    stageTestRuns.add(10, "1.0", "suite1", "test1-2", TestStatus.Failure, jobIdentifier);
    stageTestRuns.add(10, "1.0", "suite1", "test1-1", TestStatus.Error, jobIdentifier);
    stageTestRuns.add(11, "1.1", "suite1", "test1-1", TestStatus.Error, jobIdentifier);
    stageTestRuns.add(9, "0.9", "suite1", "test1-2", TestStatus.Failure, jobIdentifier);
    stageTestRuns.removeDuplicateTestEntries();
    FailingTestsInPipeline pipeline10 = stageTestRuns.failingTestsInPipelines().get(0);
    FailingTestsInPipeline pipeline11 = stageTestRuns.failingTestsInPipelines().get(1);
    FailingTestsInPipeline pipeline09 = stageTestRuns.failingTestsInPipelines().get(2);
    assertThat(pipeline10.failingSuites().size(), is(1));
    assertThat(pipeline10.failingSuites().get(0).tests().size(), is(1));
    assertThat(pipeline11.failingSuites().size(), is(1));
    assertThat(pipeline11.failingSuites().get(0).tests().size(), is(1));
    assertThat(pipeline09.failingSuites().size(), is(0));
}
Also used : JobIdentifier(com.thoughtworks.go.domain.JobIdentifier) Test(org.junit.Test)

Example 28 with JobIdentifier

use of com.thoughtworks.go.domain.JobIdentifier in project gocd by gocd.

the class StageTestRunsTest method removeDuplicateTestEntriesShouldRemoveFailuresThatHaveBeenFixedInSubsequentPipelines.

@Test
public void removeDuplicateTestEntriesShouldRemoveFailuresThatHaveBeenFixedInSubsequentPipelines() throws Exception {
    StageTestRuns stageTestRuns = new StageTestRuns(999, 0, 0);
    JobIdentifier jobIdentifier = new JobIdentifier(null, 1, null, null, null, "job1");
    stageTestRuns.add(18, "1.8", "testSuite1", "testName0", TestStatus.Failure, jobIdentifier);
    stageTestRuns.add(17, "1.7", "testSuite1", "testName0", TestStatus.Failure, jobIdentifier);
    stageTestRuns.add(17, "1.7", "testSuite1", "testName1", TestStatus.Failure, jobIdentifier);
    stageTestRuns.removeDuplicateTestEntries();
    assertThat(stageTestRuns.failingTestsInPipelines().size(), is(2));
    FailingTestsInPipeline pipeline8 = stageTestRuns.failingTestsInPipelines().get(0);
    FailingTestsInPipeline pipeline7 = stageTestRuns.failingTestsInPipelines().get(1);
    assertThat(pipeline8.failingSuites().size(), is(0));
    assertThat(pipeline7.failingSuites().size(), is(1));
    assertThat(pipeline7.failingSuites().get(0).tests().size(), is(1));
    assertThat(pipeline7.failingSuites().get(0).tests().get(0).getName(), is("testName0"));
}
Also used : JobIdentifier(com.thoughtworks.go.domain.JobIdentifier) Test(org.junit.Test)

Example 29 with JobIdentifier

use of com.thoughtworks.go.domain.JobIdentifier in project gocd by gocd.

the class StageTestRunsTest method shouldReturnTheTotalNumberOfErrorsAndFailuresRollingUpFailuresInMultipleJobsToSingleFailure.

@Test
public void shouldReturnTheTotalNumberOfErrorsAndFailuresRollingUpFailuresInMultipleJobsToSingleFailure() throws Exception {
    StageTestRuns stageTestRuns = new StageTestRuns(999, 3, 2);
    JobIdentifier jobIdentifier1 = new JobIdentifier(null, 1, null, null, null, "job1");
    JobIdentifier jobIdentifier2 = new JobIdentifier(null, 1, null, null, null, "job2");
    stageTestRuns.add(18, "lbl", "testSuite1", "testName1", TestStatus.Failure, jobIdentifier1);
    stageTestRuns.add(18, "lbl", "testSuite1", "testName1", TestStatus.Failure, jobIdentifier2);
    stageTestRuns.add(18, "lbl", "testSuite1", "testName2", TestStatus.Error, jobIdentifier1);
    stageTestRuns.add(18, "lbl", "testSuite1", "testName3", TestStatus.Failure, jobIdentifier1);
    stageTestRuns.add(18, "lbl", "testSuite1", "testName4", TestStatus.Error, jobIdentifier1);
    stageTestRuns.add(18, "lbl", "testSuite1", "testName5", TestStatus.Failure, jobIdentifier1);
    stageTestRuns.add(17, "lbl", "testSuite1", "testName4", TestStatus.Error, jobIdentifier1);
    stageTestRuns.add(17, "lbl", "testSuite1", "testName5", TestStatus.Failure, jobIdentifier1);
    stageTestRuns.add(16, "lbl", "testSuite1", "testName6", TestStatus.Failure, jobIdentifier1);
    stageTestRuns.removeDuplicateTestEntries();
    assertThat(stageTestRuns.count(TestStatus.Error), is(2));
    assertThat(stageTestRuns.count(TestStatus.Failure), is(3));
}
Also used : JobIdentifier(com.thoughtworks.go.domain.JobIdentifier) Test(org.junit.Test)

Example 30 with JobIdentifier

use of com.thoughtworks.go.domain.JobIdentifier in project gocd by gocd.

the class StageTestRunsTest method shouldReturnAllPipelineCounters.

@Test
public void shouldReturnAllPipelineCounters() throws Exception {
    StageTestRuns stageTestRuns = new StageTestRuns(999, 0, 0);
    JobIdentifier jobIdentifier = new JobIdentifier(null, 1, null, null, null, "job1");
    stageTestRuns.add(18, "1.8", "testSuite1", "testName1", TestStatus.Failure, jobIdentifier);
    stageTestRuns.add(17, "1.7", "testSuite1", "testName1", TestStatus.Failure, jobIdentifier);
    stageTestRuns.add(16, "1.6", "testSuite1", "testName1", TestStatus.Failure, jobIdentifier);
    stageTestRuns.removeDuplicateTestEntries();
    assertThat(stageTestRuns.failingCounters(), is(Arrays.asList(16, 17, 18)));
}
Also used : JobIdentifier(com.thoughtworks.go.domain.JobIdentifier) Test(org.junit.Test)

Aggregations

JobIdentifier (com.thoughtworks.go.domain.JobIdentifier)100 Test (org.junit.Test)74 JobInstance (com.thoughtworks.go.domain.JobInstance)17 Pipeline (com.thoughtworks.go.domain.Pipeline)16 File (java.io.File)15 DateTime (org.joda.time.DateTime)12 Stage (com.thoughtworks.go.domain.Stage)9 Before (org.junit.Before)8 StageIdentifier (com.thoughtworks.go.domain.StageIdentifier)6 CoreMatchers.containsString (org.hamcrest.CoreMatchers.containsString)6 CaseInsensitiveString (com.thoughtworks.go.config.CaseInsensitiveString)5 LogFile (com.thoughtworks.go.server.domain.LogFile)5 IllegalArtifactLocationException (com.thoughtworks.go.domain.exception.IllegalArtifactLocationException)4 Property (com.thoughtworks.go.domain.Property)3 Username (com.thoughtworks.go.server.domain.Username)3 IOException (java.io.IOException)3 Expectations (org.jmock.Expectations)3 RunIf (com.googlecode.junit.ext.RunIf)2 Tabs (com.thoughtworks.go.config.Tabs)2 Properties (com.thoughtworks.go.domain.Properties)2