use of jetbrains.buildServer.serverSide.SFinishedBuild in project teamcity-rest by JetBrains.
the class InvestigationFinderTest method createFailingBuild.
private void createFailingBuild() {
final ProjectEx rootProject = myProjectManager.getRootProject();
final ProjectEx project1 = rootProject.createProject("project1", "Project name");
myBuildType = project1.createBuildType("extId", "bt name");
startBuild(myBuildType);
runTestsInRunningBuild(new String[] { "pass.test1" }, new String[] { FAIL_TEST2_NAME }, new String[0]);
BuildServerCreator.doBuildProblem(getRunningBuild(), PROBLEM_IDENTITY);
final SFinishedBuild build = finishBuild(true);
myUser = createUser("user");
}
use of jetbrains.buildServer.serverSide.SFinishedBuild in project teamcity-rest by JetBrains.
the class TestOccurrenceRequestTest method testInvocationsAreFoundCorrectly.
@Test
@TestFor(issues = { "TW-70206" })
public void testInvocationsAreFoundCorrectly() {
if (true)
throw new SkipException("Ignored as current implementation does work only in a very specific number of cases when specific build is available when preparing TestOccurrences");
final BuildTypeImpl buildType = registerBuildType("buildConf1", "project");
final SFinishedBuild build = build().in(buildType).withTest("aaa", false).withTest("aaa", true).withTest("aaa", true).finish();
String fields = "testCounters(failed,success,all,duration),testOccurrence(id,name,muted,status,invocations($locator(count:90000),testCounters(all,success,failed),testOccurrence(id,name,status,muted)))";
String locator = "currentlyFailing:true,affectedProject:" + buildType.getProject().getExternalId();
FakeHttpServletRequest mockRequest = new FakeHttpServletRequest();
mockRequest.setRequestURL(String.format("http://test/httpAuth/app/rest/testOccurrences?locator=%s&fields=%s", locator, fields));
TestOccurrences testOccurrences = myRequest.getTestOccurrences(locator, fields, null, mockRequest);
assertEquals("Should return exactly one 'grouping' test run.", 1, testOccurrences.items.size());
TestOccurrence grouping = testOccurrences.items.get(0);
assertNotNull("Should contain invocations node.", grouping.getInvocations());
assertEquals("Should contain exactly 3 occurrences.", 3, grouping.getInvocations().items.size());
}
use of jetbrains.buildServer.serverSide.SFinishedBuild in project teamcity-rest by JetBrains.
the class TestOccurrenceRequestTest method testShouldRespectExpandInvocationsDimension.
@Test
@TestFor(issues = { "TW-70331" })
public void testShouldRespectExpandInvocationsDimension() {
final BuildTypeImpl buildType = registerBuildType("buildConf1", "project");
final SFinishedBuild build = build().in(buildType).withTest("aaa", false).withTest("aaa", false).withTest("aaa", true).finish();
FakeHttpServletRequest mockRequest = new FakeHttpServletRequest();
String fields = "testCounters(all,success,failed)";
String locator = "build:" + build.getBuildId() + ",expandInvocations:true";
mockRequest.setRequestURL(String.format("http://test/httpAuth/app/rest/testOccurrences?locator=%s&fields=%s", locator, fields));
TestOccurrences testOccurrences = myRequest.getTestOccurrences(locator, fields, null, mockRequest);
assertEquals(new Integer(3), testOccurrences.getTestCounters().getAll());
assertEquals(new Integer(2), testOccurrences.getTestCounters().getFailed());
assertEquals(new Integer(1), testOccurrences.getTestCounters().getSuccess());
}
use of jetbrains.buildServer.serverSide.SFinishedBuild in project teamcity-rest by JetBrains.
the class TestOccurrenceRequestTest method testWontFetchItemsWhenNotNeededWithExplicitFieldsValue.
@Test
public void testWontFetchItemsWhenNotNeededWithExplicitFieldsValue() {
BeanContext ctx = BaseFinderTest.getBeanContext(myFixture);
myRequest.initForTests(ctx.getServiceLocator(), new TestOccurrenceFinderDenyingItemsFetch(), ctx.getApiUrlBuilder(), ctx);
final SFinishedBuild build = build().in(myBuildType).withTest(BuildBuilder.TestData.test("aaa").duration(76)).finish();
FakeHttpServletRequest mockRequest = new FakeHttpServletRequest();
mockRequest.setRequestURL("http://test/httpAuth/app/rest/testOccurrences?locator=build:" + build.getBuildId() + "&fields=id,count,failed,testCounters(all,success)");
TestOccurrences testOccurrences = myRequest.getTestOccurrences("build:" + build.getBuildId(), "", null, mockRequest);
assertEquals(new Integer(1), testOccurrences.getCount());
}
use of jetbrains.buildServer.serverSide.SFinishedBuild in project teamcity-powershell by JetBrains.
the class BuildFailureTests method should_pass_explicit_exit_code_file.
@Test(dataProvider = "supportedBitnessProvider")
public void should_pass_explicit_exit_code_file(@NotNull final PowerShellBitness bitness) throws Throwable {
setRunnerParameter(PowerShellConstants.RUNNER_EXECUTION_MODE, PowerShellExecutionMode.PS1.getValue());
setRunnerParameter(PowerShellConstants.RUNNER_SCRIPT_MODE, PowerShellScriptMode.CODE.getValue());
setRunnerParameter(PowerShellConstants.RUNNER_SCRIPT_CODE, "$res = \"Test is running\"\nWrite-Output $res\nexit(123)");
setRunnerParameter(PowerShellConstants.RUNNER_BITNESS, bitness.getValue());
final SFinishedBuild build = doTest(null);
dumpBuildLogLocally(build);
Assert.assertTrue(build.getBuildStatus().isFailed());
Assert.assertTrue(getBuildLog(build).contains("Process exited with code 123"));
}
Aggregations