Search in sources :

Example 21 with TestTree

use of org.eclipse.n4js.tester.domain.TestTree in project n4js by eclipse.

the class HeadlessTestDiscoveryTest method testDiscoveryForSameExistingFile.

/**
 */
@Test
public void testDiscoveryForSameExistingFile() {
    final TestTree actual = helper.collectTests(toURI(TEST_CLASS_FILE), toURI(TEST_CLASS_FILE));
    assertTestSuiteCount(actual, 3);
    String suiteA = createFqn(DEFAULT_PROJECT_OUTPUT, TEST_SRC_STRUCTURE, TEST_CLASS_1, "A");
    String suiteB = createFqn(DEFAULT_PROJECT_OUTPUT, TEST_SRC_STRUCTURE, TEST_CLASS_1, "B");
    String suiteC = createFqn(DEFAULT_PROJECT_OUTPUT, TEST_SRC_STRUCTURE, TEST_CLASS_1, "C");
    assertTestSuiteNames(actual, suiteA, suiteB, suiteC);
    assertTestCaseCount(actual, 4);
    assertTestCaseCountForSuite(actual, suiteA, 2);
    assertTestCaseCountForSuite(actual, suiteB, 1);
    assertTestCaseCountForSuite(actual, suiteC, 1);
}
Also used : TestTree(org.eclipse.n4js.tester.domain.TestTree) Test(org.junit.Test)

Example 22 with TestTree

use of org.eclipse.n4js.tester.domain.TestTree in project n4js by eclipse.

the class HeadlessTestDiscoveryTest method testDiscoveryForSameExistingFile_WithExportFiltering.

/**
 */
@Test
public void testDiscoveryForSameExistingFile_WithExportFiltering() {
    final TestTree actual = helper.collectTests(toURI(TEST_CLASS_FILE_IDEBUG_572), toURI(TEST_CLASS_FILE_IDEBUG_572));
    assertTestSuiteCount(actual, 2);
    String suiteC = createFqn(DEFAULT_PROJECT_OUTPUT, TEST_SRC_STRUCTURE, TEST_CLASS_2, "C");
    String suiteF = createFqn(DEFAULT_PROJECT_OUTPUT, TEST_SRC_STRUCTURE, TEST_CLASS_2, "F");
    assertTestSuiteNames(actual, suiteC, suiteF);
    assertTestCaseCount(actual, 3);
    assertTestCaseCountForSuite(actual, suiteC, 1);
    assertTestCaseCountForSuite(actual, suiteF, 2);
}
Also used : TestTree(org.eclipse.n4js.tester.domain.TestTree) Test(org.junit.Test)

Example 23 with TestTree

use of org.eclipse.n4js.tester.domain.TestTree in project n4js by eclipse.

the class HeadlessTestDiscoveryTest method testDiscoveryForExistingProjectFolderAndFile_WithExportFiltering.

/**
 */
@Test
public void testDiscoveryForExistingProjectFolderAndFile_WithExportFiltering() {
    final TestTree actual = helper.collectTests(toURI(TEST_PROJECT), toURI(TEST_SRC_FOLDER), toURI(TEST_CLASS_FILE));
    assertTestSuiteCount(actual, 3);
    String suiteA = createFqn(DEFAULT_PROJECT_OUTPUT, TEST_SRC_STRUCTURE, TEST_CLASS_1, "A");
    String suieB = createFqn(DEFAULT_PROJECT_OUTPUT, TEST_SRC_STRUCTURE, TEST_CLASS_1, "B");
    String suiteC = createFqn(DEFAULT_PROJECT_OUTPUT, TEST_SRC_STRUCTURE, TEST_CLASS_1, "C");
    assertTestSuiteNames(actual, suiteA, suieB, suiteC);
    assertTestCaseCount(actual, 4);
    assertTestCaseCountForSuite(actual, suiteA, 2);
    assertTestCaseCountForSuite(actual, suieB, 1);
    assertTestCaseCountForSuite(actual, suiteC, 1);
}
Also used : TestTree(org.eclipse.n4js.tester.domain.TestTree) Test(org.junit.Test)

Example 24 with TestTree

use of org.eclipse.n4js.tester.domain.TestTree 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 25 with TestTree

use of org.eclipse.n4js.tester.domain.TestTree 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

TestTree (org.eclipse.n4js.tester.domain.TestTree)25 Test (org.junit.Test)14 UUID.randomUUID (java.util.UUID.randomUUID)7 ID (org.eclipse.n4js.tester.domain.ID)7 TestSuite (org.eclipse.n4js.tester.domain.TestSuite)7 TestCase (org.eclipse.n4js.tester.domain.TestCase)4 Function (com.google.common.base.Function)1 IOException (java.io.IOException)1 ExecutorService (java.util.concurrent.ExecutorService)1 URI (org.eclipse.emf.common.util.URI)1 ExitCodeException (org.eclipse.n4js.hlc.base.ExitCodeException)1 TestConfiguration (org.eclipse.n4js.tester.TestConfiguration)1 ITesterDescriptor (org.eclipse.n4js.tester.extension.ITesterDescriptor)1 TesterActivator (org.eclipse.n4js.tester.internal.TesterActivator)1 TModule (org.eclipse.n4js.ts.types.TModule)1