本文整理汇总了Java中org.junit.runner.notification.RunNotifier.fireTestFinished方法的典型用法代码示例。如果您正苦于以下问题:Java RunNotifier.fireTestFinished方法的具体用法?Java RunNotifier.fireTestFinished怎么用?Java RunNotifier.fireTestFinished使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.junit.runner.notification.RunNotifier
的用法示例。
在下文中一共展示了RunNotifier.fireTestFinished方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: runChild
import org.junit.runner.notification.RunNotifier; //导入方法依赖的package包/类
@Override
protected void runChild(final ArchTestExecution child, final RunNotifier notifier) {
ExpectedViolation expectedViolation = ExpectedViolation.none();
HandlingAssertion handlingAssertion = HandlingAssertion.none();
Description description = describeChild(child);
notifier.fireTestStarted(description);
try {
ExpectedViolationDefinition violationDefinition = extractExpectedConfiguration(child);
violationDefinition.configure(expectedViolation);
violationDefinition.configure(handlingAssertion);
expectedViolation.apply(new IntegrationTestStatement(child, handlingAssertion), description).evaluate();
} catch (Throwable throwable) {
notifier.fireTestFailure(new Failure(description, throwable));
} finally {
notifier.fireTestFinished(description);
}
}
示例2: runChild
import org.junit.runner.notification.RunNotifier; //导入方法依赖的package包/类
/**
* Runs the test corresponding to {@code child}, which can be assumed to be
* an element of the list returned by {@link ParentRunner#getChildren()}.
* Subclasses are responsible for making sure that relevant test events are
* reported through {@code notifier}
*
* @param child
* @param notifier
*/
@Override
protected void runChild(ScenarioSpec child, RunNotifier notifier) {
final Description description = Description.createTestDescription(testClass, child.getScenarioName());
// Notify that this single test has been started.
// Supply the scenario/journey name
notifier.fireTestStarted(description);
passed = getInjectedMultiStepsRunner().runScenario(child, notifier, description);
testRunCompleted = true;
if (passed) {
logger.info(String.format("\nPackageRunner- **FINISHED executing all Steps for [%s] **.\nSteps were:%s",
child.getScenarioName(),
child.getSteps().stream().map(step -> step.getName()).collect(Collectors.toList())));
}
notifier.fireTestFinished(description);
}
示例3: prepareMethodBlock
import org.junit.runner.notification.RunNotifier; //导入方法依赖的package包/类
protected Statement prepareMethodBlock(final FrameworkMethod method, final RunNotifier notifier) {
final Statement methodBlock = superMethodBlock(method);
return new Statement() {
@Override
public void evaluate() throws Throwable {
try {
methodBlock.evaluate();
Description description = describeChild(method);
try {
notifier.fireTestStarted(description);
notifier.fireTestAssumptionFailed(new Failure(description, new AssumptionViolatedException("Method " + method.getName() + " did parse any input")));
} finally {
notifier.fireTestFinished(description);
}
} catch(TestDataCarrier testData) {
AbstractParallelScenarioRunner.this.testData.put(method, testData.getData());
}
}
};
}
示例4: run
import org.junit.runner.notification.RunNotifier; //导入方法依赖的package包/类
@Override
public void run(RunNotifier notifier) {
Description description = getDescription();
notifier.fireTestStarted(description);
notifier.fireTestFailure(new Failure(description, failure));
notifier.fireTestFinished(description);
}
示例5: runChild
import org.junit.runner.notification.RunNotifier; //导入方法依赖的package包/类
@Override
protected void runChild(TestCases.TestCase testCase, RunNotifier runNotifier) {
Description description = this.children.get( testCase );
try {
runNotifier.fireTestStarted( description );
vendorSuite.beforeTest( description, context, testCase );
TestResult result = vendorSuite.executeTest( description, context, testCase );
switch ( result.getResult() ) {
case SUCCESS:
runNotifier.fireTestFinished( description );
break;
case IGNORED:
runNotifier.fireTestIgnored( description );
break;
case ERROR:
runNotifier.fireTestFailure(new Failure(description, new RuntimeException(result.toStringWithLines())));
break;
}
if (resultFile != null) {
String relativePath = relativePath(folder);
resultFile.append( String.format( "\"%s\",\"%s\",\"%s\",\"%s\",\"%s\"\n", relativePath, description.getClassName(), description.getMethodName(),
result.getResult().toString(), result.getMsg() ) );
}
} catch ( IOException e ) {
e.printStackTrace();
} finally {
vendorSuite.afterTest( description, context, testCase );
runNotifier.fireTestFinished(description);
}
}
示例6: testJSJVMBackendFrameworkMethod
import org.junit.runner.notification.RunNotifier; //导入方法依赖的package包/类
private void testJSJVMBackendFrameworkMethod(FrameworkMethod aFrameworkMethod, RunNotifier aRunNotifier) {
Description theDescription = Description.createTestDescription(testClass.getJavaClass(), aFrameworkMethod.getName() + " JVM Target");
aRunNotifier.fireTestStarted(theDescription);
try {
// Simply invoke using reflection
Object theInstance = testClass.getJavaClass().getDeclaredConstructor().newInstance();
Method theMethod = aFrameworkMethod.getMethod();
theMethod.invoke(theInstance);
aRunNotifier.fireTestFinished(theDescription);
} catch (Exception e) {
aRunNotifier.fireTestFailure(new Failure(theDescription, e));
}
}
示例7: runChild
import org.junit.runner.notification.RunNotifier; //导入方法依赖的package包/类
@Override
protected void runChild(ArchTestExecution child, RunNotifier notifier) {
if (child.ignore()) {
notifier.fireTestIgnored(describeChild(child));
} else {
notifier.fireTestStarted(describeChild(child));
JavaClasses classes = cache.get().getClassesToAnalyzeFor(getTestClass().getJavaClass());
child.evaluateOn(classes).notify(notifier);
notifier.fireTestFinished(describeChild(child));
}
}
示例8: shutdownRerun
import org.junit.runner.notification.RunNotifier; //导入方法依赖的package包/类
private void shutdownRerun(RunNotifier notifier) {
double percentageOfFailedTests = statisticsHelper.getPercentageOfFailedTests(statisticsFile);
int failedTestsNumber = statisticsHelper.getNumberOfFailedTests(statisticsFile);
if (failedTestsNumber == 0) {
notifier.fireTestFinished(Description.EMPTY);
} else if (percentageOfFailedTests > maxFailedTestPercentage) {
String failureMessage = "Percentage of failed tests was bigger than " + maxFailedTestPercentage + ".";
Failure failure = new Failure(Description.createSuiteDescription(failureMessage),
new TooManyTestsToRerunException(failureMessage));
notifier.fireTestFailure(failure);
}
}
示例9: run
import org.junit.runner.notification.RunNotifier; //导入方法依赖的package包/类
@Override
public void run(RunNotifier notifier) {
if (failure != null) {
reportInitializationFailure(notifier, description, failure);
return;
}
for (Map.Entry<String, Description> entry : tests.entrySet()) {
Description testDescription = entry.getValue();
FileTester tester;
try {
tester = createTester(entry.getKey());
} catch (IOException e) {
reportInitializationFailure(notifier, testDescription, e);
continue;
}
if (tester == null) {
notifier.fireTestIgnored(testDescription);
continue;
}
notifier.fireTestStarted(testDescription);
try {
tester.runTest();
} catch (Throwable t) {
notifier.fireTestFailure(new Failure(testDescription, t));
}
notifier.fireTestFinished(testDescription);
}
}
示例10: run
import org.junit.runner.notification.RunNotifier; //导入方法依赖的package包/类
public void run(RunNotifier notifier) {
for (JmesPathComplianceTest.ComplianceTest<T> complianceTest : getAllTests()) {
Description testDescription = createDescription(complianceTest);
notifier.fireTestStarted(testDescription);
try {
complianceTest.run();
} catch (AssertionError ae) {
notifier.fireTestFailure(new Failure(testDescription, ae));
} catch (Exception e) {
notifier.fireTestFailure(new Failure(testDescription, e));
} finally {
notifier.fireTestFinished(testDescription);
}
}
}
示例11: run
import org.junit.runner.notification.RunNotifier; //导入方法依赖的package包/类
@Override
public void run( final RunNotifier notifier )
{
for ( final ScriptTestInstance file : this.testFiles )
{
for ( final ScriptTestMethod method : file.getTestMethods() )
{
final Description desc = Description.createTestDescription( file.getName(), method.getName() );
notifier.fireTestStarted( desc );
try
{
runBefore( file );
method.runTest( this.testInstance );
runAfter( file );
}
catch ( final Throwable e )
{
notifier.fireTestFailure( new Failure( desc, e ) );
}
finally
{
notifier.fireTestFinished( desc );
}
}
file.dispose();
}
}
示例12: testAborted
import org.junit.runner.notification.RunNotifier; //导入方法依赖的package包/类
private void testAborted(RunNotifier notifier, Description description,
Throwable e) {
notifier.fireTestStarted(description);
notifier.fireTestFailure(new Failure(description, e));
notifier.fireTestFinished(description);
}
示例13: reportInitializationFailure
import org.junit.runner.notification.RunNotifier; //导入方法依赖的package包/类
private void reportInitializationFailure(RunNotifier notifier, Description description, Throwable throwable) {
notifier.fireTestStarted(description);
notifier.fireTestFailure(new Failure(description, throwable));
notifier.fireTestFinished(description);
}
示例14: runChild
import org.junit.runner.notification.RunNotifier; //导入方法依赖的package包/类
@Override
protected void runChild(FrameworkMethod method, RunNotifier notifier) {
final Description description = describeChild(method);
if (isIgnored(method)) {
notifier.fireTestIgnored(description);
} else {
JsonTestCase annotation = method.getMethod().getAnnotation(JsonTestCase.class);
if (annotation != null) {
currentTestCase = annotation.value();
} else {
currentTestCase = method.getName();
}
notifier.fireTestStarted(description);
logger.debug("### Running currentTestCase : " + currentTestCase);
ScenarioSpec child = null;
try {
child = smartUtils.jsonFileToJava(currentTestCase, ScenarioSpec.class);
logger.debug("### Found currentTestCase : -" + child);
final ZeroCodeMultiStepsScenarioRunner multiStepsRunner = getInjectedMultiStepsRunner();
/*
* Override the properties file containing hosts and ports with HostProperties
* only if the annotation is present on the runner.
*/
if (hostProperties != null) {
((ZeroCodeMultiStepsScenarioRunnerImpl) multiStepsRunner).overrideHost(host);
((ZeroCodeMultiStepsScenarioRunnerImpl) multiStepsRunner).overridePort(port);
((ZeroCodeMultiStepsScenarioRunnerImpl) multiStepsRunner).overrideApplicationContext(context);
}
passed = multiStepsRunner.runScenario(child, notifier, description);
} catch (Exception ioEx) {
ioEx.printStackTrace();
notifier.fireTestFailure(new Failure(description, ioEx));
}
testRunCompleted = true;
if (passed) {
logger.info(String.format("\n**FINISHED executing all Steps for [%s] **.\nSteps were:%s",
child.getScenarioName(),
child.getSteps().stream().map(step -> step.getName()).collect(Collectors.toList())));
}
notifier.fireTestFinished(description);
}
}