Java Code Examples for org.junit.jupiter.api.extension.ExtensionContext#publishReportEntry()
The following examples show how to use
org.junit.jupiter.api.extension.ExtensionContext#publishReportEntry() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AllureJunit5.java From allure-java with Apache License 2.0 | 6 votes |
protected void processFixture(final String type, final Invocation<Void> invocation, final ReflectiveInvocationContext<Method> invocationContext, final ExtensionContext extensionContext) throws Throwable { final String uuid = UUID.randomUUID().toString(); try { extensionContext.publishReportEntry(buildStartEvent( type, uuid, invocationContext.getExecutable() )); invocation.proceed(); extensionContext.publishReportEntry(buildStopEvent( type, uuid )); } catch (Throwable throwable) { extensionContext.publishReportEntry(buildFailureEvent( type, uuid, throwable )); throw throwable; } }
Example 2
Source File: TimingExtension.java From junit5-demo with Apache License 2.0 | 5 votes |
@Override public void afterTestExecution(ExtensionContext context) throws Exception { long start = getStore(context).get("START", long.class); long duration = System.currentTimeMillis() - start; // System.out.println("Test method " + context.getRequiredTestMethod().getName() + " took " + duration + " ms"); context.publishReportEntry("exucution time", "" + duration); }
Example 3
Source File: BenchmarkExtension.java From demo-junit-5 with Creative Commons Zero v1.0 Universal | 4 votes |
private static void report(String unit, ExtensionContext context, long elapsedTime) { String message = String.format("%s '%s' took %d ms.", unit, context.getDisplayName(), elapsedTime); context.publishReportEntry("Benchmark", message); }
Example 4
Source File: SimpleBenchmarkExtension.java From demo-junit-5 with Creative Commons Zero v1.0 Universal | 4 votes |
private static void report(ExtensionContext context, long elapsedTime) { String message = String.format("Test '%s' took %d ms.", context.getDisplayName(), elapsedTime); context.publishReportEntry("Benchmark", message); }