本文整理汇总了Java中org.apache.maven.surefire.report.RunListener类的典型用法代码示例。如果您正苦于以下问题:Java RunListener类的具体用法?Java RunListener怎么用?Java RunListener使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
RunListener类属于org.apache.maven.surefire.report包,在下文中一共展示了RunListener类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: executeTestSet
import org.apache.maven.surefire.report.RunListener; //导入依赖的package包/类
private void executeTestSet( Class<?> clazz, RunListener reporter, Notifier notifier )
{
final ReportEntry report = new SimpleReportEntry( getClass().getName(), clazz.getName() );
reporter.testSetStarting( report );
try
{
executeWithRerun( clazz, notifier );
}
catch ( Throwable e )
{
if ( isFailFast() && e instanceof StoppedByUserException )
{
String reason = e.getClass().getName();
Description skippedTest = createDescription( clazz.getName(), createIgnored( reason ) );
notifier.fireTestIgnored( skippedTest );
}
else
{
String reportName = report.getName();
String reportSourceName = report.getSourceName();
PojoStackTraceWriter stackWriter = new PojoStackTraceWriter( reportSourceName, reportName, e );
reporter.testError( withException( reportSourceName, reportName, stackWriter ) );
}
}
finally
{
reporter.testSetCompleted( report );
}
}
示例2: invoke
import org.apache.maven.surefire.report.RunListener; //导入依赖的package包/类
@Override
public RunResult invoke(Object forkTestSet) {
ReporterFactory reporterFactory = providerParameters.getReporterFactory();
RunListener listener = reporterFactory.createReporter();
Runner runner = new Runner(tags);
TestBlock rootBlock = runner.defineTests(getSuites());
List<Reporter> reporters = Arrays.asList(new DefaultReporter(), new CuppaSurefireReporter(listener));
runner.run(rootBlock, new CompositeReporter(reporters));
return reporterFactory.close();
}
示例3: invoke
import org.apache.maven.surefire.report.RunListener; //导入依赖的package包/类
@Override
public RunResult invoke(Object forkTestSet) throws TestSetFailedException,
ReporterException, InvocationTargetException {
if (forkTestSet == null) {
RunResult r = RunResult.noTestsRun();
@SuppressWarnings("rawtypes")
Iterator<Class> i = getSuites();
while (i.hasNext()) {
r = r.aggregate(invoke(i.next()));
}
return r;
}
ReporterFactory reporterFactory = providerParameters
.getReporterFactory();
ConsoleLogger consoleLogger = providerParameters.getConsoleLogger();
RunListener rl = reporterFactory.createReporter();
if (!(forkTestSet instanceof Class)) {
throw new TestSetFailedException(
"Unexpected error. Received parameter is not a class");
}
@SuppressWarnings("unchecked")
Class<T> underTest = (Class<T>) forkTestSet;
TestResultListener<T> listener = new PowerUnitProviderListener<>(
consoleLogger, rl, underTest);
DefaultPowerUnitRunnerImpl<T> runner = new DefaultPowerUnitRunnerImpl<>(
underTest);
runner.addListener(listener);
runner.run();
return reporterFactory.close();
}
示例4: invoke
import org.apache.maven.surefire.report.RunListener; //导入依赖的package包/类
public RunResult invoke( Object forkTestSet )
throws TestSetFailedException
{
consoleLogger.info( "Play! initialization\n" );
initializePlayEngine();
try
{
upgradeCheck();
ReporterFactory reporterFactory = providerParameters.getReporterFactory();
RunResult runResult;
try
{
RunListener reporter = reporterFactory.createReporter();
startCapture( (ConsoleOutputReceiver) reporter );
// startCapture() called in prior to setTestsToRun()
if ( testsToRun == null )
{
setTestsToRun( forkTestSet );
}
Notifier notifier = new Notifier( new JUnit4RunListener( reporter ), getSkipAfterFailureCount() );
Result result = new Result();
notifier.addListeners( customRunListeners )
.addListener( result.createListener() );
if ( isFailFast() && commandsReader != null )
{
registerPleaseStopJUnitListener( notifier );
}
try
{
notifier.fireTestRunStarted( testsToRun.allowEagerReading()
? createTestsDescription( testsToRun )
: createDescription( UNDETERMINED_TESTS_DESCRIPTION ) );
if ( commandsReader != null )
{
registerShutdownListener( testsToRun );
commandsReader.awaitStarted();
}
for ( Class<?> testToRun : testsToRun )
{
executeTestSet( testToRun, reporter, notifier );
}
}
finally
{
notifier.fireTestRunFinished( result );
notifier.removeListeners();
}
rethrowAnyTestMechanismFailures( result );
}
finally
{
runResult = reporterFactory.close();
}
return runResult;
}
finally
{
consoleLogger.info( "Play! finalization\n" );
finalizePlayEngine();
}
}
示例5: PowerUnitProviderListener
import org.apache.maven.surefire.report.RunListener; //导入依赖的package包/类
public PowerUnitProviderListener(ConsoleLogger consoleLogger,
RunListener rl, Class<?> underTest) {
this.rl = rl;
this.underTest = underTest;
this.consoleLogger = consoleLogger;
}
示例6: CuppaSurefireReporter
import org.apache.maven.surefire.report.RunListener; //导入依赖的package包/类
/**
* Constructs a reporter that adapts events to Surefire's {@link RunListener}.
*
* @param listener The {@link RunListener} instance.
*/
CuppaSurefireReporter(RunListener listener) {
this.listener = listener;
}