Package com.google.gwt.junit.client

Examples of com.google.gwt.junit.client.GWTTestCase


        return nonGWTTestSuite;
      } else {
        return getModuleSuiteFor(suite.testAt(0));
      }
    } else if (test instanceof GWTTestCase) {
      GWTTestCase gwtTest = (GWTTestCase) test;
      TestSuite suite = moduleSuites.get(gwtTest.getModuleName());
      if (suite == null) {
        suite = new TestSuite(gwtTest.getModuleName() + ".gwt.xml");
        moduleSuites.put(gwtTest.getModuleName(), suite);
        super.addTest(suite);
      }
      return suite;
    } else {
      if (nonGWTTestSuite == null) {
View Full Code Here


      return "com.google.gwt.mock.Mock";
    }
  }

  public void testGetStrategy() {
    GWTTestCase testCase = new MockGWTTestCase();
    Strategy strategy = testCase.getStrategy();
    assertEquals("JUnit", strategy.getSyntheticModuleExtension());
    assertEquals("com.google.gwt.mock.Mock.JUnit",
        testCase.getSyntheticModuleName());
  }
View Full Code Here

  public void testMaybeAddTestBlockForCurrentTestWithBatching() {
    BatchingStrategy batchingStrategy = new ModuleBatchingStrategy();
    assertFalse(batchingStrategy.isSingleTestOnly());

    // Maybe add the current test.
    GWTTestCase testCase = new MockGWTTestCase();
    MockCompileStrategy strategy = new MockCompileStrategy(-1);
    strategy.maybeAddTestBlockForCurrentTest(testCase, batchingStrategy);

    // Verify the test is not added to the queue.
    strategy.getMessageQueue().assertTestBlocks(null);
View Full Code Here

  public void testMaybeAddTestBlockForCurrentTestWithoutBatching() {
    BatchingStrategy batchingStrategy = new NoBatchingStrategy();
    assertTrue(batchingStrategy.isSingleTestOnly());

    // Maybe add the current test.
    GWTTestCase testCase = new MockGWTTestCase();
    MockCompileStrategy strategy = new MockCompileStrategy(-1);
    strategy.maybeAddTestBlockForCurrentTest(testCase, batchingStrategy);

    // Generate the expected blocks.
    TestInfo testInfo = new TestInfo(testCase.getSyntheticModuleName(),
        testCase.getClass().getName(), testCase.getName());
    List<TestInfo[]> testBlocks = new ArrayList<TestInfo[]>();
    testBlocks.add(new TestInfo[] {testInfo});

    // Verify the test is added to the queue.
    strategy.getMessageQueue().assertIsLastBlock(false);
View Full Code Here

  public void testMaybeCompileModuleImplWithBatchingLastModule() {
    BatchingStrategy batchingStrategy = new ModuleBatchingStrategy();
    assertFalse(batchingStrategy.isSingleTestOnly());

    // Maybe add the current test.
    GWTTestCase testCase = new MockGWTTestCase();
    MockCompileStrategy strategy = new MockCompileStrategy(-1);
    try {
      strategy.maybeCompileModuleImpl(testCase.getModuleName(),
          testCase.getSyntheticModuleName(), testCase.getStrategy(),
          batchingStrategy, TreeLogger.NULL);
    } catch (UnableToCompleteException e) {
      fail("Unexpected UnableToCompleteException: " + e.getMessage());
    }

    // Verify the test block is added to the queue.
    strategy.getMessageQueue().assertIsLastBlock(true);
    strategy.getMessageQueue().assertTestBlocks(
        batchingStrategy.getTestBlocks(testCase.getSyntheticModuleName()));
  }
View Full Code Here

  public void testMaybeCompileModuleImplWithBatchingNotLastModule() {
    BatchingStrategy batchingStrategy = new ClassBatchingStrategy();
    assertFalse(batchingStrategy.isSingleTestOnly());

    // Maybe add the current test.
    GWTTestCase testCase = new MockGWTTestCase();
    MockCompileStrategy strategy = new MockCompileStrategy(1000);
    try {
      strategy.maybeCompileModuleImpl(testCase.getModuleName(),
          testCase.getSyntheticModuleName(), testCase.getStrategy(),
          batchingStrategy, TreeLogger.NULL);
    } catch (UnableToCompleteException e) {
      fail("Unexpected UnableToCompleteException: " + e.getMessage());
    }

    // Verify the test block is added to the queue.
    strategy.getMessageQueue().assertIsLastBlock(false);
    strategy.getMessageQueue().assertTestBlocks(
        batchingStrategy.getTestBlocks(testCase.getSyntheticModuleName()));
  }
View Full Code Here

  public void testMaybeCompileModuleImplWithoutBatching() {
    BatchingStrategy batchingStrategy = new NoBatchingStrategy();
    assertTrue(batchingStrategy.isSingleTestOnly());

    // Maybe add the current test.
    GWTTestCase testCase = new MockGWTTestCase();
    MockCompileStrategy strategy = new MockCompileStrategy(-1);
    try {
      strategy.maybeCompileModuleImpl(testCase.getModuleName(),
          testCase.getSyntheticModuleName(), testCase.getStrategy(),
          batchingStrategy, TreeLogger.NULL);
    } catch (UnableToCompleteException e) {
      fail("Unexpected UnableToCompleteException: " + e.getMessage());
    }
View Full Code Here

  }

  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

      String className = classType.getQualifiedSourceName();

      try {
        Class<?> testClass = Class.forName(className);
        GWTTestCase instantiated = (GWTTestCase) testClass.newInstance();
        if (!moduleName.equals(instantiated.getModuleName())) {
          continue;
        }
      } catch (Throwable e) {
        logger.log(
            TreeLogger.INFO,
View Full Code Here

        return getModuleSuiteFor(suite.testAt(0));
      }
    }

    if (test instanceof GWTTestCase) {
      GWTTestCase gwtTest = (GWTTestCase) test;
      String moduleName = gwtTest.getModuleName();
      if (moduleName != null) {
        TestSuite suite = moduleSuites.get(moduleName);
        if (suite == null) {
          suite = new TestSuite(moduleName + ".gwt.xml");
          moduleSuites.put(moduleName, suite);
View Full Code Here

TOP

Related Classes of com.google.gwt.junit.client.GWTTestCase

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.