Search in sources :

Example 11 with BuildTypeImpl

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

the class TestOccurrenceFinderTest method testByTest.

@Test
public void testByTest() throws Exception {
    final BuildTypeImpl buildType = registerBuildType("buildConf1", "project");
    final SFinishedBuild build10 = build().in(buildType).withTest("aaa", false).withTest("bbb", true).withTest("ccc", false).finish();
    check("build:(id:" + build10.getBuildId() + ")", TEST_MATCHER, t("aaa", Status.FAILURE, 1), t("bbb", Status.NORMAL, 2), t("ccc", Status.FAILURE, 3));
    check("build:(id:" + build10.getBuildId() + "),test:(name:missingTest)", TEST_MATCHER);
    check("build:(id:" + build10.getBuildId() + "),test:(name:bbb)", TEST_MATCHER, t("bbb", Status.NORMAL, 2));
    check("build:(id:" + build10.getBuildId() + "),test:(currentlyFailing:true)", TEST_MATCHER, t("aaa", Status.FAILURE, 1), t("ccc", Status.FAILURE, 3));
}
Also used : BuildTypeImpl(jetbrains.buildServer.serverSide.impl.BuildTypeImpl) Test(org.testng.annotations.Test)

Example 12 with BuildTypeImpl

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

the class TestOccurrenceFinderTest method testScopeFilter.

@Test
public void testScopeFilter() {
    final BuildTypeImpl buildType = registerBuildType("buildConf1", "project");
    final SFinishedBuild build10 = build().in(buildType).withTest("package1.class1.aaa", true).withTest("package1.class2.bbb", true).withTest("package2.class1.ccc", true).withTest("package2.class2.ddd", true).finish();
    check("build:(id:" + build10.getBuildId() + "),scope:(package:(value:(package1),matchType:equals))", TEST_MATCHER, t("package1.class1.aaa", Status.NORMAL, 1), t("package1.class2.bbb", Status.NORMAL, 2));
    check("build:(id:" + build10.getBuildId() + "),scope:(class:(value:(class2),matchType:equals))", TEST_MATCHER, t("package1.class2.bbb", Status.NORMAL, 2), t("package2.class2.ddd", Status.NORMAL, 4));
}
Also used : BuildTypeImpl(jetbrains.buildServer.serverSide.impl.BuildTypeImpl) Test(org.testng.annotations.Test)

Example 13 with BuildTypeImpl

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

the class TestOccurrenceFinderTest method testByTestNameCondition.

@Test
public void testByTestNameCondition() throws Exception {
    final BuildTypeImpl buildType = registerBuildType("buildConf1", "project");
    final SFinishedBuild build10 = build().in(buildType).withTest("aaabbb", true).withTest("aaa", true).withTest("AAA", true).withTest("bbb", true).withTest("(aaabbb)", true).finish();
    int idx = 1;
    check("build:(id:" + build10.getBuildId() + "),expandInvocations:true", TEST_MATCHER, t("aaabbb", Status.NORMAL, idx++), t("aaa", Status.NORMAL, idx++), t("AAA", Status.NORMAL, idx++), t("bbb", Status.NORMAL, idx++), t("(aaabbb)", Status.NORMAL, idx++));
    Checker test = new Checker<TestRunData, String>(nameDimension -> "build:(id:" + build10.getBuildId() + "),test:(build:(id:" + build10.getBuildId() + "),name:" + nameDimension + ")", testName -> t(testName, Status.NORMAL, null), TEST_MATCHER);
    test.check("aaa", "aaa");
    test.check("aa");
    test.check("(value:aaa)", "aaa");
    test.check("(value:aaa,ignoreCase:true)", "aaa", "AAA");
    test.check("(value:aaa,matchType:starts-with)", "aaabbb", "aaa");
    test.check("(value:ab,matchType:contains)", "aaabbb", "(aaabbb)");
}
Also used : BuildTypeImpl(jetbrains.buildServer.serverSide.impl.BuildTypeImpl) Test(org.testng.annotations.Test)

Example 14 with BuildTypeImpl

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

the class TestOccurrenceFinderTest method testShortStatisticsIsEnoughWhenTestCountersRequested.

@Test
public void testShortStatisticsIsEnoughWhenTestCountersRequested() {
    final BuildTypeImpl buildType = registerBuildType("buildConf1", "project");
    final SFinishedBuild build = createBuildWithSuccessFailedIgnoredTests(buildType);
    assertNotNull("Retrieving counters should be done via short statistics.", myTestOccurrenceFinder.tryGetCachedInfo("build:" + build.getBuildId(), "testCounters(all,success,failed,newFailed,ignored,muted,duration)").getShortStatistics());
}
Also used : BuildTypeImpl(jetbrains.buildServer.serverSide.impl.BuildTypeImpl) Test(org.testng.annotations.Test)

Example 15 with BuildTypeImpl

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

the class TestOccurrenceFinderTest method testBasic.

@Test
public void testBasic() throws Exception {
    final BuildTypeImpl buildType = registerBuildType("buildConf1", "project");
    final SFinishedBuild build10 = build().in(buildType).withTest("aaa", true).finish();
    checkExceptionOnItemSearch(BadRequestException.class, "No_match");
    checkExceptionOnItemsSearch(BadRequestException.class, "No_match");
    check("build:(id:" + build10.getBuildId() + ")", build10.getFullStatistics().getAllTests().get(0));
    check("build:(id:" + build10.getBuildId() + ")", TEST_MATCHER, t("aaa", Status.NORMAL, 1));
    int testRunId = build10.getFullStatistics().getAllTests().get(0).getTestRunId();
    check("build:(id:" + build10.getBuildId() + "),id:" + testRunId, TEST_MATCHER, t("aaa", Status.NORMAL, 1));
    checkExceptionOnItemSearch(BadRequestException.class, "id:" + testRunId);
    checkExceptionOnItemsSearch(BadRequestException.class, "id:" + testRunId);
    check("build:(id:" + build10.getBuildId() + "),id:" + testRunId + 1);
    check("build:(id:" + build10.getBuildId() + "),test:(name:aaa)", TEST_MATCHER, t("aaa", Status.NORMAL, 1));
    check("build:(id:" + build10.getBuildId() + "),test:(name:bbb)");
}
Also used : 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