use of jetbrains.buildServer.serverSide.impl.BuildTypeImpl in project teamcity-rest by JetBrains.
the class TestOccurrenceFinderTest method testShortStatisticsIsNotEnoughWhenNoFieldsGiven.
@Test
@TestFor(issues = { "TW-71738" })
public void testShortStatisticsIsNotEnoughWhenNoFieldsGiven() {
final BuildTypeImpl buildType = registerBuildType("buildConf1", "project");
final SFinishedBuild build = createBuildWithSuccessFailedIgnoredTests(buildType);
assertNull("When fields are not given we can't use short statistics", myTestOccurrenceFinder.tryGetCachedInfo("build:" + build.getBuildId(), null).getShortStatistics());
}
use of jetbrains.buildServer.serverSide.impl.BuildTypeImpl in project teamcity-rest by JetBrains.
the class TestOccurrenceFinderTest method testByTestOccurrenceNameCondition.
@Test
public void testByTestOccurrenceNameCondition() 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() + "),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)");
test.check("(value:(aa),matchType:contains)", "aaabbb", "aaa", "(aaabbb)");
}
use of jetbrains.buildServer.serverSide.impl.BuildTypeImpl in project teamcity-rest by JetBrains.
the class TestOccurrenceFinderTest method testTestOccurrenceEntityInvocations.
@Test
public void testTestOccurrenceEntityInvocations() 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();
STestRun testRunAAA = build10.getFullStatistics().getAllTests().get(0);
{
TestOccurrence testOccurrence = new TestOccurrence(testRunAAA, getBeanContext(myServer), new Fields("invocations($long)"));
assertEquals(Integer.valueOf(4), testOccurrence.getInvocations().getCount());
assertEquals(Integer.valueOf(1), testOccurrence.getInvocations().getFailed());
assertNotNull(testOccurrence.getInvocations().items);
assertEquals(4, testOccurrence.getInvocations().items.size());
assertEquals("SUCCESS", testOccurrence.getInvocations().items.get(0).getStatus());
assertEquals("FAILURE", testOccurrence.getInvocations().items.get(2).getStatus());
}
{
TestOccurrence testOccurrence = new TestOccurrence(testRunAAA, getBeanContext(myServer), new Fields("invocations($long,$locator(status:FAILURE))"));
assertEquals(Integer.valueOf(1), testOccurrence.getInvocations().getCount());
assertNotNull(testOccurrence.getInvocations().items);
assertEquals(1, testOccurrence.getInvocations().items.size());
assertEquals("FAILURE", testOccurrence.getInvocations().items.get(0).getStatus());
}
}
use of jetbrains.buildServer.serverSide.impl.BuildTypeImpl in project teamcity-rest by JetBrains.
the class TestOccurrenceFinderTest method testShortStatisticsIsNotEnoughWhenThereIsMoreThanOneBuildInRequest.
@Test
public void testShortStatisticsIsNotEnoughWhenThereIsMoreThanOneBuildInRequest() {
final BuildTypeImpl buildType = registerBuildType("buildConf1", "project");
final SFinishedBuild build1 = createBuildWithSuccessFailedIgnoredTests(buildType);
final SFinishedBuild build2 = createBuildWithSuccessFailedIgnoredTests(buildType);
assertNull("ShortStatistics can be used only if there is a single build.", myTestOccurrenceFinder.tryGetCachedInfo("build:(status:failed)", "count,passed,failed,newFailed,ignored,muted").getShortStatistics());
}
use of jetbrains.buildServer.serverSide.impl.BuildTypeImpl in project teamcity-rest by JetBrains.
the class TestOccurrenceFinderTest method testTestNameDetails.
@Test
public void testTestNameDetails() throws Exception {
final BuildTypeImpl buildType = registerBuildType("buildConf1", "project");
final SFinishedBuild build10 = build().in(buildType).withTest("com.jetbrains.teamcity.MyClass.method1", false).withTest("com.jetbrains.teamcity.MyClass.method2", true).finish();
check("build:(id:" + build10.getBuildId() + ")", TEST_MATCHER, t("com.jetbrains.teamcity.MyClass.method1", Status.FAILURE, 1), t("com.jetbrains.teamcity.MyClass.method2", Status.NORMAL, 2));
STestRun method1 = build10.getFullStatistics().getAllTests().get(0);
STestRun method2 = build10.getFullStatistics().getAllTests().get(1);
{
TestOccurrence testOccurrence = new TestOccurrence(method1, getBeanContext(myServer), new Fields("test(id,name)"));
// if we didn't ask for parsed test name - the object will be not filled
assertNull(testOccurrence.getTest().getParsedTestName());
}
{
TestOccurrence testOccurrence = new TestOccurrence(method1, getBeanContext(myServer), new Fields("test(id,name,parsedTestName)"));
assertNotNull(testOccurrence.getTest().getParsedTestName());
assertEquals("MyClass", testOccurrence.getTest().getParsedTestName().testClass);
assertEquals("method1", testOccurrence.getTest().getParsedTestName().testMethodName);
}
{
TestOccurrence testOccurrence = new TestOccurrence(method2, getBeanContext(myServer), new Fields("test(id,name,parsedTestName)"));
assertNotNull(testOccurrence.getTest().getParsedTestName());
assertEquals("MyClass", testOccurrence.getTest().getParsedTestName().testClass);
assertEquals("method2", testOccurrence.getTest().getParsedTestName().testMethodName);
}
}
Aggregations