Package com.google.gwt.junit.client.impl.JUnitHost

Examples of com.google.gwt.junit.client.impl.JUnitHost.TestInfo


    return defaultValue;
  }

  private void runTest() {
    // Dynamically create a new test case.
    TestInfo currentTest = getCurrentTest();
    GWTTestCase testCase = null;
    try {
      testCase = testAccessor.newInstance(currentTest.getTestClass());
    } catch (Throwable e) {
      RuntimeException ex = new RuntimeException(currentTest
          + ": could not instantiate the requested class", e);
      JUnitResult result = new JUnitResult();
      result.setException(ex);
      reportResultsAndGetNextMethod(result);
      return;
    }
    testCase.init(currentTest.getTestClass(), currentTest.getTestMethod());
    testCase.__doRunTest();
  }
View Full Code Here


  public void testGetNumRetrievedClients() {
    final long timeout = System.currentTimeMillis() + 15;
    JUnitMessageQueue queue = createQueue(15, 2, 3);
    TestInfo[] testBlock0 = queue.getTestBlocks().get(0);
    TestInfo test0_0 = testBlock0[0];
    TestInfo test0_1 = testBlock0[1];
    TestInfo test0_2 = testBlock0[2];
    TestInfo[] testBlock1 = queue.getTestBlocks().get(1);
    TestInfo test1_0 = testBlock1[0];
    TestInfo test1_1 = testBlock1[1];
    TestInfo test1_2 = testBlock1[2];
    assertEquals(0, queue.getNumClientsRetrievedTest(test0_0));
    assertEquals(0, queue.getNumClientsRetrievedTest(test0_1));
    assertEquals(0, queue.getNumClientsRetrievedTest(test0_2));
    assertEquals(0, queue.getNumClientsRetrievedTest(test1_0));
    assertEquals(0, queue.getNumClientsRetrievedTest(test1_1));
View Full Code Here

  }

  public void testGetResults() {
    JUnitMessageQueue queue = createQueue(3, 2, 3);
    TestInfo[] testBlock0 = queue.getTestBlocks().get(0);
    TestInfo test0_0 = testBlock0[0];

    // The results from the three clients.
    JUnitResult result0 = new JUnitResult();
    result0.setException(new IllegalArgumentException("0"));
    JUnitResult result1 = new JUnitResult();
View Full Code Here

  }

  public void testHasResults() {
    JUnitMessageQueue queue = createQueue(3, 2, 3);
    TestInfo[] testBlock0 = queue.getTestBlocks().get(0);
    TestInfo test0_0 = testBlock0[0];
    TestInfo test0_1 = testBlock0[1];
    TestInfo test0_2 = testBlock0[2];
    TestInfo[] testBlock1 = queue.getTestBlocks().get(1);
    TestInfo test1_0 = testBlock1[0];
    TestInfo test1_1 = testBlock1[1];
    TestInfo test1_2 = testBlock1[2];
    assertFalse(queue.hasResults(test0_0));
    assertFalse(queue.hasResults(test0_1));
    assertFalse(queue.hasResults(test0_2));
    assertFalse(queue.hasResults(test1_0));
    assertFalse(queue.hasResults(test1_1));
View Full Code Here

  public void testNeedRerunningExceptions() {
    JUnitMessageQueue queue = createQueue(TWO_CLIENTS, ONE_BLOCK,
        ONE_TEST_PER_BLOCK);
    // an exception
    TestInfo testInfo = queue.getTestBlocks().get(0)[0];
    Map<TestInfo, JUnitResult> results = new HashMap<TestInfo, JUnitResult>();
    JUnitResult junitResult = new JUnitResult();
    junitResult.setException(new UnableToCompleteException());
    results.put(testInfo, junitResult);
    queue.reportResults(createClientInfo(0), results);
View Full Code Here

  }

  public void testNeedRerunningIncompleteResults() {
    JUnitMessageQueue queue = createQueue(TWO_CLIENTS, ONE_BLOCK,
        ONE_TEST_PER_BLOCK);
    TestInfo testInfo = queue.getTestBlocks().get(0)[0];

    // incomplete results
    assertTrue(queue.needsRerunning(testInfo));
    queue.reportResults(createClientInfo(0), createTestResults(1));
    assertTrue(queue.needsRerunning(testInfo));
View Full Code Here

  }

  public void testRemove() {
    JUnitMessageQueue queue = createQueue(TWO_CLIENTS, ONE_BLOCK,
        ONE_TEST_PER_BLOCK);
    TestInfo testInfo = queue.getTestBlocks().get(0)[0];
    assertFalse(queue.hasResults(testInfo));

    queue.reportResults(createClientInfo(0),
        createTestResults(ONE_TEST_PER_BLOCK));
    assertFalse(queue.hasResults(testInfo));
View Full Code Here

  }

  public void testRetries() {
    JUnitMessageQueue queue = createQueue(TWO_CLIENTS, ONE_BLOCK,
        ONE_TEST_PER_BLOCK);
    TestInfo testInfo = queue.getTestBlocks().get(0)[0];
    Map<TestInfo, JUnitResult> results = new HashMap<TestInfo, JUnitResult>();
    JUnitResult junitResult = new JUnitResult();
    junitResult.setException(new AssertionError());
    results.put(testInfo, junitResult);
    queue.reportResults(createClientInfo(0), results);
View Full Code Here

  private List<TestInfo[]> createTestBlocks(int numBlocks, int testsPerBlock) {
    List<TestInfo[]> testBlocks = new ArrayList<TestInfo[]>();
    for (int i = 0; i < numBlocks; i++) {
      TestInfo[] testBlock = new TestInfo[testsPerBlock];
      for (int test = 0; test < testsPerBlock; test++) {
        testBlock[test] = new TestInfo("testModule" + i, "testClass",
            "testMethod" + test);
      }
      testBlocks.add(testBlock);
    }
    return testBlocks;
View Full Code Here

   * @return the test results
   */
  private Map<TestInfo, JUnitResult> createTestResults(int numTests) {
    Map<TestInfo, JUnitResult> results = new HashMap<TestInfo, JUnitResult>();
    for (int i = 0; i < numTests; i++) {
      TestInfo testInfo = new TestInfo("testModule0", "testClass", "testMethod"
          + i);
      results.put(testInfo, new JUnitResult());
    }
    return results;
  }
View Full Code Here

TOP

Related Classes of com.google.gwt.junit.client.impl.JUnitHost.TestInfo

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.