Search in sources :

Example 16 with TestTree

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

the class TestTreeRegistryTest method testRegisterTestTreeThenLookupAndAssertWithOriginal.

/**
 */
@Test
public void testRegisterTestTreeThenLookupAndAssertWithOriginal() {
    final String sessionId = valueOf(randomUUID());
    fsmRegistry.registerFsm(sessionId);
    final TestTree original = newTestTree(sessionId);
    treeRegistry.registerTestTree(original);
    final TestTree copy = treeRegistry.getTestTree(sessionId);
    assertNotNull(copy);
    assertEquals(original, copy);
    assertFalse(copy == original);
}
Also used : TestTree(org.eclipse.n4js.tester.domain.TestTree) Test(org.junit.Test)

Example 17 with TestTree

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

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

the class HeadlessTestDiscoveryTest method testDiscoveryForExistingProjectAndItsContainmentFile_WithExportFiltering.

/**
 */
@Test
public void testDiscoveryForExistingProjectAndItsContainmentFile_WithExportFiltering() {
    final TestTree actual = helper.collectTests(toURI(TEST_PROJECT_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 19 with TestTree

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

the class HeadlessTestDiscoveryTest method testDiscoveryForExistingProjectAndItsContainmentFile.

/**
 */
@Test
public void testDiscoveryForExistingProjectAndItsContainmentFile() {
    final TestTree actual = helper.collectTests(toURI(TEST_PROJECT), 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 20 with TestTree

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

the class HeadlessTestDiscoveryTest method testDiscoveryForSingleExistingProject.

/**
 */
@Test
public void testDiscoveryForSingleExistingProject() {
    final TestTree actual = helper.collectTests(toURI(TEST_PROJECT));
    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)

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