use of org.eclipse.n4js.tester.domain.TestSuite in project n4js by eclipse.
the class MockTest method createNewTestTree.
private TestTree createNewTestTree(final String sessionId, final int testCaseCountFactor) {
final List<TestSuite> testSuites = newArrayList();
create(closed(1, testCaseCountFactor), integers()).forEach(i -> {
final String suiteName = format("%05d", i) + "_TestSuite";
final TestSuite suite = new TestSuite(suiteName);
create(closed(1, testCaseCountFactor), integers()).forEach(j -> {
final String testCaseId = getTestCaseId(i, j);
suite.add(new TestCase(new ID(testCaseId), "origin." + suiteName + "." + testCaseId + ".0.0.1", suiteName + "." + testCaseId, testCaseId, testCaseId, URI.createURI("testURI_" + testCaseId)));
});
testSuites.add(suite);
});
return new TestTree(new ID(sessionId), testSuites);
}
use of org.eclipse.n4js.tester.domain.TestSuite in project n4js by eclipse.
the class TestTreeRegistryTest method newTestTree.
private TestTree newTestTree(final String sessionId, final String... testIds) {
final List<TestSuite> testSuites = newArrayList(transform(newHashSet(testIds), new Function<String, TestSuite>() {
@Override
public TestSuite apply(String testId) {
final TestSuite suite = new TestSuite("TestSuite_for_Test_" + testId);
final TestCase testCase = new TestCase(new ID(testId), "testClassName_" + testId, "origin_" + testId + "name_" + testId + "_0.0.0", "name_" + testId, "displayName_" + testId, URI.createURI("testURI_" + testId));
suite.setTestCases(singletonList(testCase));
return suite;
}
}));
return new TestTree(new ID(sessionId), testSuites);
}
use of org.eclipse.n4js.tester.domain.TestSuite in project n4js by eclipse.
the class HeadlessTestDiscoveryTest method assertTestCaseCountForSuite.
private void assertTestCaseCountForSuite(final TestTree actual, final String testSuiteName, final int expected) {
assertNotNull(actual);
final TestSuite suite = assertHasExactlyOneSuite(actual, testSuiteName);
assertEquals(expected, suite.getTestCases().size());
}
use of org.eclipse.n4js.tester.domain.TestSuite in project n4js by eclipse.
the class TesterDomainTest method testTestTreeClone.
/**
*/
@Test
public void testTestTreeClone() throws Exception {
final List<TestSuite> originalTestSuites = newArrayList();
final TestSuite originalTestSuite = new TestSuite("name");
final TestCase originalTestCase = new TestCase(new ID("testId"), "testId", "testId", "testId", "testId", URI.createURI("testURI_testId"));
originalTestSuite.add(originalTestCase);
originalTestSuites.add(originalTestSuite);
final TestTree originalTestTree = new TestTree(new ID("value"), originalTestSuites);
final TestTree copyTestTree = originalTestTree.clone();
assertEquals(originalTestTree, copyTestTree);
assertFalse(originalTestTree == copyTestTree);
assertFalse(originalTestSuites == copyTestTree.getSuites());
assertFalse(originalTestSuite == getOnlyElement(copyTestTree.getSuites()));
assertEquals(originalTestCase, getOnlyElement(getOnlyElement(copyTestTree.getSuites()).getTestCases()));
assertFalse(originalTestCase == getOnlyElement(getOnlyElement(copyTestTree.getSuites()).getTestCases()));
}
use of org.eclipse.n4js.tester.domain.TestSuite in project n4js by eclipse.
the class TesterDomainTest method testTestTreeIterator.
/**
*/
@Test
public void testTestTreeIterator() {
final TestTree tree = new TestTree(new ID(valueOf(randomUUID())));
final TestSuite a = new TestSuite("A");
a.addAll(newTestCase("1", "2", "3"));
final TestSuite b = new TestSuite("B");
b.addAll(newTestCase("4", "5", "6"));
final TestSuite a1 = new TestSuite("A.1");
a1.addAll(newTestCase("7", "8"));
final TestSuite a2 = new TestSuite("A.2");
a2.addAll(newTestCase("9", "10"));
final TestSuite a11 = new TestSuite("A.1.1");
a11.addAll(newTestCase("11", "12"));
a1.getChildren().add(a11);
a.getChildren().add(a1);
a.getChildren().add(a2);
tree.getSuites().add(a);
tree.getSuites().add(b);
assertEquals(4, size(a1));
assertEquals(newHashSet("7", "8", "11", "12"), newHashSet(transform(a1, testCase -> testCase.getId().getValue())));
assertEquals(9, size(a));
assertEquals(newHashSet("1", "2", "3", "7", "8", "9", "10", "11", "12"), newHashSet(transform(a, testCase -> testCase.getId().getValue())));
assertEquals(12, size(tree));
assertEquals(newHashSet("1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12"), newHashSet(transform(tree, testCase -> testCase.getId().getValue())));
}
Aggregations