コード例 #1
0
  /**
   * Creates a test suite containing tests of this class in a specific order. We'll first execute
   * tests beginning with the "test" prefix and then go to ordered tests.We first execture tests for
   * receiving messagese, so that a volatile contact is created for the sender. we'll then be able
   * to retrieve this volatile contact and send them a message on our turn. We need to do things
   * this way as the contact corresponding to the tester agent has been removed in the previous test
   * and we no longer have it in our contact list.
   *
   * @return Test a testsuite containing all tests to execute.
   */
  public static Test suite() {
    TestSuite suite = new TestSuite(TestOperationSetBasicInstantMessaging.class);

    // the following 2 need to be run in the specified order.
    suite.addTest(new TestOperationSetBasicInstantMessaging("firstTestReceiveMessage"));
    suite.addTest(new TestOperationSetBasicInstantMessaging("thenTestSendMessage"));

    return suite;
  }
コード例 #2
0
ファイル: DoAllTests.java プロジェクト: carvalhomb/tsmells
  /** @return the test suite */
  public static Test suite() {
    TestSuite suite = new TestSuite();
    int count = 0;

    for (Enumeration e = (new LoadingTestCollector()).collectTests(); e.hasMoreElements(); ) {
      Object o = e.nextElement();

      if (!(o instanceof String)) continue;
      String s = (String) o;

      if (s.equals("org.argouml.util.DoAllTests")) continue;

      Class candidate;
      try {
        candidate = Class.forName(s);
      } catch (ClassNotFoundException exception) {
        System.err.println("Cannot load class: " + s);
        continue;
      }
      if (!Modifier.isAbstract(candidate.getModifiers())) {
        suite.addTest(new TestSuite(candidate));
        count++;
      }
    }
    System.out.println("Number of test classes found: " + count);

    return suite;
  }
コード例 #3
0
  /**
   * Creates a test suite containing all tests of this class followed by test methods that we want
   * executed in a specified order.
   *
   * @return the Test suite to run
   */
  public static Test suite() {
    TestSuite suite = new TestSuite();

    // the following 2 need to be run in the specified order.
    // (postTestRemoveGroup() needs the group created from
    // postTestCreateGroup() )
    suite.addTest(new TestOperationSetPersistentPresence("postTestCreateGroup"));

    // rename
    suite.addTest(new TestOperationSetPersistentPresence("postTestRenameGroup"));

    suite.addTest(new TestOperationSetPersistentPresence("postTestRemoveGroup"));

    // create the contact list
    suite.addTest(new TestOperationSetPersistentPresence("prepareContactList"));

    suite.addTestSuite(TestOperationSetPersistentPresence.class);

    return suite;
  }
コード例 #4
0
  /**
   * Adds a test to be executed on the grid. In case of test suite, all tests inside of test suite
   * will be executed sequentially on some remote node.
   *
   * @param test Test to add.
   */
  @Override
  public void addTest(Test test) {
    if (copy == null) {
      copy = new TestSuite(getName());
    }

    // Add test to the list of local ones.
    if (test instanceof GridJunit3LocalTestSuite) {
      String testName = ((TestSuite) test).getName();

      if (!locTests.contains(testName)) {
        locTests.add(testName);
      }
    }

    if (test instanceof GridJunit3TestSuite) {
      copy.addTest(((GridJunit3TestSuite) test).copy);

      super.addTest(new GridJunit3TestSuiteProxy(((GridJunit3TestSuite) test).copy, factory));
    } else if (test instanceof GridJunit3TestSuiteProxy) {
      copy.addTest(((GridJunit3TestSuiteProxy) test).getOriginal());

      super.addTest(test);
    } else if (test instanceof GridJunit3TestCaseProxy) {
      copy.addTest(((GridJunit3TestCaseProxy) test).getGridGainJunit3OriginalTestCase());

      super.addTest(test);
    } else if (test instanceof TestSuite) {
      copy.addTest(test);

      super.addTest(new GridJunit3TestSuiteProxy((TestSuite) test, factory));
    } else {
      assert test instanceof TestCase
          : "Test must be either instance of TestSuite or TestCase: " + test;

      copy.addTest(test);

      super.addTest(factory.createProxy((TestCase) test));
    }
  }
