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


Java RunNotifier.fireTestFinished方法代码示例

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

示例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);

}
 
开发者ID:authorjapps,项目名称:zerocode,代码行数:32,代码来源:ZeroCodePackageRunner.java

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

示例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);
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:8,代码来源:AbstractMultiTestRunner.java

示例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);
     }
 }
 
开发者ID:dmn-tck,项目名称:tck,代码行数:31,代码来源:DmnTckRunner.java

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

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

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

示例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);
	}
}
 
开发者ID:git03394538,项目名称:lombok-ianchiu,代码行数:33,代码来源:DirectoryRunner.java

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

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

示例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);
}
 
开发者ID:linux-china,项目名称:unitils,代码行数:7,代码来源:UnitilsJUnit4TestClassRunner.java

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

示例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);

    }
    
}
 
开发者ID:authorjapps,项目名称:zerocode,代码行数:58,代码来源:ZeroCodeUnitRunner.java


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