Beispiel #1
0
 private static Description makeDescription(Test test) {
   if (test instanceof TestCase) {
     TestCase tc = (TestCase) test;
     return Description.createTestDescription(tc.getClass(), tc.getName(), getAnnotations(tc));
   } else if (test instanceof TestSuite) {
     TestSuite ts = (TestSuite) test;
     String name = ts.getName() == null ? createSuiteDescription(ts) : ts.getName();
     Description description = Description.createSuiteDescription(name);
     int n = ts.testCount();
     for (int i = 0; i < n; i++) {
       Description made = makeDescription(ts.testAt(i));
       description.addChild(made);
     }
     return description;
   } else if (test instanceof Describable) {
     Describable adapter = (Describable) test;
     return adapter.getDescription();
   } else if (test instanceof TestDecorator) {
     TestDecorator decorator = (TestDecorator) test;
     return makeDescription(decorator.getTest());
   } else {
     // This is the best we can do in this case
     return Description.createSuiteDescription(test.getClass());
   }
 }
 public SuiteInfo(TestSuite suite) {
   this.suite = suite;
   name = suite.getName();
   name = name.substring(name.lastIndexOf('.') + 1);
   className = suite.getName();
   testCount = suite.countTestCases();
   result = new TestResult();
   result.addListener(this);
 }
  /**
   * Copies non-distributed test suite into distributed one.
   *
   * @param suite Test suite to copy.
   */
  public GridJunit3TestSuite(TestSuite suite) {
    super(suite.getName());

    if (copy == null) {
      copy = new TestSuite(suite.getName());
    }

    for (int i = 0; i < suite.testCount(); i++) {
      addTest(suite.testAt(i));
    }
  }
Beispiel #4
0
 /* 109:    */
 /* 110:    */ private static Description makeDescription(Test test) /* 111:    */ {
   /* 112: 96 */ if ((test instanceof TestCase))
   /* 113:    */ {
     /* 114: 97 */ TestCase tc = (TestCase) test;
     /* 115: 98 */ return Description.createTestDescription(tc.getClass(), tc.getName());
     /* 116:    */ }
   /* 117: 99 */ if ((test instanceof TestSuite))
   /* 118:    */ {
     /* 119:100 */ TestSuite ts = (TestSuite) test;
     /* 120:101 */ String name = ts.getName() == null ? createSuiteDescription(ts) : ts.getName();
     /* 121:102 */ Description description =
         Description.createSuiteDescription(name, new Annotation[0]);
     /* 122:103 */ int n = ts.testCount();
     /* 123:104 */ for (int i = 0; i < n; i++)
     /* 124:    */ {
       /* 125:105 */ Description made = makeDescription(ts.testAt(i));
       /* 126:106 */ description.addChild(made);
       /* 127:    */ }
     /* 128:108 */ return description;
     /* 129:    */ }
   /* 130:109 */ if ((test instanceof Describable))
   /* 131:    */ {
     /* 132:110 */ Describable adapter = (Describable) test;
     /* 133:111 */ return adapter.getDescription();
     /* 134:    */ }
   /* 135:112 */ if ((test instanceof TestDecorator))
   /* 136:    */ {
     /* 137:113 */ TestDecorator decorator = (TestDecorator) test;
     /* 138:114 */ return makeDescription(decorator.getTest());
     /* 139:    */ }
   /* 140:117 */ return Description.createSuiteDescription(test.getClass());
   /* 141:    */ }
  /**
   * @param suite Test suite to wrap.
   * @param factory Proxy factory.
   */
  GridJunit3TestSuiteProxy(TestSuite suite, GridJunit3ProxyFactory factory) {
    assert suite != null;
    assert factory != null;

    original = suite;

    setName(suite.getName());

    this.factory = factory;

    for (int i = 0; i < suite.testCount(); i++) {
      addTest(suite.testAt(i));
    }
  }
Beispiel #6
0
 public void filter(Filter filter) throws NoTestsRemainException {
   if (getTest() instanceof Filterable) {
     Filterable adapter = (Filterable) getTest();
     adapter.filter(filter);
   } else if (getTest() instanceof TestSuite) {
     TestSuite suite = (TestSuite) getTest();
     TestSuite filtered = new TestSuite(suite.getName());
     int n = suite.testCount();
     for (int i = 0; i < n; i++) {
       Test test = suite.testAt(i);
       if (filter.shouldRun(makeDescription(test))) {
         filtered.addTest(test);
       }
     }
     setTest(filtered);
   }
 }
Beispiel #7
0
 /* 149:    */
 /* 150:    */ public void filter(Filter filter) /* 151:    */ throws NoTestsRemainException
       /* 152:    */ {
   /* 153:128 */ if ((getTest() instanceof Filterable))
   /* 154:    */ {
     /* 155:129 */ Filterable adapter = (Filterable) getTest();
     /* 156:130 */ adapter.filter(filter);
     /* 157:    */ }
   /* 158:131 */ else if ((getTest() instanceof TestSuite))
   /* 159:    */ {
     /* 160:132 */ TestSuite suite = (TestSuite) getTest();
     /* 161:133 */ TestSuite filtered = new TestSuite(suite.getName());
     /* 162:134 */ int n = suite.testCount();
     /* 163:135 */ for (int i = 0; i < n; i++)
     /* 164:    */ {
       /* 165:136 */ Test test = suite.testAt(i);
       /* 166:137 */ if (filter.shouldRun(makeDescription(test))) {
         /* 167:138 */ filtered.addTest(test);
         /* 168:    */ }
       /* 169:    */ }
     /* 170:140 */ setTest(filtered);
     /* 171:    */ }
   /* 172:    */ }
Beispiel #8
0
 PluginTestSetup(TestSuite test, HivePdkUnitTests unitTests) {
   super(test);
   this.name = test.getName();
   this.unitTests = unitTests;
 }
 @Override
 public void startTestSuite(TestSuite suite) {
   println("\nstarting test suite: " + suite.getName());
 }