本文整理汇总了Java中org.junit.platform.engine.TestExecutionResult类的典型用法代码示例。如果您正苦于以下问题:Java TestExecutionResult类的具体用法?Java TestExecutionResult怎么用?Java TestExecutionResult使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
TestExecutionResult类属于org.junit.platform.engine包,在下文中一共展示了TestExecutionResult类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: addResult
import org.junit.platform.engine.TestExecutionResult; //导入依赖的package包/类
public final Builder addResult(TestIdentifier identifier, TestExecutionResult result) {
DisplayName displayName = getDisplayName(identifier);
if (identifier.isTest()) {
testsBuilder().add(displayName);
}
switch (result.getStatus()) {
case SUCCESSFUL:
successfulBuilder().add(displayName);
return this;
case FAILED:
failuresBuilder().put(displayName, result.getThrowable().orElse(null));
return this;
default:
throw new AssertionError("Unhandled case in enum: " + result.getStatus());
}
}
开发者ID:JeffreyFalgout,项目名称:junit5-extensions,代码行数:19,代码来源:TestPlanExecutionReport.java
示例2: testWithExpectedException_successfulTest_fails
import org.junit.platform.engine.TestExecutionResult; //导入依赖的package包/类
@org.junit.jupiter.api.Test
void testWithExpectedException_successfulTest_fails() {
ExecutionEventRecorder eventRecorder = executeTests(TestTestCase.class,
"testWithExpectedException_successfulTest");
assertThat(eventRecorder.getTestStartedCount()).isEqualTo(1);
assertThat(eventRecorder.getTestFailedCount()).isEqualTo(1);
//@formatter:off
Optional<String> failedTestMessage = eventRecorder
.getFailedTestFinishedEvents().get(0)
.getPayload(TestExecutionResult.class)
.flatMap(TestExecutionResult::getThrowable)
.map(Throwable::getMessage);
//@formatter:on
String expectedMessage = format(EXPECTED_EXCEPTION_WAS_NOT_THROWN, IllegalArgumentException.class);
assertThat(failedTestMessage).contains(expectedMessage);
}
开发者ID:junit-pioneer,项目名称:junit-pioneer,代码行数:19,代码来源:TestIntegrationTests.java
示例3: testWithExpectedException_exceptionThrownOfSupertype_fails
import org.junit.platform.engine.TestExecutionResult; //导入依赖的package包/类
@org.junit.jupiter.api.Test
void testWithExpectedException_exceptionThrownOfSupertype_fails() {
ExecutionEventRecorder eventRecorder = executeTests(TestTestCase.class,
"testWithExpectedException_exceptionThrownOfSupertype");
assertThat(eventRecorder.getTestStartedCount()).isEqualTo(1);
assertThat(eventRecorder.getTestFailedCount()).isEqualTo(1);
//@formatter:off
Optional<Throwable> failedTestThrowable = eventRecorder
.getFailedTestFinishedEvents().get(0)
.getPayload(TestExecutionResult.class)
.flatMap(TestExecutionResult::getThrowable);
//@formatter:on
assertThat(failedTestThrowable).containsInstanceOf(RuntimeException.class);
}
开发者ID:junit-pioneer,项目名称:junit-pioneer,代码行数:17,代码来源:TestIntegrationTests.java
示例4: testWithTimeout_exceedsTimeout_fails
import org.junit.platform.engine.TestExecutionResult; //导入依赖的package包/类
@org.junit.jupiter.api.Test
void testWithTimeout_exceedsTimeout_fails() throws Exception {
ExecutionEventRecorder eventRecorder = executeTests(TestTestCase.class, "testWithTimeout_exceedsTimeout");
assertThat(eventRecorder.getTestStartedCount()).isEqualTo(1);
assertThat(eventRecorder.getTestFailedCount()).isEqualTo(1);
//@formatter:off
Optional<String> failedTestMessage = eventRecorder
.getFailedTestFinishedEvents().get(0)
.getPayload(TestExecutionResult.class)
.flatMap(TestExecutionResult::getThrowable)
.map(Throwable::getMessage);
String expectedMessage = String.format(
TimeoutExtension.TEST_RAN_TOO_LONG, "testWithTimeout_exceedsTimeout()", 1, 10);
//@formatter:on
// the message contains the actual run time, which is unpredictable, so it has to be cut off for the assertion
String expectedKnownPrefix = expectedMessage.substring(0, expectedMessage.length() - 6);
assertThat(failedTestMessage).isNotEmpty();
assertThat(failedTestMessage.get()).startsWith(expectedKnownPrefix);
}
开发者ID:junit-pioneer,项目名称:junit-pioneer,代码行数:22,代码来源:TestIntegrationTests.java
示例5: executionFinished
import org.junit.platform.engine.TestExecutionResult; //导入依赖的package包/类
@Override
public void executionFinished(final TestIdentifier testIdentifier, final TestExecutionResult testExecutionResult) {
if (testIdentifier.isTest()) {
final String uuid = tests.get();
tests.remove();
getLifecycle().updateTestCase(uuid, result -> {
result.setStage(Stage.FINISHED);
switch (testExecutionResult.getStatus()) {
case FAILED:
testExecutionResult.getThrowable().ifPresent(throwable -> {
result.setStatus(getStatus(throwable));
result.setStatusDetails(ResultsUtils.getStatusDetails(throwable).orElse(null));
});
break;
case SUCCESSFUL:
result.setStatus(PASSED);
break;
default:
result.setStatus(SKIPPED);
testExecutionResult.getThrowable().ifPresent(throwable ->
result.setStatusDetails(ResultsUtils.getStatusDetails(throwable).orElse(null))
);
break;
}
});
getLifecycle().stopTestCase(uuid);
getLifecycle().writeTestCase(uuid);
}
}
开发者ID:allure-framework,项目名称:allure-java,代码行数:30,代码来源:AllureJunit5.java
示例6: executionFinished
import org.junit.platform.engine.TestExecutionResult; //导入依赖的package包/类
@Override
public void executionFinished(TestIdentifier testIdentifier, TestExecutionResult testExecutionResult) {
super.executionFinished(testIdentifier, testExecutionResult);
if (testIdentifier.isTest()) {
Status status = testExecutionResult.getStatus();
Color color = Color.valueOf(status);
printMessage(color, STATUS + status);
printFailureMessage(testIdentifier, testExecutionResult, color);
System.out.println();
}
}
开发者ID:alphagov,项目名称:verify-matching-service-adapter,代码行数:12,代码来源:TestStatusPrintingListener.java
示例7: executionFinished
import org.junit.platform.engine.TestExecutionResult; //导入依赖的package包/类
@Override
public void executionFinished(TestDescriptor testDescriptor, TestExecutionResult testExecutionResult) {
Optional<Throwable> throwable = testExecutionResult.getThrowable();
if (throwable.isPresent()) {
throw new UndeclaredThrowableException(throwable.get());
}
}
开发者ID:testIT-WebTester,项目名称:webtester2-core,代码行数:8,代码来源:TestClassExecutor.java
示例8: executionFinished
import org.junit.platform.engine.TestExecutionResult; //导入依赖的package包/类
@Override
public void executionFinished(TestIdentifier testIdentifier, TestExecutionResult testExecutionResult) {
Map<String, Object> data = new HashMap<>();
data.put("type", "executionFinished");
data.put("success", testExecutionResult.getStatus() == TestExecutionResult.Status.SUCCESSFUL);
data.put("throwable", testExecutionResult.getThrowable().orElse(null));
writeData(testIdentifier, data);
}
开发者ID:ajoberstar,项目名称:jovial,代码行数:9,代码来源:SerializingListener.java
示例9: execute
import org.junit.platform.engine.TestExecutionResult; //导入依赖的package包/类
@Override
public void execute(ExecutionRequest request) {
TestDescriptor engine = request.getRootTestDescriptor();
EngineExecutionListener listener = request.getEngineExecutionListener();
listener.executionStarted(engine);
for (TestDescriptor child : engine.getChildren()) {
listener.executionStarted(child);
listener.executionFinished(child, TestExecutionResult.successful());
}
listener.executionFinished(engine, TestExecutionResult.successful());
}
开发者ID:junit-team,项目名称:junit5-samples,代码行数:12,代码来源:Machine.java
示例10: executionFinished
import org.junit.platform.engine.TestExecutionResult; //导入依赖的package包/类
@Override
public void executionFinished(TestIdentifier testIdentifier,
TestExecutionResult testExecutionResult) {
executionReportBuilder.addResult(testIdentifier, testExecutionResult);
}
开发者ID:JeffreyFalgout,项目名称:junit5-extensions,代码行数:6,代码来源:ExecutionReportListener.java
示例11: executionFinished
import org.junit.platform.engine.TestExecutionResult; //导入依赖的package包/类
@Override
public void executionFinished(TestDescriptor testDescriptor, TestExecutionResult result) {
addEvent(ExecutionEvent.executionFinished(testDescriptor, result));
}
开发者ID:glytching,项目名称:junit-extensions,代码行数:5,代码来源:RecordingExecutionListener.java
示例12: getFinishedEventsByStatus
import org.junit.platform.engine.TestExecutionResult; //导入依赖的package包/类
public Stream<ExecutionEvent> getFinishedEventsByStatus(Status status) {
return getEventsByType(FINISHED)
.filter(
byPayload(
TestExecutionResult.class, where(TestExecutionResult::getStatus, isEqual(status))));
}
开发者ID:glytching,项目名称:junit-extensions,代码行数:7,代码来源:RecordingExecutionListener.java
示例13: executionFinished
import org.junit.platform.engine.TestExecutionResult; //导入依赖的package包/类
public static ExecutionEvent executionFinished(
TestDescriptor testDescriptor, TestExecutionResult result) {
return new ExecutionEvent(FINISHED, testDescriptor, result);
}
开发者ID:glytching,项目名称:junit-extensions,代码行数:5,代码来源:ExecutionEvent.java
示例14: printFailureMessage
import org.junit.platform.engine.TestExecutionResult; //导入依赖的package包/类
private void printFailureMessage(TestIdentifier testIdentifier, TestExecutionResult testExecutionResult, Color color) {
if (testExecutionResult.getStatus().equals(Status.FAILED)) {
testExecutionResult.getThrowable()
.ifPresent(throwable -> printMessage(color, throwable.toString()));
}
}
开发者ID:alphagov,项目名称:verify-matching-service-adapter,代码行数:7,代码来源:TestStatusPrintingListener.java
示例15: executionFinished
import org.junit.platform.engine.TestExecutionResult; //导入依赖的package包/类
@Override
public void executionFinished(TestDescriptor testDescriptor, TestExecutionResult testExecutionResult) {
allTestsPassed = allTestsPassed && testExecutionResult.getStatus() == SUCCESSFUL;
}
开发者ID:FaustXVI,项目名称:junit5-docker,代码行数:5,代码来源:JupiterExecutionListener.java
示例16: executionFinished
import org.junit.platform.engine.TestExecutionResult; //导入依赖的package包/类
public static ExecutionEvent executionFinished(TestDescriptor testDescriptor, TestExecutionResult result) {
return new ExecutionEvent(FINISHED, testDescriptor, result);
}
开发者ID:junit-pioneer,项目名称:junit-pioneer,代码行数:4,代码来源:ExecutionEvent.java
示例17: status
import org.junit.platform.engine.TestExecutionResult; //导入依赖的package包/类
public static Condition<TestExecutionResult> status(Status expectedStatus) {
return new Condition<>(where(TestExecutionResult::getStatus, isEqual(expectedStatus)), "status is %s",
expectedStatus);
}
开发者ID:junit-pioneer,项目名称:junit-pioneer,代码行数:5,代码来源:TestExecutionResultConditions.java
示例18: cause
import org.junit.platform.engine.TestExecutionResult; //导入依赖的package包/类
public static Condition<TestExecutionResult> cause(Condition<? super Throwable> condition) {
return new Condition<TestExecutionResult>(where(TestExecutionResult::getThrowable, throwable -> {
return throwable.isPresent() && condition.matches(throwable.get());
}), "cause where %s", condition);
}
开发者ID:junit-pioneer,项目名称:junit-pioneer,代码行数:6,代码来源:TestExecutionResultConditions.java
示例19: finished
import org.junit.platform.engine.TestExecutionResult; //导入依赖的package包/类
public static Condition<ExecutionEvent> finished(Condition<TestExecutionResult> resultCondition) {
return allOf(type(FINISHED), result(resultCondition));
}
开发者ID:junit-pioneer,项目名称:junit-pioneer,代码行数:4,代码来源:ExecutionEventConditions.java
示例20: result
import org.junit.platform.engine.TestExecutionResult; //导入依赖的package包/类
public static Condition<ExecutionEvent> result(Condition<TestExecutionResult> condition) {
return new Condition<>(byPayload(TestExecutionResult.class, condition::matches), "event with result where %s",
condition);
}
开发者ID:junit-pioneer,项目名称:junit-pioneer,代码行数:5,代码来源:ExecutionEventConditions.java
注:本文中的org.junit.platform.engine.TestExecutionResult类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论