當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。