Example #1
0
 @Override
 public void run(TestResult result) {
   maybeCreateTestClassWrappers();
   _executionManager.setTestsFromSuite(testsAsListOfSuites());
   beforeSuite();
   super.run(result);
 }
Example #2
0
 public T withTestEnvironment(TestEnvironment testEnvironment) {
   if (_testEnvironment.isRemoteExecutionEnvironment()) {
     throw new IllegalStateException(
         "For now, withTestEnvironment must be called BEFORE withRemoteServer is called");
   }
   _testEnvironment = testEnvironment;
   _executionManager.setEnvironment(_testEnvironment);
   return thisAsT();
 }
Example #3
0
  public Suite() {
    Integer splitPartition = readIntegerSystemProperty("split.partition");
    if (splitPartition != null && splitPartition > 1) {
      throw new UnsupportedOperationException("V3 tests doesn't support more than one split");
    }

    // By default, use a standard TestEnvironment to set things up, in case the specific suite class
    // doesn't
    // bother to set one up
    _testEnvironment = new TestEnvironment();
    _executionManager = new TestExecutionManager();
    _executionManager.setEnvironment(_testEnvironment);
  }
Example #4
0
  private void maybeCreateTestClassWrappers() {

    maybeInitSuite();

    if (!_testClassWrappersCreated) {
      long start = System.currentTimeMillis();

      if (_testSpecs.isEmpty()) {
        TestClassFinder finder =
            new TestClassFinder(_iFileFilters, _packageFilters, _withPackages, _typeFilters);
        _testSpecs.addAll(finder.findTests(_gosuClassSearchPath, _javaClassSearchPath));
      }

      restrictTestSpecsToSpecifiedNames();

      for (TestSpec spec : _testSpecs) {
        if (_testEnvironment.isRemoteExecutionEnvironment()) {
          String[] methods = spec.runAllMethods() ? null : spec.getMethods();
          RemoteTestClassWrapper remoteWrapper =
              new RemoteTestClassWrapper(_executionManager, spec.getTestTypeName(), methods);
          addTest(remoteWrapper);
        } else {
          IType type = spec.getTestType();
          addTest(new TestClassWrapper(_executionManager, type, spec.getMethods()));
        }
      }
      _testClassWrappersCreated = true;
      long end = System.currentTimeMillis();
      System.out.println("Test wrappers created in " + (end - start) + "ms");

      if (_testEnvironment.isDynamicallyDeterminedEnvironment()) {
        _testEnvironment = determineTestEnvironmentBasedOnTestDefaults();
        System.out.println(
            "Dynamically determined the test environment to be " + _testEnvironment.getClass());
        // This is pretty hacky, but RemoteTestEnvironments need a chance to tell the remote server
        // what sort of environment to set up, and that actually needs to be done prior to beginning
        // the suite
        if (_testEnvironment instanceof ForwardingTestEnvironment) {
          _testEnvironment.initializeTypeSystem();
        }
        _executionManager.setEnvironment(_testEnvironment);
      }
    }
  }
Example #5
0
 /**
  * Used to indicate that this suite does not require assertions be enabled. In general it is
  * recommended that you not use this option.
  */
 public final T javaAssertionsNotEnabled() {
   _executionManager.setAssertionsMustBeEnabled(false);
   return thisAsT();
 }
Example #6
0
 private void initTypeSystem() {
   _executionManager.maybeInitTypeSystem();
 }
Example #7
0
 public final T withTimeout(long seconds) {
   _executionManager.setSuiteTimeoutInMillis(seconds * 1000L);
   return thisAsT();
 }