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());
   }
 }
Exemple #2
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:    */ }
Exemple #3
0
 protected void runFullSuite(final RunNotifier notifier) {
   JUnitHelper helper = createJUnitHelper(notifier);
   try {
     helper.assertSuitePasses(suiteName, suiteFilter, excludeSuiteFilter);
   } catch (AssertionFailedError e) {
     notifier.fireTestFailure(new Failure(Description.createSuiteDescription(suiteClass), e));
   } catch (Exception e) {
     notifier.fireTestFailure(new Failure(Description.createSuiteDescription(suiteClass), e));
   }
 }
Exemple #4
0
 @Override
 protected void runChild(String test, RunNotifier notifier) {
   JUnitHelper helper = createJUnitHelper(notifier);
   try {
     helper.assertTestPasses(test);
   } catch (AssertionFailedError e) {
     notifier.fireTestFailure(new Failure(Description.createSuiteDescription(suiteClass), e));
   } catch (Exception e) {
     notifier.fireTestFailure(new Failure(Description.createSuiteDescription(suiteClass), e));
   }
 }
 protected void notifyOfTestSystemException(String testSystemName, Throwable cause) {
   if (cause != null) {
     Exception e =
         new Exception("Exception while executing tests using: " + testSystemName, cause);
     notifier.fireTestFailure(new Failure(Description.createSuiteDescription(mainClass), e));
   }
 }
Exemple #6
0
 @Override
 public Description getDescription() {
   Description description =
       Description.createSuiteDescription(getName(), fTestClass.getAnnotations());
   for (T child : getFilteredChildren()) description.addChild(describeChild(child));
   return description;
 }
 @Override
 protected Description describeChild(FrameworkMethod method) {
   if (method != fakeMethod) {
     return super.describeChild(method);
   }
   return Description.createSuiteDescription(getTestClass().getJavaClass());
 }
Exemple #8
0
 @Override
 public Description getDescription() {
   Description description = Description.createSuiteDescription(getName(), getRunnerAnnotations());
   for (T child : getFilteredChildren()) {
     description.addChild(describeChild(child));
   }
   return description;
 }
Exemple #9
0
 @Override
 public Description getDescription() {
   if (myDescription == null) {
     myDescription =
         Description.createSuiteDescription("\"" + ourMPSProject.getName() + "\" project opened");
   }
   return myDescription;
 }
 @Override
 public Description getDescription() {
   Description spec = Description.createSuiteDescription(getName(), classAnnotations());
   List<JUnit4TestMethod> testMethods = m_testMethods;
   for (JUnit4TestMethod method : testMethods) {
     spec.addChild(methodDescription(method));
   }
   return spec;
 }
 public ScenarioRunner4JUnit(
     final Scenario scenario, final Map<String, KieSession> ksessions, final int maxRuleFirings)
     throws InitializationError {
   this.scenarios = new ArrayList<Scenario>();
   this.scenarios.add(scenario);
   this.ksessions = ksessions;
   this.descr = Description.createSuiteDescription("Scenario test cases");
   this.maxRuleFirings = maxRuleFirings;
 }
 @Override
 public Description getDescription() {
   if (this.desc == null) {
     this.desc =
         Description.createSuiteDescription(
             suite.getSuiteClass().getName(), suite.getSuiteClass().getAnnotations());
   }
   return this.desc;
 }
Exemple #13
0
 @Override
 public Description getDescription() {
   if (description == null) {
     description = Description.createSuiteDescription(getName(), cucumberExamples.getExamples());
     for (Runner child : getChildren()) {
       description.addChild(describeChild(child));
     }
   }
   return description;
 }
 @Override
 public void close() {
   if (completedTests != totalNumberOfTests) {
     String msg =
         String.format(
             "Not all tests executed. Completed %s of %s tests.",
             completedTests, totalNumberOfTests);
     Exception e = new Exception(msg);
     notifier.fireTestFailure(new Failure(Description.createSuiteDescription(mainClass), e));
   }
 }
Exemple #15
0
 @Override
 public Description getDescription() {
   Description desc = Description.createSuiteDescription(myClassName);
   if (myTests == null) {
     desc.addChild(createTestDescription(ModuleSymbolicSuite.NO_TESTS));
   } else {
     for (String test : myTests) {
       desc.addChild(createTestDescription(test));
     }
   }
   return desc;
 }
Exemple #16
0
 private void findLeaves(Description parent, Description description, List<Description> results) {
   if (description.getChildren().isEmpty()) {
     if (description.toString().equals("warning(junit.framework.TestSuite$1)")) {
       results.add(
           Description.createSuiteDescription(MALFORMED_JUNIT_3_TEST_CLASS_PREFIX + parent));
     } else {
       results.add(description);
     }
   } else {
     for (Description each : description.getChildren()) {
       findLeaves(description, each, results);
     }
   }
 }
 Description describeMethod() {
   Object[] params = paramsFromAnnotation();
   Description parametrised = Description.createSuiteDescription(method.name());
   for (int i = 0; i < params.length; i++) {
     /*
     Object paramSet = params[i];
     parametrised.addChild(Description.createTestDescription(method.frameworkMethod.getMethod().getDeclaringClass(),
             Utils.stringify(paramSet, i) + " (" + method.name() + ")", method.frameworkMethod.getAnnotations()));
             */
     parametrised.addChild(
         Description.createTestDescription(
             method.frameworkMethod.getMethod().getDeclaringClass(),
             method.name() + " [" + i + "]",
             method.frameworkMethod.getAnnotations()));
   }
   return parametrised;
 }
 private void build() {
   this.description = Description.createSuiteDescription(this.suiteClass);
   final Method[] methods = this.suiteClass.getMethods();
   if (!ArrayUtils.isEmpty(methods)) {
     this.testMethod = new TestMethod[methods.length];
     int index = 0;
     for (Method method : methods) {
       this.addTestMethod(new TestMethodImpl(method), index++);
     }
     Arrays.sort(this.getTestMethods(), TestMethodComparator.getInstance());
   }
   this.annotations = this.suiteClass.getAnnotations();
   this.qunitReqources = this.suiteClass.getAnnotation(QUnitResources.class).value();
   final Method deployMethod =
       ReflectOperations.findFirstMethodWithAnnotation(
           getSuiteClass().getMethods(), Deployment.class);
   this.deploymentMethod = (deployMethod != null) ? new DeploymentMethodImpl(deployMethod) : null;
   return;
 }
Exemple #19
0
 private Description createTestDescription(String text) {
   // this is the only way to construct Description from string
   return Description.createSuiteDescription(String.format("%s(%s)", text, myClassName));
 }
 /** {@inheritDoc} */
 @Override
 public Description getDescription() {
   return Description.createSuiteDescription(cls);
 }
Exemple #21
0
 private Description parentDescription(Description description) {
   // TODO: how heavy are we cringing?
   return Description.createSuiteDescription(description.getTestClass());
 }
 @Override
 public Description getDescription() {
   Description suite = Description.createSuiteDescription(clas);
   filteredTests.foreachDoEffect(p -> suite.addChild(p._3()));
   return suite;
 }
 /**
  * {@inheritDoc}
  *
  * <p>We override this method so that the JUnit results are not displayed in a test hierarchy with
  * a single test result for each node (as it would be otherwise since RenderingTest has a single
  * test method).
  */
 @Override
 public Description getDescription() {
   return Description.createSuiteDescription(getTestClass().getJavaClass());
 }