コード例 #5
0
  /**
   * Creates a test suite containing all tests of this class followed by test methods that we want
   * executed in a specified order.
   *
   * @return Test
   */
  public static Test suite() {
    // return an (almost) empty suite if we're running in offline mode.
    if (IcqSlickFixture.onlineTestingDisabled) {
      TestSuite suite = new TestSuite();
      // the only test around here that we could run without net
      // connectivity
      suite.addTest(new TestOperationSetPresence("testSupportedStatusSetForCompleteness"));
      return suite;
    }

    TestSuite suite = new TestSuite(TestOperationSetPresence.class);

    // the following 2 need to be run in the specified order.
    // (postTestUnsubscribe() needs the subscription created from
    // postTestSubscribe() )
    suite.addTest(new TestOperationSetPresence("postTestSubscribe"));
    suite.addTest(new TestOperationSetPresence("postTestUnsubscribe"));

    // execute this test after postTestSubscribe
    // to be sure that AuthorizationHandler is installed
    suite.addTest(new TestOperationSetPresence("postTestReceiveAuthorizatinonRequest"));

    return suite;
  }
コード例 #6
0
  public static Test suite() {
    TestSuite suite = new TestSuite();

    suite.addTest(new TestHistoryService("testCreateDB"));
    suite.addTest(new TestHistoryService("testWriteRecords"));
    suite.addTest(new TestHistoryService("testReadRecords"));
    suite.addTest(new TestHistoryService("testPurgeLocallyStoredHistory"));
    suite.addTest(new TestHistoryService("testCreatingHistoryIDFromFS"));
    suite.addTest(new TestHistoryService("testWriteRecordsWithMaxNumber"));

    return suite;
  }
コード例 #7
0
 /**
  * Create TestSuite with all suites running all options.
  *
  * @param suites the String[] of paths to harness test suite files
  * @param options the String[][] of option sets to run (may be null)
  * @return Test with all TestSuites and TestCases specified in suites and options.
  */
 public static TestSuite suite(String name, String[] suites, String[][] options) {
   if (null == name) {
     name = AjcHarnessTestsUsingJUnit.class.getName();
   }
   TestSuite suite = new TestSuite(name);
   if (!HarnessJUnitUtil.isEmpty(suites)) {
     if (HarnessJUnitUtil.isEmpty(options)) {
       options = new String[][] {new String[0]};
     }
     for (int i = 0; i < suites.length; i++) {
       for (int j = 0; j < options.length; j++) {
         Test t = AjctestsAdapter.make(suites[i], options[j]);
         suite.addTest(t);
       }
     }
   }
   return suite;
 }
  public static TestSuite getParameterBinaryOperatorTests() {
    TestSuite theSuite = new TestSuite();

    theSuite.setName("Parameter Binary Operator Test Suite");
    theSuite.addTest(BinaryOperatorWithParameterTest.getNumericParameterGreaterThanTest());
    theSuite.addTest(BinaryOperatorWithParameterTest.getNumericParameterGreaterThanEqualTest());
    theSuite.addTest(BinaryOperatorWithParameterTest.getNumericParameterLessThanTest());
    theSuite.addTest(BinaryOperatorWithParameterTest.getNumericParameterLessThanEqualTest());
    theSuite.addTest(BinaryOperatorWithParameterTest.getNumericParameterPlusTest());
    theSuite.addTest(
        BinaryOperatorWithParameterTest.getNumericParameterPlusTestWithBracketsBeforeComparison());
    theSuite.addTest(
        BinaryOperatorWithParameterTest.getNumericParameterPlusTestWithBracketsAfterComparison());
    theSuite.addTest(BinaryOperatorWithParameterTest.getNumericParameterMinusTest());
    theSuite.addTest(
        BinaryOperatorWithParameterTest.getNumericParameterMinusTestWithBracketsBeforeComparison());
    theSuite.addTest(
        BinaryOperatorWithParameterTest.getNumericParameterMinusTestWithBracketsAfterComparison());
    theSuite.addTest(BinaryOperatorWithParameterTest.getNumericParameterMultiplyTest());
    theSuite.addTest(
        BinaryOperatorWithParameterTest
            .getNumericParameterMultiplyTestWithBracketsBeforeComparison());
    theSuite.addTest(
        BinaryOperatorWithParameterTest
            .getNumericParameterMultiplyTestWithBracketsAfterComparison());
    theSuite.addTest(BinaryOperatorWithParameterTest.getNumericParameterDivideTest());
    theSuite.addTest(
        BinaryOperatorWithParameterTest
            .getNumericParameterDivideTestWithBracketsBeforeComparison());
    theSuite.addTest(
        BinaryOperatorWithParameterTest.getNumericParameterDivideTestWithBracketsAfterComparison());
    theSuite.addTest(BinaryOperatorWithParameterTest.getNumericTwoParameterMultipleOperators());
    theSuite.addTest(
        BinaryOperatorWithParameterTest
            .getNumericTwoParameterMultipleOperatorsWithBracketsAroundPlusMinus());
    theSuite.addTest(
        BinaryOperatorWithParameterTest
            .getNumericTwoParameterMultipleOperatorsWithBracketsAroundMultiply());
    return theSuite;
  }