本文整理汇总了Java中org.junit.internal.runners.model.EachTestNotifier类的典型用法代码示例。如果您正苦于以下问题:Java EachTestNotifier类的具体用法?Java EachTestNotifier怎么用?Java EachTestNotifier使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
EachTestNotifier类属于org.junit.internal.runners.model包,在下文中一共展示了EachTestNotifier类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: retry
import org.junit.internal.runners.model.EachTestNotifier; //导入依赖的package包/类
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 );
}
示例2: runChild
import org.junit.internal.runners.model.EachTestNotifier; //导入依赖的package包/类
@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();
}
}
}
示例3: runChild
import org.junit.internal.runners.model.EachTestNotifier; //导入依赖的package包/类
@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();
}
}
示例4: endTracing
import org.junit.internal.runners.model.EachTestNotifier; //导入依赖的package包/类
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();
}
}
}
示例5: endTracing
import org.junit.internal.runners.model.EachTestNotifier; //导入依赖的package包/类
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();
}
}
}
示例6: runChild
import org.junit.internal.runners.model.EachTestNotifier; //导入依赖的package包/类
@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();
}
}
}
示例7: invokeTest
import org.junit.internal.runners.model.EachTestNotifier; //导入依赖的package包/类
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();
}
}
}
示例8: runLeafAndIgnoreErrors
import org.junit.internal.runners.model.EachTestNotifier; //导入依赖的package包/类
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();
}
}
示例9: retry
import org.junit.internal.runners.model.EachTestNotifier; //导入依赖的package包/类
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);
}
示例10: runChild
import org.junit.internal.runners.model.EachTestNotifier; //导入依赖的package包/类
@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();
}
}
示例11: setTestsToFail
import org.junit.internal.runners.model.EachTestNotifier; //导入依赖的package包/类
/**
* 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"));
}
}
示例12: makeNotifier
import org.junit.internal.runners.model.EachTestNotifier; //导入依赖的package包/类
private EachTestNotifier makeNotifier(FrameworkMethod method, RunNotifier notifier) {
Description description = describeChild(method);
return new EachTestNotifier(notifier, description);
}
示例13: makeNotifier
import org.junit.internal.runners.model.EachTestNotifier; //导入依赖的package包/类
private EachTestNotifier makeNotifier(FrameworkMethod method, RunNotifier notifier) {
Description description = describeChild(method);
return new EachTestNotifier(notifier, description);
}
示例14: makeNotifier
import org.junit.internal.runners.model.EachTestNotifier; //导入依赖的package包/类
protected EachTestNotifier makeNotifier(FrameworkMethod method,
RunNotifier notifier) {
Description description= describeChild(method);
return new EachTestNotifier(notifier, description);
}
示例15: beforeExecution
import org.junit.internal.runners.model.EachTestNotifier; //导入依赖的package包/类
@Override
protected void beforeExecution(final EachTestNotifier notifier) {
notifier.fireTestStarted();
}