Search in sources :

Example 21 with BuildTypeImpl

use of jetbrains.buildServer.serverSide.impl.BuildTypeImpl in project teamcity-rest by JetBrains.

the class TestScopesCollectorTest method testCanGetClasses.

@Test
public void testCanGetClasses() {
    final BuildTypeImpl buildType = registerBuildType("buildConf1", "project");
    final SFinishedBuild build10 = build().in(buildType).withTest("packageA.class1.aaa", true).withTest("packageA.class2.bbb", true).withTest("packageB.class1.ccc", true).withTest("packageB.class2.ddd", true).finish();
    String locator = "scopeType:class,testOccurrences:(build:(id:" + build10.getBuildId() + "))";
    PagedSearchResult<TestScope> result = myTestScopesCollector.getPagedItems(Locator.locator(locator));
    assertEquals("Although there are only class1 and class 2, packageA.classX and packageB.classX are expected to be different", 4, result.myEntries.size());
    Set<String> classes = result.myEntries.stream().peek(scope -> assertEquals(1, scope.getTestRuns().size())).peek(scope -> scope.getName().equals(scope.getClass1())).map(scope -> scope.getClass1()).collect(Collectors.toSet());
    assertContains(classes, "class1", "class2");
}
Also used : TestScope(jetbrains.buildServer.server.rest.data.problem.scope.TestScope) BuildTypeImpl(jetbrains.buildServer.serverSide.impl.BuildTypeImpl) Set(java.util.Set) Test(org.testng.annotations.Test) Collectors(java.util.stream.Collectors) SFinishedBuild(jetbrains.buildServer.serverSide.SFinishedBuild) SFinishedBuild(jetbrains.buildServer.serverSide.SFinishedBuild) TestScope(jetbrains.buildServer.server.rest.data.problem.scope.TestScope) BuildTypeImpl(jetbrains.buildServer.serverSide.impl.BuildTypeImpl) Test(org.testng.annotations.Test)

Example 22 with BuildTypeImpl

use of jetbrains.buildServer.serverSide.impl.BuildTypeImpl in project teamcity-rest by JetBrains.

the class ChangeStatusTest method testSomeNewFailedTests.

public void testSomeNewFailedTests() {
    final BuildTypeImpl buildConf = registerBuildType("buildConf1", "project");
    VcsRootInstance root1 = prepareSingleVscRoot(buildConf);
    SVcsModification m20 = myFixture.addModification(modification().in(root1).version("20").parentVersions("10"));
    SVcsModification m30 = myFixture.addModification(modification().in(root1).version("30").parentVersions("20"));
    build().in(buildConf).onModifications(m20).withFailedTests("failedTestName").finish();
    // same test failed
    build().in(buildConf).onModifications(m30).withFailedTests("failedTestName", "newFailedTestName").finish();
    ChangeStatus status = new ChangeStatus(myFixture.getChangeStatusProvider().getMergedChangeStatus(m30), Fields.ALL_NESTED, getBeanContext(myFixture));
    assertEquals(1, (int) status.getFinished());
    assertEquals(0, (int) status.getSuccessful());
    assertEquals(1, (int) status.getFailed());
    assertEquals(1, (int) status.getNewFailedTests());
    assertEquals(1, (int) status.getOtherFailedTests());
    assertEquals(1, (int) status.getNewTestsFailedBuilds().count);
}
Also used : SVcsModification(jetbrains.buildServer.vcs.SVcsModification) ChangeStatus(jetbrains.buildServer.server.rest.model.change.ChangeStatus) BuildTypeImpl(jetbrains.buildServer.serverSide.impl.BuildTypeImpl) VcsRootInstance(jetbrains.buildServer.vcs.VcsRootInstance)

Example 23 with BuildTypeImpl

use of jetbrains.buildServer.serverSide.impl.BuildTypeImpl in project teamcity-rest by JetBrains.

the class ChangeStatusTest method testNoNewFailedTests.

public void testNoNewFailedTests() {
    final BuildTypeImpl buildConf = registerBuildType("buildConf1", "project");
    VcsRootInstance root1 = prepareSingleVscRoot(buildConf);
    SVcsModification m20 = myFixture.addModification(modification().in(root1).version("20").parentVersions("10"));
    SVcsModification m30 = myFixture.addModification(modification().in(root1).version("30").parentVersions("20"));
    build().in(buildConf).onModifications(m20).withFailedTests("failedTestName").finish();
    // same test failed
    build().in(buildConf).onModifications(m30).withFailedTests("failedTestName").finish();
    ChangeStatus status = new ChangeStatus(myFixture.getChangeStatusProvider().getMergedChangeStatus(m30), Fields.ALL_NESTED, getBeanContext(myFixture));
    assertEquals(1, (int) status.getFinished());
    assertEquals(0, (int) status.getSuccessful());
    assertEquals(1, (int) status.getFailed());
    assertEquals(0, (int) status.getNewFailedTests());
    assertEquals(1, (int) status.getOtherFailedTests());
    assertEquals(0, (int) status.getNewTestsFailedBuilds().count);
}
Also used : SVcsModification(jetbrains.buildServer.vcs.SVcsModification) ChangeStatus(jetbrains.buildServer.server.rest.model.change.ChangeStatus) BuildTypeImpl(jetbrains.buildServer.serverSide.impl.BuildTypeImpl) VcsRootInstance(jetbrains.buildServer.vcs.VcsRootInstance)

