use of jetbrains.buildServer.serverSide.impl.BuildTypeImpl 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");
}
use of jetbrains.buildServer.serverSide.impl.BuildTypeImpl in project teamcity-rest by JetBrains.
the class ChangeStatusTest method testSomeNewFailedTests.
public void testSomeNewFailedTests() {
final BuildTypeImpl buildConf = registerBuildType("buildConf1", "project");
VcsRootInstance root1 = prepareSingleVscRoot(buildConf);
SVcsModification m20 = myFixture.addModification(modification().in(root1).version("20").parentVersions("10"));
SVcsModification m30 = myFixture.addModification(modification().in(root1).version("30").parentVersions("20"));
build().in(buildConf).onModifications(m20).withFailedTests("failedTestName").finish();
// same test failed
build().in(buildConf).onModifications(m30).withFailedTests("failedTestName", "newFailedTestName").finish();
ChangeStatus status = new ChangeStatus(myFixture.getChangeStatusProvider().getMergedChangeStatus(m30), Fields.ALL_NESTED, getBeanContext(myFixture));
assertEquals(1, (int) status.getFinished());
assertEquals(0, (int) status.getSuccessful());
assertEquals(1, (int) status.getFailed());
assertEquals(1, (int) status.getNewFailedTests());
assertEquals(1, (int) status.getOtherFailedTests());
assertEquals(1, (int) status.getNewTestsFailedBuilds().count);
}
use of jetbrains.buildServer.serverSide.impl.BuildTypeImpl in project teamcity-rest by JetBrains.
the class ChangeStatusTest method testNoNewFailedTests.
public void testNoNewFailedTests() {
final BuildTypeImpl buildConf = registerBuildType("buildConf1", "project");
VcsRootInstance root1 = prepareSingleVscRoot(buildConf);
SVcsModification m20 = myFixture.addModification(modification().in(root1).version("20").parentVersions("10"));
SVcsModification m30 = myFixture.addModification(modification().in(root1).version("30").parentVersions("20"));
build().in(buildConf).onModifications(m20).withFailedTests("failedTestName").finish();
// same test failed
build().in(buildConf).onModifications(m30).withFailedTests("failedTestName").finish();
ChangeStatus status = new ChangeStatus(myFixture.getChangeStatusProvider().getMergedChangeStatus(m30), Fields.ALL_NESTED, getBeanContext(myFixture));
assertEquals(1, (int) status.getFinished());
assertEquals(0, (int) status.getSuccessful());
assertEquals(1, (int) status.getFailed());
assertEquals(0, (int) status.getNewFailedTests());
assertEquals(1, (int) status.getOtherFailedTests());
assertEquals(0, (int) status.getNewTestsFailedBuilds().count);
}
use of jetbrains.buildServer.serverSide.impl.BuildTypeImpl in project teamcity-rest by JetBrains.
the class ChangeStatusTest method testSuccessfulRunning.
public void testSuccessfulRunning() {
final BuildTypeImpl buildConf = registerBuildType("buildConf1", "project");
VcsRootInstance root1 = prepareSingleVscRoot(buildConf);
SVcsModification m20 = myFixture.addModification(modification().in(root1).version("20").parentVersions("10"));
RunningBuildEx runningBuildEx = build().in(buildConf).onModifications(m20).run();
ChangeStatus status = new ChangeStatus(myFixture.getChangeStatusProvider().getMergedChangeStatus(m20), Fields.ALL_NESTED, getBeanContext(myFixture));
myFixture.finishBuild(runningBuildEx, false);
assertEquals(0, (int) status.getFinished());
assertEquals(1, (int) status.getRunning());
assertEquals(0, (int) status.getSuccessful());
assertEquals(1, (int) status.getRunningSuccessfuly());
}
use of jetbrains.buildServer.serverSide.impl.BuildTypeImpl in project teamcity-rest by JetBrains.
the class ChangeFinderTest method buildVcsRootInstance.
@NotNull
private VcsRootInstance buildVcsRootInstance() {
final BuildTypeImpl buildConf = registerBuildType("buildConf1", "project");
MockVcsSupport vcs = new MockVcsSupport("vcs");
myFixture.getVcsManager().registerVcsSupport(vcs);
SVcsRootEx parentRoot1 = myFixture.addVcsRoot(vcs.getName(), "", buildConf);
VcsRootInstance root1 = buildConf.getVcsRootInstanceForParent(parentRoot1);
assert root1 != null;
return root1;
}
Aggregations