Java 类org.junit.internal.runners.model.EachTestNotifier 实例源码

项目:OHMS    文件:RetryRunner.java   
public void retry( EachTestNotifier notifier, Statement statement, Throwable currentThrowable )
{
    Throwable caughtThrowable = currentThrowable;
    while ( retryCount > failedAttempts )
    {
        try
        {
            timeout( failedAttempts + 1 );
            statement.evaluate();
            return;
        }
        catch ( Throwable t )
        {
            failedAttempts++;
            caughtThrowable = t;
        }
    }
    notifier.addFailure( caughtThrowable );
}
项目:LiteGraph    文件:GremlinProcessRunner.java   
@Override
public void runChild(final FrameworkMethod method, final RunNotifier notifier) {
    final Description description = describeChild(method);
    if (this.isIgnored(method)) {
        notifier.fireTestIgnored(description);
    } else {
        EachTestNotifier eachNotifier = new EachTestNotifier(notifier, description);
        eachNotifier.fireTestStarted();
        boolean ignored = false;
        try {
            this.methodBlock(method).evaluate();
        } catch (AssumptionViolatedException ave) {
            eachNotifier.addFailedAssumption(ave);
        } catch (Throwable e) {
            if (validateForGraphComputer(e)) {
                eachNotifier.fireTestIgnored();
                logger.info(e.getMessage());
                ignored = true;
            } else
                eachNotifier.addFailure(e);
        } finally {
            if (!ignored)
                eachNotifier.fireTestFinished();
        }
    }
}
项目:FuzzUnit    文件:FuzzUnitTestRunner.java   
@Override
protected void runChild(FrameworkMethod method, RunNotifier notifier) {
    EachTestNotifier eachNotifier = makeNotifier( method, notifier );
       FuzzUnitTestMethod tTestMethod = (FuzzUnitTestMethod) method;

       eachNotifier.fireTestStarted();
       if( method.getAnnotation( Ignore.class ) != null  ) {
               eachNotifier.fireTestIgnored();
               return;
       }

       try {

           methodBlock( tTestMethod ).evaluate();


           } catch (Throwable e) {
            eachNotifier.addFailure( e );
        } finally {
              eachNotifier.fireTestFinished();
           }
       }
