Search in sources :

Example 16 with BuildTypeImpl

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

the class TestOccurrenceFinderTest method testTestFromOtherUsersPersonalBuildTestRunId.

@Test
public void testTestFromOtherUsersPersonalBuildTestRunId() {
    final BuildTypeImpl buildType = registerBuildType("buildConf1", "project");
    SUser user = myFixture.createUserAccount("andrey");
    final SFinishedBuild personalBuild = build().in(buildType).personalForUser(user.getUsername()).withTest(BuildBuilder.TestData.test("aaa")).finish();
    int testRunId = personalBuild.getBuildStatistics(BuildStatisticsOptions.ALL_TESTS_NO_DETAILS).getAllTests().get(0).getTestRunId();
    TestRunDataWithBuild personalRun = t("aaa", Status.NORMAL, 1, personalBuild.getBuildId());
    check(String.format("id:%d,build:%d", testRunId, personalBuild.getBuildId()), TEST_MATCHER, personalRun);
}
Also used : SUser(jetbrains.buildServer.users.SUser) BuildTypeImpl(jetbrains.buildServer.serverSide.impl.BuildTypeImpl) Test(org.testng.annotations.Test)

Example 17 with BuildTypeImpl

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

the class TestOccurrenceFinderTest method testBuildDimension.

@Test
public void testBuildDimension() throws Exception {
    final BuildTypeImpl buildType = registerBuildType("buildConf1", "project");
    final SFinishedBuild build10 = build().in(buildType).withTest("aaa", true).withTest("aaa", true).withTest("bbb", true).withTest("ccc", false).withTest("bbb", true).withTest("aaa", false).withTest("aaa", true).withTest("ddd", true).finish();
    final SFinishedBuild build20 = build().in(buildType).withTest("xxx", true).withTest("aaa", true).finish();
    check("build:(id:" + build10.getBuildId() + ")", TEST_WITH_BUILD_MATCHER, t("aaa", Status.FAILURE, 1, build10.getBuildId()), t("bbb", Status.NORMAL, 3, build10.getBuildId()), t("ccc", Status.FAILURE, 4, build10.getBuildId()), t("ddd", Status.NORMAL, 8, build10.getBuildId()));
    check("build:(item:(id:" + build10.getBuildId() + "),item:(id:" + build20.getBuildId() + "))", TEST_WITH_BUILD_MATCHER, t("aaa", Status.FAILURE, 1, build10.getBuildId()), t("bbb", Status.NORMAL, 3, build10.getBuildId()), t("ccc", Status.FAILURE, 4, build10.getBuildId()), t("ddd", Status.NORMAL, 8, build10.getBuildId()), t("xxx", Status.NORMAL, 1, build20.getBuildId()), t("aaa", Status.NORMAL, 2, build20.getBuildId()));
}
Also used : BuildTypeImpl(jetbrains.buildServer.serverSide.impl.BuildTypeImpl) Test(org.testng.annotations.Test)

Example 18 with BuildTypeImpl

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

the class TestScopesCollectorTest method testCanGetSuites.

@Test
public void testCanGetSuites() {
    final BuildTypeImpl buildType = registerBuildType("buildConf1", "project");
    final SFinishedBuild build10 = build().in(buildType).startSuite("suite1").withTest("packageA.class1.aaa", true).withTest("packageA.class2.bbb", true).endSuite().startSuite("suite2").withTest("packageB.class1.ccc", true).withTest("packageB.class2.ddd", true).endSuite().finish();
    PagedSearchResult<TestScope> result = myTestScopesCollector.getPagedItems(Locator.createPotentiallyEmptyLocator("testOccurrences:(build:(id:" + build10.getBuildId() + ")),scopeType:suite"));
    for (TestScope scope : result.myEntries) {
        assertEquals(2, scope.getTestRuns().size());
    }
    Set<String> suites = result.myEntries.stream().peek(scope -> assertEquals(2, scope.getTestRuns().size())).peek(scope -> scope.getName().equals(scope.getSuite())).map(scope -> scope.getSuite()).collect(Collectors.toSet());
    assertEquals(2, suites.size());
    assertContains(suites, "suite1: ", "suite2: ");
}
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 19 with BuildTypeImpl

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

the class TestScopesCollectorTest method testCanFilterSuites.

@Test
public void testCanFilterSuites() {
    final BuildTypeImpl buildType = registerBuildType("buildConf1", "project");
    final SFinishedBuild build10 = build().in(buildType).startSuite("suite1").withTest("packageA.class1.aaa", true).withTest("packageA.class2.bbb", true).endSuite().startSuite("suite2").withTest("packageB.class1.ccc", true).withTest("packageB.class2.ddd", true).endSuite().finish();
    // $base64:c3VpdGUxOiA= is a base64 representation of a string 'suite1: '
    PagedSearchResult<TestScope> result = myTestScopesCollector.getPagedItems(Locator.createPotentiallyEmptyLocator("testOccurrences:(build:(id:" + build10.getBuildId() + ")),scopeType:suite,suite:(value:($base64:c3VpdGUxOiA=),matchType:equals)"));
    assertEquals(1, result.myEntries.size());
    assertEquals("suite1: ", result.myEntries.get(0).getName());
}
Also used : 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 20 with BuildTypeImpl

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

the class TestScopesCollectorTest method testCanGetPackages.

@Test
public void testCanGetPackages() {
    final BuildTypeImpl buildType = registerBuildType("buildConf1", "project");
    final SFinishedBuild build10 = build().in(buildType).withTest("package1.class1.aaa", true).withTest("package2.class2.bbb", true).withTest("package3.class1.ccc", true).withTest("package4.class2.ddd", true).finish();
    String locator = "scopeType:package,testOccurrences:(build:(id:" + build10.getBuildId() + "))";
    PagedSearchResult<TestScope> result = myTestScopesCollector.getPagedItems(Locator.locator(locator));
    assertEquals(4, result.myEntries.size());
    Set<String> packages = result.myEntries.stream().peek(scope -> assertEquals(1, scope.getTestRuns().size())).peek(scope -> scope.getName().equals(scope.getPackage())).map(scope -> scope.getPackage()).collect(Collectors.toSet());
    for (int i = 1; i <= 4; i++) {
        assertTrue(packages.contains("package" + i));
    }
}
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)

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