use of jetbrains.buildServer.serverSide.SFinishedBuild in project teamcity-powershell by JetBrains.
the class BuildFailureTests method should_fail_syntax_error_cmd.
@Test(dataProvider = "supportedBitnessProvider")
public void should_fail_syntax_error_cmd(@NotNull final PowerShellBitness bitness) throws Throwable {
setRunnerParameter(PowerShellConstants.RUNNER_MIN_VERSION, "2.0");
setRunnerParameter(PowerShellConstants.RUNNER_EXECUTION_MODE, PowerShellExecutionMode.STDIN.getValue());
setRunnerParameter(PowerShellConstants.RUNNER_SCRIPT_MODE, PowerShellScriptMode.CODE.getValue());
setRunnerParameter(PowerShellConstants.RUNNER_SCRIPT_CODE, "callToSomeNonExistentFunction(param1, param2)");
setRunnerParameter(PowerShellConstants.RUNNER_BITNESS, bitness.getValue());
setRunnerParameter(PowerShellConstants.RUNNER_LOG_ERR_TO_ERROR, "true");
getBuildType().setOption(SBuildType.BT_FAIL_ON_ANY_ERROR_MESSAGE, true);
final SFinishedBuild build = doTest(null);
dumpBuildLogLocally(build);
Assert.assertTrue(build.getBuildStatus().isFailed());
}
use of jetbrains.buildServer.serverSide.SFinishedBuild 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: ");
}
use of jetbrains.buildServer.serverSide.SFinishedBuild 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());
}
use of jetbrains.buildServer.serverSide.SFinishedBuild 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));
}
}
use of jetbrains.buildServer.serverSide.SFinishedBuild 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");
}
Aggregations