Package org.junit.runner

Examples of org.junit.runner.Description


            return new DefaultTestDescriptor(id, className, methodName);
        }
        // JUnit4TestCaseFacade is-a Describable in junit 4.7+
        if (test instanceof Describable) {
            Describable describable = (Describable) test;
            Description description = describable.getDescription();
            return new DefaultTestDescriptor(id, description.getClassName(), description.getMethodName());
        }
        return super.convert(id, test);
    }
View Full Code Here


public class TestDescriptionInterceptor implements HttpRequestInterceptor{
    public static final String TEST_NAME_HEADER = "sling.test.name";
    public static final String TEST_CLASS_HEADER = "sling.test.class";

    public void process(HttpRequest httpRequest, HttpContext httpContext) throws HttpException, IOException {
       final Description desc = TestDescriptionRule.getCurrentTestDescription();
        if(desc != null){
            httpRequest.addHeader(TEST_NAME_HEADER,desc.getMethodName());
            httpRequest.addHeader(TEST_CLASS_HEADER,desc.getClassName());
        }
    }
View Full Code Here

                        each.run(notifier);
        }

        @Override
        public Description getDescription() {
                Description spec= Description.createSuiteDescription(ExampleGraph.class);
                for (Runner runner : fRunners)
                        spec.addChild(runner.getDescription());
                return spec;
        }
View Full Code Here

        return new UnderscoredToCapitalized();
    }

    @Override
    public Description getDescription() {
        Description description = Description.createSuiteDescription(testClass());
        for (String path : paths)
            description.addChild(createDescriptionForPath(path));

        return description;
    }
View Full Code Here

   
  }
 
  @Override
  public Description getDescription() {   
    Description desc = Description.createSuiteDescription(prefix);
    this.desc = desc;
   
    try {
      List<String> modules = getRecursiveModuleList(URIUtil.create("rascal", "", "/" + prefix.replaceAll("::", "/")), evaluator.getResolverRegistry());
     
      for (String module : modules) {
        String name = prefix + "::" + module;
       
        try {
          evaluator.doImport(new NullRascalMonitor(), name);
        }
        catch (Throwable e) {
          throw new RuntimeException("Could not import " + name + " for testing...", e);
        }
       
        Description modDesc = Description.createSuiteDescription(name);
        desc.addChild(modDesc);
       
        for (AbstractFunction f : heap.getModule(name.replaceAll("\\\\","")).getTests()) {
          if (!(f.hasTag("ignore") || f.hasTag("Ignore") || f.hasTag("ignoreInterpreter") || f.hasTag("IgnoreInterpreter"))) {
            modDesc.addChild(Description.createTestDescription(getClass(), computeTestName(f.getName(), f.getAst().getLocation())));
          }
        }
      }
     
   
View Full Code Here

      notifier.fireTestRunStarted(module);
    }
 
    @Override
    public void report(boolean successful, String test, ISourceLocation loc,  String message, Throwable t) {
      Description desc = getDescription(test, loc);
      notifier.fireTestStarted(desc);
     
      if (!successful) {
        notifier.fireTestFailure(new Failure(desc, t != null ? t : new Exception(message != null ? message : "no message")));
      }
View Full Code Here

            testCase.with(new Local(testCase.getClass().getMethod(testCase.getName())));
        }
    }
    class RuleRunnerImpl extends JenkinsRecipe.Runner<LocalData> {
        public void setup(JenkinsRule jenkinsRule, LocalData recipe) throws Exception {
            Description desc = jenkinsRule.getTestDescription();
            jenkinsRule.with(new Local(desc.getTestClass().getMethod(desc.getMethodName())));
        }
View Full Code Here

        Description.createSuiteDescription((String) null);
    }

    @Test
    public void parseClassAndMethodNoAnnotations() throws Exception {
        Description description = Description.createTestDescription(Description.class, "aTestMethod");

        assertThat(description.getClassName(), equalTo("org.junit.runner.Description"));
        assertThat(description.getMethodName(), equalTo("aTestMethod"));
        assertThat(description.getAnnotations().size(), equalTo(0));
    }
View Full Code Here

    @Test
    public void parseClassAndMethodWithAnnotations() throws Exception {
        Annotation[] annotations =
                DescriptionTest.class.getMethod("parseClassAndMethodWithAnnotations").getDeclaredAnnotations();

        Description description = Description.createTestDescription(Description.class, "aTestMethod", annotations);

        assertThat(description.getClassName(), equalTo("org.junit.runner.Description"));
        assertThat(description.getMethodName(), equalTo("aTestMethod"));
        assertThat(description.getAnnotations().size(), equalTo(1));
    }
View Full Code Here

        assertThat(description.getAnnotations().size(), equalTo(1));
    }

    @Test
    public void parseClassNameAndMethodUniqueId() throws Exception {
        Description description = Description.createTestDescription("not a class name", "aTestMethod", 123);

        assertThat(description.getClassName(), equalTo("not a class name"));
        assertThat(description.getMethodName(), equalTo("aTestMethod"));
        assertThat(description.getAnnotations().size(), equalTo(0));
    }
View Full Code Here

TOP

Related Classes of org.junit.runner.Description

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.