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


Java RunNotifier.fireTestFailure方法代码示例

本文整理汇总了Java中org.junit.runner.notification.RunNotifier.fireTestFailure方法的典型用法代码示例。如果您正苦于以下问题:Java RunNotifier.fireTestFailure方法的具体用法?Java RunNotifier.fireTestFailure怎么用?Java RunNotifier.fireTestFailure使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.junit.runner.notification.RunNotifier的用法示例。


在下文中一共展示了RunNotifier.fireTestFailure方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: run

import org.junit.runner.notification.RunNotifier; //导入方法依赖的package包/类
@Override
public void run(final RunNotifier notifier) {
    ClassRoadie classRoadie = new ClassRoadie(notifier, getTestClass(), getDescription(), new Runnable() {
        public void run() {
            runMethods(notifier);
        }
    });

    Unitils.getInstance().getTestContext().setRunner(this);
    try {
        getTestListener().beforeTestClass(getTestClass().getJavaClass());
        classRoadie.runProtected();
    } catch (Throwable t) {
        notifier.fireTestFailure(new Failure(getDescription(), t));
    }
}
 
开发者ID:linux-china,项目名称:unitils,代码行数:17,代码来源:UnitilsJUnit4TestClassRunner.java

示例3: handleAssertionFailed

import org.junit.runner.notification.RunNotifier; //导入方法依赖的package包/类
Boolean handleAssertionFailed(RunNotifier notifier,
                Description description,
                String scenarioName,
                String stepName,
                List<AssertionReport> failureReportList) {
    /**
     * Generate error report and display clearly which expectation(s) did not match
     */
    logger.info(String.format("Failed assertion during Scenario:%s, --> Step:%s, Details: %s\n",
                    scenarioName, stepName, StringUtils.join(failureReportList, "\n")));
    notifier.fireTestFailure(new Failure(description, new RuntimeException(
                    String.format("Assertion failed for :- \n\n[%s] \n\t|\n\t|\n\t+---Step --> [%s] \n\nFailures:\n--------- %n%s%n",
                                    scenarioName,
                                    stepName,
                                    StringUtils.join(failureReportList, "\n" + deckedUpLine(maxEntryLengthOf(failureReportList)) + "\n"))
    )));
    
    return false;
}
 
开发者ID:authorjapps,项目名称:zerocode,代码行数:20,代码来源:StepNotificationHandler.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: runChildAfter

import org.junit.runner.notification.RunNotifier; //导入方法依赖的package包/类
static void runChildAfter(final BlockJUnit4ClassRunner runner, final FrameworkMethod method,
		final RunNotifier notifier, final LogExecutionTime logExecutionTime) {
	LOGGER.info("<<< %s took %s", method.getMethod(), logExecutionTime);
	if (StroomJunitConsoleAppender.getUnexpectedExceptions().size() > 0) {
		notifier.fireTestFailure(new Failure(
				Description.createTestDescription(runner.getTestClass().getJavaClass(), method.getName()),
				StroomJunitConsoleAppender.getUnexpectedExceptions().get(0)));
	}
	StroomJunitConsoleAppender.setExpectedException(null);
}
 
开发者ID:gchq,项目名称:stroom-agent,代码行数:11,代码来源:StroomJUnit4ClassRunner.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: runChild

import org.junit.runner.notification.RunNotifier; //导入方法依赖的package包/类
@Override
protected void runChild(Postcondition postcondition, RunNotifier notifier) {
  try {
    clausesFor(postcondition).filter(Clause::isPrecondition).forEachOrdered(Clause::run);
    clausesFor(postcondition).filter(Clause::isSpecification).forEachOrdered(Clause::run);
    postcondition.verify();
  } catch (AssertionError|SpecificationError e) {
    notifier.fireTestFailure(new Failure(cache.get(postcondition), e));
  }
}
 
开发者ID:toolbear,项目名称:ballad,代码行数:11,代码来源:Balladeer.java

示例11: 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

示例12: runChild

import org.junit.runner.notification.RunNotifier; //导入方法依赖的package包/类
@Override
protected void runChild(FrameworkMethod method, RunNotifier notifier) {
    try {
        resolveFailureCollectorRule(method);
        notifier.addFirstListener(new FailureListener(failureCollector));
    } catch (Exception e) {
        notifier.fireTestFailure(new Failure(createTestDescription(method.getDeclaringClass(), method.getName()), e));
    }
    super.runChild(method, notifier);
}
 
开发者ID:aalmiray,项目名称:javatrove,代码行数:11,代码来源:FunctionalTestRunner.java

示例13: 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

示例14: handleStepException

import org.junit.runner.notification.RunNotifier; //导入方法依赖的package包/类
Boolean handleStepException(RunNotifier notifier,
                Description description,
                String scenarioName,
                String stepName,
                Exception stepException) {
    logger.info(String.format("Exception occurred while executing Scenario:[%s], --> Step:[%s], Details: %s",
                    scenarioName, stepName, stepException));
    notifier.fireTestFailure(new Failure(description, stepException));
    
    return false;
}
 
开发者ID:authorjapps,项目名称:zerocode,代码行数:12,代码来源:StepNotificationHandler.java

示例15: runChild

import org.junit.runner.notification.RunNotifier; //导入方法依赖的package包/类
@Override
protected void runChild(final FrameworkMethod method, final RunNotifier notifier) {
    try {
        try {
            ThreadScopeContextHolder.createContext();
            TaskScopeContextHolder.addContext();

            final LogExecutionTime logExecutionTime = new LogExecutionTime();
            try {
                StroomJUnit4ClassRunner.runChildBefore(this, method, notifier);
                super.runChild(method, notifier);

            } finally {
                StroomJUnit4ClassRunner.runChildAfter(this, method, notifier, logExecutionTime);
            }

        } finally {
            TaskScopeContextHolder.removeContext();
            ThreadScopeContextHolder.destroyContext();
        }

        while (TaskScopeContextHolder.contextExists()) {
            notifier.fireTestFailure(
                    new Failure(Description.createTestDescription(getTestClass().getJavaClass(), method.getName()),
                            new RuntimeException("Context stills exists?")));
            TaskScopeContextHolder.removeContext();
        }
    } catch (final Exception e) {
        throw new RuntimeException(e.getMessage(), e);
    }
}
 
开发者ID:gchq,项目名称:stroom-proxy,代码行数:32,代码来源:StroomSpringJUnit4ClassRunner.java


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