org.junit.runner.Runner#getDescription()源码实例Demo

下面列出了org.junit.runner.Runner#getDescription() 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

private void initExecutions() {
    if (executions.isEmpty()) {
        try {
            Runner descriptionProvider = createRunnerFor(Arrays.asList(target), Collections.<Filter>emptyList());
            templateDescription = descriptionProvider.getDescription();
        } catch (InitializationError initializationError) {
            throw UncheckedException.throwAsUncheckedException(initializationError);
        }
        createExecutions();
        for (Execution execution : executions) {
            execution.init(target, templateDescription);
        }
    }
}
 
List<Description> getAllDescriptions(Description description, String className) {
    final AllExceptIgnoredTestRunnerBuilder allExceptIgnoredTestRunnerBuilder = new AllExceptIgnoredTestRunnerBuilder();
    try {
        final Class<?> testClass = description.getClass().getClassLoader().loadClass(className);
        Runner runner = allExceptIgnoredTestRunnerBuilder.runnerForClass(testClass);
        if (runner == null) {
            //fall back to default runner
            runner = Request.aClass(testClass).getRunner();
        }
        final Description runnerDescription = runner.getDescription();
        return runnerDescription.getChildren();
    } catch (Throwable throwable) {
        throw new TestSuiteExecutionException(String.format("Unable to process Ignored class %s.", className), throwable);
    }
}
 
private void initExecutions() {
    if (executions.isEmpty()) {
        try {
            Runner descriptionProvider = createRunnerFor(Arrays.asList(target), Collections.<Filter>emptyList());
            templateDescription = descriptionProvider.getDescription();
        } catch (InitializationError initializationError) {
            throw UncheckedException.throwAsUncheckedException(initializationError);
        }
        createExecutions();
        for (Execution execution : executions) {
            execution.init(target, templateDescription);
        }
    }
}
 
List<Description> getAllDescriptions(Description description, String className) {
    final AllExceptIgnoredTestRunnerBuilder allExceptIgnoredTestRunnerBuilder = new AllExceptIgnoredTestRunnerBuilder();
    try {
        final Class<?> testClass = description.getClass().getClassLoader().loadClass(className);
        Runner runner = allExceptIgnoredTestRunnerBuilder.runnerForClass(testClass);
        if (runner == null) {
            //fall back to default runner
            runner = Request.aClass(testClass).getRunner();
        }
        final Description runnerDescription = runner.getDescription();
        return runnerDescription.getChildren();
    } catch (Throwable throwable) {
        throw new TestSuiteExecutionException(String.format("Unable to process Ignored class %s.", className), throwable);
    }
}
 
private Description getRootDescription(Runner runner, DescriptionMatcher matcher) {
	Description current= runner.getDescription();
	while (true) {
		List<Description> children= current.getChildren();
		if (children.size() != 1 || matcher.matches(current))
			return current;
		current= children.get(0);
	}
}
 
源代码6 项目: Pushjet-Android   文件: AbstractMultiTestRunner.java
private void initExecutions() {
    if (executions.isEmpty()) {
        try {
            Runner descriptionProvider = createRunnerFor(Arrays.asList(target), Collections.<Filter>emptyList());
            templateDescription = descriptionProvider.getDescription();
        } catch (InitializationError initializationError) {
            throw UncheckedException.throwAsUncheckedException(initializationError);
        }
        createExecutions();
        for (Execution execution : executions) {
            execution.init(target, templateDescription);
        }
    }
}
 
List<Description> getAllDescriptions(Description description, String className) {
    final AllExceptIgnoredTestRunnerBuilder allExceptIgnoredTestRunnerBuilder = new AllExceptIgnoredTestRunnerBuilder();
    try {
        final Class<?> testClass = description.getClass().getClassLoader().loadClass(className);
        Runner runner = allExceptIgnoredTestRunnerBuilder.runnerForClass(testClass);
        if (runner == null) {
            //fall back to default runner
            runner = Request.aClass(testClass).getRunner();
        }
        final Description runnerDescription = runner.getDescription();
        return runnerDescription.getChildren();
    } catch (Throwable throwable) {
        throw new TestSuiteExecutionException(String.format("Unable to process Ignored class %s.", className), throwable);
    }
}
 
源代码8 项目: Pushjet-Android   文件: AbstractMultiTestRunner.java
private void initExecutions() {
    if (executions.isEmpty()) {
        try {
            Runner descriptionProvider = createRunnerFor(Arrays.asList(target), Collections.<Filter>emptyList());
            templateDescription = descriptionProvider.getDescription();
        } catch (InitializationError initializationError) {
            throw UncheckedException.throwAsUncheckedException(initializationError);
        }
        createExecutions();
        for (Execution execution : executions) {
            execution.init(target, templateDescription);
        }
    }
}
 
List<Description> getAllDescriptions(Description description, String className) {
    final AllExceptIgnoredTestRunnerBuilder allExceptIgnoredTestRunnerBuilder = new AllExceptIgnoredTestRunnerBuilder();
    try {
        final Class<?> testClass = description.getClass().getClassLoader().loadClass(className);
        Runner runner = allExceptIgnoredTestRunnerBuilder.runnerForClass(testClass);
        if (runner == null) {
            //fall back to default runner
            runner = Request.aClass(testClass).getRunner();
        }
        final Description runnerDescription = runner.getDescription();
        return runnerDescription.getChildren();
    } catch (Throwable throwable) {
        throw new TestSuiteExecutionException(String.format("Unable to process Ignored class %s.", className), throwable);
    }
}
 
源代码10 项目: firebase-android-sdk   文件: SmokeTestSuite.java
@Override
protected Description describeChild(Runner runner) {
  return runner.getDescription();
}
 
源代码11 项目: xtext-eclipse   文件: AllScenariosRunner.java
@Override
protected Description describeChild(Runner child) {
	return child.getDescription();
}
 
private ITestReference createUnfilteredTest(Class<?> clazz, String[] failureNames) {
	Request request= sortByFailures(Request.aClass(clazz), failureNames);
	Runner runner= request.getRunner();
	Description description= runner.getDescription();
	return new HybrisJUnitTestReference(runner, description);
}
 
源代码13 项目: xtext-core   文件: AllScenariosRunner.java
@Override
protected Description describeChild(Runner child) {
	return child.getDescription();
}
 
源代码14 项目: lambda-behave   文件: JunitSuiteRunner.java
@Override
protected org.junit.runner.Description describeChild(Runner child) {
       return child.getDescription();
}
 
源代码15 项目: selenium   文件: JavaScriptTestSuite.java
@Override
protected Description describeChild(Runner child) {
  return child.getDescription();
}
 
源代码16 项目: metafacture-core   文件: MetamorphTestSuite.java
@Override
protected Description describeChild(final Runner child) {
    return child.getDescription();
}
 
 方法所在类