Search in sources :

Example 6 with TestSuite

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);
}
Also used : TestSuite(org.eclipse.n4js.tester.domain.TestSuite) TestCase(org.eclipse.n4js.tester.domain.TestCase) ID(org.eclipse.n4js.tester.domain.ID) UUID.randomUUID(java.util.UUID.randomUUID) TestTree(org.eclipse.n4js.tester.domain.TestTree)

Example 7 with TestSuite

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);
}
Also used : Function(com.google.common.base.Function) TestSuite(org.eclipse.n4js.tester.domain.TestSuite) TestCase(org.eclipse.n4js.tester.domain.TestCase) ID(org.eclipse.n4js.tester.domain.ID) UUID.randomUUID(java.util.UUID.randomUUID) TestTree(org.eclipse.n4js.tester.domain.TestTree)

Example 8 with TestSuite

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());
}
Also used : TestSuite(org.eclipse.n4js.tester.domain.TestSuite)

Example 9 with TestSuite

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()));
}
Also used : TestSuite(org.eclipse.n4js.tester.domain.TestSuite) TestCase(org.eclipse.n4js.tester.domain.TestCase) ID(org.eclipse.n4js.tester.domain.ID) UUID.randomUUID(java.util.UUID.randomUUID) TestTree(org.eclipse.n4js.tester.domain.TestTree) Test(org.junit.Test)

Example 10 with TestSuite

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())));
}
Also used : TestSuite(org.eclipse.n4js.tester.domain.TestSuite) ID(org.eclipse.n4js.tester.domain.ID) UUID.randomUUID(java.util.UUID.randomUUID) TestTree(org.eclipse.n4js.tester.domain.TestTree) Test(org.junit.Test)

Aggregations

TestSuite (org.eclipse.n4js.tester.domain.TestSuite)10 UUID.randomUUID (java.util.UUID.randomUUID)7 ID (org.eclipse.n4js.tester.domain.ID)7 TestTree (org.eclipse.n4js.tester.domain.TestTree)7 TestCase (org.eclipse.n4js.tester.domain.TestCase)5 Test (org.junit.Test)3 TMethod (org.eclipse.n4js.ts.types.TMethod)2 Function (com.google.common.base.Function)1 URI (org.eclipse.emf.common.util.URI)1 EObject (org.eclipse.emf.ecore.EObject)1 FileExtensionType (org.eclipse.n4js.fileextensions.FileExtensionType)1 N4MethodDeclaration (org.eclipse.n4js.n4JS.N4MethodDeclaration)1 TClass (org.eclipse.n4js.ts.types.TClass)1 TModule (org.eclipse.n4js.ts.types.TModule)1 Type (org.eclipse.n4js.ts.types.Type)1 EcoreUtil2.getContainerOfType (org.eclipse.xtext.EcoreUtil2.getContainerOfType)1