private static String getFinalVideoName(After afterTestMethod) { final String className = afterTestMethod.getTestClass().getName().replace('.', '_'); final String methodName = afterTestMethod.getTestMethod().getName(); return className + "_" + methodName + ".flv"; } }
public void stopContainerObjects(@Observes(precedence = 100) After afterClass) { final ConnectionMode connectionMode = ConnectionMode.START_AND_STOP_AROUND_METHOD; final TestClass testClass = afterClass.getTestClass(); stopAndDestroyCubes(connectionMode, testClass); }
private Method getTestMethod(@Observes AfterVideoRecorded event) { return event.getAfter().getTestMethod(); } }
public void after(Object testInstance, Method testMethod, LifecycleMethodExecutor executor) throws Exception { Validate.notNull(testInstance, "TestInstance must be specified"); Validate.notNull(testMethod, "TestMethod must be specified"); ExecutionDecision executionDecision = resolveExecutionDecision(manager, testMethod); if (executionDecision.getDecision() == Decision.DONT_EXECUTE) { return; } manager.fire(new After(testInstance, testMethod, executor)); }
void afterTest(@Observes(precedence = -500) After event) { Class<?> testClass = event.getTestInstance().getClass(); if (WarpCommons.isWarpTest(testClass)) { stopBus.fire(new StopBus(event)); } }
public void stopContainerObjects(@Observes(precedence = 100) After afterClass) { final ConnectionMode connectionMode = ConnectionMode.START_AND_STOP_AROUND_METHOD; final TestClass testClass = afterClass.getTestClass(); stopAndDestroyCubes(connectionMode, testClass); }
private void executeTest(Object inspection, Method method, List<Annotation> qualifiers) { before.fire(new Before(inspection, method)); test.fire(new Test(new LifecycleMethodExecutor(inspection, method, qualifiers))); after.fire(new After(inspection, method)); }
public void restoreOriginalFieldValues(@Observes(precedence = 100) EventContext<After> context) { final Object testInstance = context.getEvent().getTestInstance(); try { context.proceed(); } finally { restoreFields(testInstance); } }
private static String getFinalVideoName(After afterTestMethod) { final String className = afterTestMethod.getTestClass().getName().replace('.', '_'); final String methodName = afterTestMethod.getTestMethod().getName(); return className + "_" + methodName + ".flv"; } }
/** * <p>The after test event handler.</p> * * <p>Delegates to the registered {@link ApplicationContextProducer} instances in order to create the application * context.</p> * * @param event the after test event */ public void afterTest(@Observes After event) { ContextLifeCycleMode mode = getContextLifeCycleMode(event.getTestClass()); if (mode == ContextLifeCycleMode.TEST) { destroyTestApplicationContext(); } }
@Test public void shouldInvokeAfterInContainerDeploymentContext() throws Exception { fire(new After(this, testMethod())); assertEventFiredInContext(After.class, ContainerContext.class); assertEventFiredInContext(After.class, DeploymentContext.class); }
void cleanAfter(@Observes After after) { this.clean(after.getTestClass(), after.getTestMethod(), true); }
void sendAfter(@Observes After event) throws Exception { if (WarpCommons.isWarpTest(event.getTestClass().getJavaClass())) { remoteOperationService().execute(new FireAfterSuiteOnServer()); } }
@Test public void shouldInvokeAfterInContainerDeploymentContext() throws Exception { fire(new After(this, testMethod())); assertEventFiredInContext(After.class, ContainerContext.class); assertEventFiredInContext(After.class, DeploymentContext.class); }
void cleanAfter(@Observes After after) { this.clean(after.getTestClass(), after.getTestMethod(), true); }
@Test public void should_create_video_from_surefire_report_directory() throws NoSuchMethodException { //given TakeVncDroneVideo takeVncDroneVideo = new TakeVncDroneVideo(); takeVncDroneVideo.reportEvent = reportEvent; final Method method = getMethod("should_create_video_from_surefire_report_directory"); AfterVideoRecorded afterVideoRecorded = new AfterVideoRecorded(new After(TakeDockerEnvironmentTest.class, method), Paths.get("target/surefire-report/myvideo.flv")); //when takeVncDroneVideo.reportScreencastRecording(afterVideoRecorded, getReporterConfiguration()); //then verify(reportEvent).fire(reportEventArgumentCaptor.capture()); final SectionEvent sectionEvent = reportEventArgumentCaptor.getValue(); final String methodName = method.getName(); assertThatSection(sectionEvent) .hasSectionId(methodName) .hasReportOfTypeThatIsAssignableFrom(TestMethodReport.class); final Report report = sectionEvent.getReport(); assertThatReport(report) .hasName(methodName) .hasNumberOfEntries(1) .hasEntriesContaining(new KeyValueEntry(DockerEnvironmentReportKey.VIDEO_PATH, new FileEntry("surefire-report/myvideo.mp4"))); }
void cleanAfter(@Observes After after) { this.clean(after.getTestClass(), after.getTestMethod(), true); }
@Test public void should_create_video_from_root_directory() throws NoSuchMethodException { //given TakeVncDroneVideo takeVncDroneVideo = new TakeVncDroneVideo(); takeVncDroneVideo.reportEvent = reportEvent; final Method method = getMethod("should_create_video_from_root_directory"); AfterVideoRecorded afterVideoRecorded = new AfterVideoRecorded(new After(TakeDockerEnvironmentTest.class, method), Paths.get("target/myvideo.flv")); //when takeVncDroneVideo.reportScreencastRecording(afterVideoRecorded, getReporterConfiguration()); //then verify(reportEvent).fire(reportEventArgumentCaptor.capture()); final SectionEvent sectionEvent = reportEventArgumentCaptor.getValue(); final String methodName = method.getName(); assertThatSection(sectionEvent) .hasSectionId(methodName) .hasReportOfTypeThatIsAssignableFrom(TestMethodReport.class); final Report report = sectionEvent.getReport(); assertThatReport(report) .hasName(methodName) .hasNumberOfEntries(1) .hasEntriesContaining(new KeyValueEntry(DockerEnvironmentReportKey.VIDEO_PATH, new FileEntry("myvideo.mp4"))); }
void cleanAfter(@Observes After after) { this.clean(after.getTestClass(), after.getTestMethod(), true); }
void cleanAfter(@Observes After after) { this.clean(after.getTestClass(), after.getTestMethod(), true); }