Example 24 with BuildTypeImpl

use of jetbrains.buildServer.serverSide.impl.BuildTypeImpl in project teamcity-rest by JetBrains.

the class ChangeStatusTest method testSuccessfulRunning.

public void testSuccessfulRunning() {
    final BuildTypeImpl buildConf = registerBuildType("buildConf1", "project");
    VcsRootInstance root1 = prepareSingleVscRoot(buildConf);
    SVcsModification m20 = myFixture.addModification(modification().in(root1).version("20").parentVersions("10"));
    RunningBuildEx runningBuildEx = build().in(buildConf).onModifications(m20).run();
    ChangeStatus status = new ChangeStatus(myFixture.getChangeStatusProvider().getMergedChangeStatus(m20), Fields.ALL_NESTED, getBeanContext(myFixture));
    myFixture.finishBuild(runningBuildEx, false);
    assertEquals(0, (int) status.getFinished());
    assertEquals(1, (int) status.getRunning());
    assertEquals(0, (int) status.getSuccessful());
    assertEquals(1, (int) status.getRunningSuccessfuly());
}
Also used : SVcsModification(jetbrains.buildServer.vcs.SVcsModification) RunningBuildEx(jetbrains.buildServer.serverSide.RunningBuildEx) ChangeStatus(jetbrains.buildServer.server.rest.model.change.ChangeStatus) BuildTypeImpl(jetbrains.buildServer.serverSide.impl.BuildTypeImpl) VcsRootInstance(jetbrains.buildServer.vcs.VcsRootInstance)

Example 25 with BuildTypeImpl

use of jetbrains.buildServer.serverSide.impl.BuildTypeImpl in project teamcity-rest by JetBrains.

the class ChangeFinderTest method buildVcsRootInstance.

@NotNull
private VcsRootInstance buildVcsRootInstance() {
    final BuildTypeImpl buildConf = registerBuildType("buildConf1", "project");
    MockVcsSupport vcs = new MockVcsSupport("vcs");
    myFixture.getVcsManager().registerVcsSupport(vcs);
    SVcsRootEx parentRoot1 = myFixture.addVcsRoot(vcs.getName(), "", buildConf);
    VcsRootInstance root1 = buildConf.getVcsRootInstanceForParent(parentRoot1);
    assert root1 != null;
    return root1;
}
Also used : MockVcsSupport(jetbrains.buildServer.serverSide.impl.MockVcsSupport) BuildTypeImpl(jetbrains.buildServer.serverSide.impl.BuildTypeImpl) NotNull(org.jetbrains.annotations.NotNull)

Aggregations

BuildTypeImpl (jetbrains.buildServer.serverSide.impl.BuildTypeImpl)80 Test (org.testng.annotations.Test)68 BaseFinderTest (jetbrains.buildServer.server.rest.data.BaseFinderTest)19 BadRequestException (jetbrains.buildServer.server.rest.errors.BadRequestException)12 ChangeStatus (jetbrains.buildServer.server.rest.model.change.ChangeStatus)12 SVcsModification (jetbrains.buildServer.vcs.SVcsModification)12 VcsRootInstance (jetbrains.buildServer.vcs.VcsRootInstance)12 SUser (jetbrains.buildServer.users.SUser)11 MockVcsSupport (jetbrains.buildServer.serverSide.impl.MockVcsSupport)10 SFinishedBuild (jetbrains.buildServer.serverSide.SFinishedBuild)9 TestOccurrence (jetbrains.buildServer.server.rest.model.problem.TestOccurrence)7 ProjectEx (jetbrains.buildServer.serverSide.impl.ProjectEx)7 TestFor (jetbrains.buildServer.util.TestFor)7 BuildPromotionEx (jetbrains.buildServer.serverSide.BuildPromotionEx)6 TestOccurrences (jetbrains.buildServer.server.rest.model.problem.TestOccurrences)5 RunningBuildEx (jetbrains.buildServer.serverSide.RunningBuildEx)5 Set (java.util.Set)4 Collectors (java.util.stream.Collectors)4 FakeHttpServletRequest (jetbrains.buildServer.controllers.fakes.FakeHttpServletRequest)4 TestScope (jetbrains.buildServer.server.rest.data.problem.scope.TestScope)4