当前位置: 首页>>代码示例>>Java>>正文


Java EachTestNotifier类代码示例

本文整理汇总了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 );
}
 
开发者ID:vmware,项目名称:OHMS,代码行数:20,代码来源:RetryRunner.java

示例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();
        }
    }
}
 
开发者ID:PKUSilvester,项目名称:LiteGraph,代码行数:27,代码来源:GremlinProcessRunner.java

示例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();
           }
       }
 
开发者ID:JoeBeeton,项目名称:FuzzUnit,代码行数:23,代码来源:FuzzUnitTestRunner.java

示例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();
        }
    }
}
 
开发者ID:masonmei,项目名称:apm-agent,代码行数:24,代码来源:PinpointJUnit4ClassRunner.java

示例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();
        }
    }
}
 
开发者ID:naver,项目名称:pinpoint,代码行数:20,代码来源:PinpointJUnit4ClassRunner.java

示例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();
        }
    }
}
 
开发者ID:klarna,项目名称:HiveRunner,代码行数:18,代码来源:StandaloneHiveRunner.java

示例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();
        }
    }
}
 
开发者ID:pravega,项目名称:pravega,代码行数:16,代码来源:SystemTestRunner.java

示例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();
    }
}
 
开发者ID:bishiboosh,项目名称:junit-volkswagen,代码行数:12,代码来源:VolkswagenTestRunner.java

示例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);
}
 
开发者ID:rainu,项目名称:jsimpleshell-rc,代码行数:14,代码来源:UnstableTestRunner.java

示例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();
    }
}
 
开发者ID:stefanbirkner,项目名称:junit-playground,代码行数:15,代码来源:Java8Runner.java

示例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"));
	}
}
 
开发者ID:DaGeRe,项目名称:KoPeMe,代码行数:16,代码来源:PerformanceTestRunnerJUnit.java

示例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);
}
 
开发者ID:Cognifide,项目名称:bobcat,代码行数:5,代码来源:TestRunner.java

示例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);
}
 
开发者ID:alessandrosimi,项目名称:guice-behave,代码行数:5,代码来源:TestRunner.java

示例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);
}
 
开发者ID:betfair,项目名称:cougar,代码行数:6,代码来源:ParameterizedMultiRunner.java

示例15: beforeExecution

import org.junit.internal.runners.model.EachTestNotifier; //导入依赖的package包/类
@Override
protected void beforeExecution(final EachTestNotifier notifier) {
    notifier.fireTestStarted();
}
 
开发者ID:bechte,项目名称:junit-hierarchicalcontextrunner,代码行数:5,代码来源:MethodStatementExecutor.java


注:本文中的org.junit.internal.runners.model.EachTestNotifier类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。