项目:apm-agent    文件:PinpointJUnit4ClassRunner.java   
private void endTracing(FrameworkMethod method, RunNotifier notifier) {
    if (shouldCreateNewTraceObject(method)) {
        TraceContext traceContext = this.testAgent.getTraceContext();
        try {
            Trace trace = traceContext.currentRawTraceObject();
            if (trace == null) {
                // Trace is already detached from the ThreadLocal storage.
                // Happens when root trace method is tested without @IsRootSpan.
                EachTestNotifier testMethodNotifier = new EachTestNotifier(notifier, super.describeChild(method));
                String traceObjectAlreadyDetachedMessage = "Trace object already detached. If you're testing a trace root, please add @IsRootSpan to the test method";
                testMethodNotifier.addFailure(new IllegalStateException(traceObjectAlreadyDetachedMessage));
            } else {
                try {
                    trace.markAfterTime();
                } finally {
                    trace.traceRootBlockEnd();
                }
            }
        } finally {
            traceContext.detachTraceObject();
        }
    }
}
项目:tinkerpop    文件:GremlinProcessRunner.java   
@Override
public void runChild(final FrameworkMethod method, final RunNotifier notifier) {
    final Description description = describeChild(method);
    if (this.isIgnored(method)) {
        notifier.fireTestIgnored(description);
    } else {
        EachTestNotifier eachNotifier = new EachTestNotifier(notifier, description);
        eachNotifier.fireTestStarted();
        boolean ignored = false;
        try {
            this.methodBlock(method).evaluate();
        } catch (AssumptionViolatedException ave) {
            eachNotifier.addFailedAssumption(ave);
        } catch (Throwable e) {
            if (validateForGraphComputer(e)) {
                eachNotifier.fireTestIgnored();
                logger.info(e.getMessage());
                ignored = true;
            } else
                eachNotifier.addFailure(e);
        } finally {
            if (!ignored)
                eachNotifier.fireTestFinished();
        }
    }
}
项目:pinpoint    文件:PinpointJUnit4ClassRunner.java   
private void endTracing(FrameworkMethod method, RunNotifier notifier) {
    if (shouldCreateNewTraceObject(method)) {
        TraceContext traceContext = getTraceContext();
        try {
            Trace trace = traceContext.currentRawTraceObject();
            if (trace == null) {
                // Trace is already detached from the ThreadLocal storage.
                // Happens when root trace method is tested without @IsRootSpan.
                EachTestNotifier testMethodNotifier = new EachTestNotifier(notifier, super.describeChild(method));
                String traceObjectAlreadyDetachedMessage = "Trace object already detached. If you're testing a trace root, please add @IsRootSpan to the test method";
                testMethodNotifier.addFailure(new IllegalStateException(traceObjectAlreadyDetachedMessage));
            } else {
                trace.close();
            }
        } finally {
            traceContext.removeTraceObject();
        }
    }
}
项目:HiveRunner    文件:StandaloneHiveRunner.java   
@Override
protected void runChild(final FrameworkMethod method, RunNotifier notifier) {
    Description description = describeChild(method);
    if (method.getAnnotation(Ignore.class) != null) {
        notifier.fireTestIgnored(description);
    } else {
        setLogContext(method);
        EachTestNotifier eachNotifier = new EachTestNotifier(notifier, description);
        eachNotifier.fireTestStarted();
        try {
            runTestMethod(method, eachNotifier, config.getTimeoutRetries());
        } finally {
            eachNotifier.fireTestFinished();
            clearLogContext();
        }
    }
}
项目:pravega    文件:SystemTestRunner.java   
private void invokeTest(RunNotifier notifier, TestExecutorType type, FrameworkMethod method) {
    if ((type == null) || TestExecutorType.LOCAL.equals(type)) {
        runLeaf(methodBlock(method), describeChild(method), notifier);
    } else {
        EachTestNotifier eachNotifier = new EachTestNotifier(notifier, describeChild(method));
        try {
            eachNotifier.fireTestStarted();
            execute(type, method.getMethod()).get();
        } catch (Throwable e) {
            eachNotifier.addFailure(e);
        } finally {
            eachNotifier.fireTestFinished();
        }
    }
}
项目:junit-volkswagen    文件:VolkswagenTestRunner.java   
private void runLeafAndIgnoreErrors(Statement statement, Description description, RunNotifier notifier) {
    EachTestNotifier eachNotifier = new EachTestNotifier(notifier, description);
    eachNotifier.fireTestStarted();
    try {
        statement.evaluate();
    } catch (Throwable e) {
        // An error ? Surely you must be joking
    } finally {
        eachNotifier.fireTestFinished();
    }
}
项目:jsimpleshell-rc    文件:UnstableTestRunner.java   
public void retry(EachTestNotifier notifier, Statement statement, Throwable currentThrowable) {
    Throwable caughtThrowable = currentThrowable;
    while (RETRY_COUNT > failedAttempts) {
        try {
            statement.evaluate();
            return;
        } catch (Throwable t) {
            failedAttempts++;
            caughtThrowable = t;
        }
    }
    notifier.addFailure(caughtThrowable);
}
项目:junit-playground    文件:Java8Runner.java   
@Override
protected void runChild(Test child, RunNotifier notifier) {
    Description description = describeChild(child);
    EachTestNotifier eachTestNotifier = new EachTestNotifier(
            notifier, description);
    eachTestNotifier.fireTestStarted();
    try {
        child.statement.evaluate();
    } catch (Throwable t) {
        eachTestNotifier.addFailure(t);
    } finally {
        eachTestNotifier.fireTestFinished();
    }
}
项目:KoPeMe    文件:PerformanceTestRunnerJUnit.java   
/**
 * Sets that tests are failed.
 * 
 * @param notifier
 *            Notifier that should be notified
 */
