ru.yandex.qatools.allure.events.TestCaseFinishedEvent Java Examples
The following examples show how to use
ru.yandex.qatools.allure.events.TestCaseFinishedEvent.
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: Allure.java From allure1 with Apache License 2.0 | 6 votes |
/** * Process TestCaseFinishedEvent. Add steps and attachments from * top step from stepStorage to current testCase, then remove testCase * and step from stores. Also remove attachments matches removeAttachments * config. * * @param event to process */ public void fire(TestCaseFinishedEvent event) { TestCaseResult testCase = testCaseStorage.get(); event.process(testCase); Step root = stepStorage.pollLast(); if (Status.PASSED.equals(testCase.getStatus())) { new RemoveAttachmentsEvent(AllureConfig.newInstance().getRemoveAttachments()).process(root); } testCase.getSteps().addAll(root.getSteps()); testCase.getAttachments().addAll(root.getAttachments()); stepStorage.remove(); testCaseStorage.remove(); notifier.fire(event); }
Example #2
Source File: AllureRunListener.java From allure-cucumberjvm with Apache License 2.0 | 5 votes |
@Override public void testFinished(Description description) throws IllegalAccessException { if (description.isSuite()) { testSuiteFinished(getSuiteUid(description)); } else { getLifecycle().fire(new TestCaseFinishedEvent()); } }
Example #3
Source File: ListenersNotifier.java From allure1 with Apache License 2.0 | 5 votes |
/** * Invoke to tell listeners that an test case finished event processed */ @Override public void fire(TestCaseFinishedEvent event) { for (LifecycleListener listener : listeners) { try { listener.fire(event); } catch (Exception e) { logError(listener, e); } } }
Example #4
Source File: AllureTestListenerTest.java From allure1 with Apache License 2.0 | 5 votes |
@Test public void skipTestFiredEventsOrder() { when(testResult.getTestContext()).thenReturn(testContext); when(testResult.getThrowable()).thenReturn(new NullPointerException()); when(testResult.getName()).thenReturn(DEFAULT_TEST_NAME); doReturn(new Annotation[0]).when(testngListener).getMethodAnnotations(testResult); testngListener.onTestSkipped(testResult); InOrder inOrder = inOrder(allure); inOrder.verify(allure).fire(isA(TestCaseStartedEvent.class)); inOrder.verify(allure).fire(isA(TestCaseCanceledEvent.class)); inOrder.verify(allure).fire(isA(TestCaseFinishedEvent.class)); }
Example #5
Source File: AllureMarathonRunListener.java From marathonv5 with Apache License 2.0 | 4 votes |
@Override public void testFinished(Description description) { Test test = (Test) TestAttributes.get("test_object"); if (test != null && test instanceof MarathonTestCase) { StringBuilder failed = new StringBuilder(); List<CheckList> checklists = ((MarathonTestCase) test).getChecklists(); for (CheckList checkList : checklists) { String name = checkList.getName(); ByteArrayOutputStream out = new ByteArrayOutputStream(); checkList.saveHTML(out); getLifecycle().fire(new MakeAttachmentEvent(out.toByteArray(), name, "text/html")); if (checkList.getCaptureFile() != null) { File captureFile = new File(System.getProperty(Constants.PROP_IMAGE_CAPTURE_DIR), "ext-" + checkList.getCaptureFile()); try { getLifecycle().fire(new MakeAttachmentEvent(Files.readAllBytes(captureFile.toPath()), name + "(ScreenCapture)", "image/png")); } catch (IOException e) { e.printStackTrace(); } } if ("Fail".equals(checkList.getStatus())) { failed.append(checkList.getName()).append(", "); } } if (failed.length() > 0) { failed.setLength(failed.length() - 2); net.sourceforge.marathon.runtime.api.Failure[] failures = new net.sourceforge.marathon.runtime.api.Failure[] { null }; failures[0] = new net.sourceforge.marathon.runtime.api.Failure("Failed Checklists: " + failed.toString(), new SourceLine[0], null); MarathonAssertion assertion = new MarathonAssertion(failures, ((MarathonTestCase) test).getName()); testAssumptionFailure(new Failure(description, assertion)); } List<ScreenShotEntry> screenshots = ((MarathonTestCase) test).getScreenshots(); for (ScreenShotEntry entry : screenshots) { entry.fire(getLifecycle()); } } getLifecycle().fire(new TestCaseFinishedEvent()); }
Example #6
Source File: AllureMarathonRunListener.java From marathonv5 with Apache License 2.0 | 4 votes |
public void finishFakeTestCase() { getLifecycle().fire(new TestCaseFinishedEvent()); }
Example #7
Source File: AllureRunListener.java From allure-cucumberjvm with Apache License 2.0 | 4 votes |
public void finishFakeTestCase() { getLifecycle().fire(new TestCaseFinishedEvent()); }
Example #8
Source File: AllureLifecycleTest.java From allure1 with Apache License 2.0 | 4 votes |
public void fireTestCaseFinished() { Allure.LIFECYCLE.fire(new TestCaseFinishedEvent()); }
Example #9
Source File: SimpleListener.java From allure1 with Apache License 2.0 | 4 votes |
@Override public void fire(TestCaseFinishedEvent event) { counts.get(EventType.TESTCASE_FINISHED_EVENT).incrementAndGet(); }
Example #10
Source File: ListenersNotifierTest.java From allure1 with Apache License 2.0 | 4 votes |
@Test public void testcaseFinishedEventTest() throws Exception { allure.fire(new TestCaseFinishedEvent()); assertThat(listener.get(SimpleListener.EventType.TESTCASE_FINISHED_EVENT), is(1)); }
Example #11
Source File: AllureRunListener.java From allure1 with Apache License 2.0 | 4 votes |
@Override public void testFinished(Description description) { getLifecycle().fire(new TestCaseFinishedEvent()); }
Example #12
Source File: AllureRunListener.java From allure1 with Apache License 2.0 | 4 votes |
public void finishFakeTestCase() { getLifecycle().fire(new TestCaseFinishedEvent()); }
Example #13
Source File: AllureRunListenerTest.java From allure1 with Apache License 2.0 | 4 votes |
@Test public void testFinishedTest() throws Exception { Description description = mock(Description.class); runListener.testFinished(description); verify(allure).fire(eq(new TestCaseFinishedEvent())); }
Example #14
Source File: AllureTestListener.java From allure1 with Apache License 2.0 | 4 votes |
private void fireFinishTest() { getLifecycle().fire(new TestCaseFinishedEvent()); }
Example #15
Source File: LifecycleListener.java From allure1 with Apache License 2.0 | 2 votes |
/** * Called when a test case finished */ public void fire(TestCaseFinishedEvent event) { // NOSONAR }