protected void setTestsToFail(final RunNotifier notifier) {
    final Description description = getDescription();
    final ArrayList<Description> toBeFailed = new ArrayList<>(description.getChildren()); // all testmethods will be covered and set to failed here
    toBeFailed.add(description); // the whole test class failed
    for (final Description d : toBeFailed) {
        final EachTestNotifier testNotifier = new EachTestNotifier(notifier, d);
        testNotifier.addFailure(new TimeoutException("Test timed out because of class timeout"));
    }
}
项目:bobcat    文件:TestRunner.java   
private EachTestNotifier makeNotifier(FrameworkMethod method, RunNotifier notifier) {
  Description description = describeChild(method);
  return new EachTestNotifier(notifier, description);
}
项目:guice-behave    文件:TestRunner.java   
private EachTestNotifier makeNotifier(FrameworkMethod method, RunNotifier notifier) {
    Description description = describeChild(method);
    return new EachTestNotifier(notifier, description);
}
项目:cougar    文件:ParameterizedMultiRunner.java   
protected EachTestNotifier makeNotifier(FrameworkMethod method,
                                        RunNotifier notifier) {
    Description description= describeChild(method);
    return new EachTestNotifier(notifier, description);
}
项目:cougar    文件:MultiRunner.java   
protected EachTestNotifier makeNotifier(FrameworkMethod method,
                                        RunNotifier notifier) {
    Description description= describeChild(method);
    return new EachTestNotifier(notifier, description);
}
项目:junit-hierarchicalcontextrunner    文件:MethodStatementExecutor.java   
@Override
protected void beforeExecution(final EachTestNotifier notifier) {
    notifier.fireTestStarted();
}
项目:junit-hierarchicalcontextrunner    文件:MethodStatementExecutor.java   
@Override
protected void afterExecution(final EachTestNotifier notifier) {
    notifier.fireTestFinished();
}
项目:dsl-devkit    文件:ClassRunner.java   
/**
 * Creates a notifier for each test.
 *
 * @param method
 *          the {@link FrameworkMethod}, must not be {@code null}
 * @param notifier
 *          the {@link RunNotifier}, must not be {@code null}
 * @return an instance of {@link EachTestNotifier}, never {@code null}
 */
private EachTestNotifier createNotifier(final FrameworkMethod method, final RunNotifier notifier) {
  return new EachTestNotifier(notifier, describeChild(method));
}
项目:FuzzUnit    文件:FuzzUnitTestRunner.java   
/**
 * @param method the test
 * @param notifier a test run notifier
 * @return the married test and notifier
 */
protected EachTestNotifier makeNotifier( FrameworkMethod method, RunNotifier notifier )
{
        return new EachTestNotifier( notifier, describeChild( method ) );
}
项目:class-guard    文件:SpringJUnit4ClassRunner.java   
/**
 * {@code springMakeNotifier()} is an exact copy of
 * {@link BlockJUnit4ClassRunner BlockJUnit4ClassRunner's}
 * {@code makeNotifier()} method, but we have decided to prefix it with
 * "spring" and keep it {@code private} in order to avoid the
 * compatibility clashes that were introduced in JUnit between versions 4.5,
 * 4.6, and 4.7.
 */
private EachTestNotifier springMakeNotifier(FrameworkMethod method, RunNotifier notifier) {
    Description description = describeChild(method);
    return new EachTestNotifier(notifier, description);
}
项目:junit-hierarchicalcontextrunner    文件:StatementExecutor.java   
/**
 * Clients may override this method to add additional behavior prior to the execution of the statement.
 * The call of this method is guaranteed.
 *
 * @param notifier the notifier
 */
protected void beforeExecution(final EachTestNotifier notifier) {
}
项目:junit-hierarchicalcontextrunner    文件:StatementExecutor.java   
/**
 * Clients may override this method to add additional behavior when a {@link InitializationError} is raised.
 * The call of this method is guaranteed.
 *
 * @param notifier the notifier
 * @param e the error
 */
protected void whenInitializationErrorIsRaised(final EachTestNotifier notifier, final InitializationError e) {
    notifier.addFailure(new MultipleFailureException(e.getCauses()));
}
项目:junit-hierarchicalcontextrunner    文件:StatementExecutor.java   
/**
 * Clients may override this method to add additional behavior when a {@link AssumptionViolatedException} is raised.
 * The call of this method is guaranteed.
 *
 * @param notifier the notifier
 * @param e the error
 */
protected void whenAssumptionViolatedExceptionIsRaised(final EachTestNotifier notifier, final AssumptionViolatedException e) {
    notifier.addFailedAssumption(e);
}
项目:junit-hierarchicalcontextrunner    文件:StatementExecutor.java   
/**
 * Clients may override this method to add additional behavior when a {@link Throwable} is raised.
 *
 * @param notifier the notifier
 * @param e the error
 */
protected void whenThrowableIsRaised(final EachTestNotifier notifier, final Throwable e) {
    notifier.addFailure(e);
}
项目:junit-hierarchicalcontextrunner    文件:StatementExecutor.java   
/**
 * Clients may override this method to add additional behavior after the execution of the statement.
 * The call of this method is guaranteed.
 *
 * @param notifier the notifier
 */
protected void afterExecution(final EachTestNotifier notifier) {
}