ru.yandex.qatools.allure.events.TestSuiteFinishedEvent Java Examples

The following examples show how to use ru.yandex.qatools.allure.events.TestSuiteFinishedEvent. 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 vote down vote up
/**
 * Process TestSuiteFinishedEvent. Using event.getUid() to access testSuite.
 * Then remove this suite from storage and marshal testSuite to xml using
 * AllureResultsUtils.writeTestSuiteResult()
 *
 * @param event to process
 */
public void fire(TestSuiteFinishedEvent event) {
    String suiteUid = event.getUid();

    TestSuiteResult testSuite = testSuiteStorage.remove(suiteUid);
    if (testSuite == null) {
        return;
    }
    event.process(testSuite);

    testSuite.setVersion(getVersion());
    testSuite.getLabels().add(AllureModelUtils.createProgrammingLanguageLabel());

    writeTestSuiteResult(testSuite);

    notifier.fire(event);
}
 
Example #2
Source File: AllureTestListener.java    From allure1 with Apache License 2.0 6 votes vote down vote up
@Override
public void onConfigurationSkip(ITestResult iTestResult) {
    if (isSuppressConfigEvent(iTestResult)) {
        return;
    }
    String suiteUid = getSuiteUid(iTestResult.getTestContext());
    if (isAfterSuiteConfigMethod(iTestResult)) {
        String suiteTitle = getCurrentSuiteTitle(iTestResult.getTestContext());
        getLifecycle().fire(new TestSuiteStartedEvent(suiteUid, suiteTitle).withTitle(suiteTitle));
    }
    createConfigEvent(iTestResult);
    fireTestCaseCancel(iTestResult);
    fireFinishTest();
    if (isAfterSuiteConfigMethod(iTestResult)) {
        getLifecycle().fire(new TestSuiteFinishedEvent(suiteUid));
    }
}
 
Example #3
Source File: ListenersNotifier.java    From allure1 with Apache License 2.0 5 votes vote down vote up
/**
 * Invoke to tell listeners that an test suite finished event processed
 */
@Override
public void fire(TestSuiteFinishedEvent event) {
    for (LifecycleListener listener : listeners) {
        try {
            listener.fire(event);
        } catch (Exception e) {
            logError(listener, e);
        }
    }
}
 
Example #4
Source File: AllureShutdownHook.java    From allure1 with Apache License 2.0 5 votes vote down vote up
/**
 * Mark unfinished test cases as interrupted for each unfinished test suite, then write
 * test suite result
 * @see #createFakeTestcaseWithWarning(ru.yandex.qatools.allure.model.TestSuiteResult)
 * @see #markTestcaseAsInterruptedIfNotFinishedYet(ru.yandex.qatools.allure.model.TestCaseResult)
 */
@Override
public void run() {
    for (Map.Entry<String, TestSuiteResult> entry : testSuites) {
        for (TestCaseResult testCase : entry.getValue().getTestCases()) {
            markTestcaseAsInterruptedIfNotFinishedYet(testCase);
        }
        entry.getValue().getTestCases().add(createFakeTestcaseWithWarning(entry.getValue()));

        Allure.LIFECYCLE.fire(new TestSuiteFinishedEvent(entry.getKey()));
    }
}
 
Example #5
Source File: AllureRunListenerTest.java    From allure1 with Apache License 2.0 5 votes vote down vote up
@SuppressWarnings("unchecked")
@Test
public void testRunFinishedTest() throws Exception {
    Result result = mock(Result.class);
    Map<String, String> fakeSuites = (Map<String, String>) mock(Map.class);

    doReturn(Arrays.asList("first.uid", "second.uid")).when(fakeSuites).values();

    doReturn(fakeSuites).when(runListener).getSuites();

    runListener.testRunFinished(result);

    verify(allure).fire(eq(new TestSuiteFinishedEvent("first.uid")));
    verify(allure).fire(eq(new TestSuiteFinishedEvent("second.uid")));
}
 
Example #6
Source File: AllureTestListener.java    From allure1 with Apache License 2.0 5 votes vote down vote up
@Override
public void onConfigurationFailure(ITestResult iTestResult) {
    if (isSuppressConfigEvent(iTestResult)) {
        return;
    }
    String suiteUid = getSuiteUid(iTestResult.getTestContext());
    if (isAfterSuiteConfigMethod(iTestResult)) {
        String suiteTitle = getCurrentSuiteTitle(iTestResult.getTestContext());
        getLifecycle().fire(new TestSuiteStartedEvent(suiteUid, suiteTitle).withTitle(suiteTitle));
    }
    Throwable throwable = iTestResult.getThrowable();
    createConfigEvent(iTestResult);
    getLifecycle().fire(new TestCaseFailureEvent().withThrowable(throwable));
    fireFinishTest();
    if (isAfterSuiteConfigMethod(iTestResult)) {
        getLifecycle().fire(new TestSuiteFinishedEvent(suiteUid));
    }
}
 
Example #7
Source File: AllureMarathonRunListener.java    From marathonv5 with Apache License 2.0 4 votes vote down vote up
public void testSuiteFinished(String uid) {
    getLifecycle().fire(new TestSuiteFinishedEvent(uid));
}
 
Example #8
Source File: AllureRunListener.java    From allure-cucumberjvm with Apache License 2.0 4 votes vote down vote up
public void testSuiteFinished(String uid) {
    getLifecycle().fire(new TestSuiteFinishedEvent(uid));
}
 
Example #9
Source File: AllureLifecycleTest.java    From allure1 with Apache License 2.0 4 votes vote down vote up
public void fireTestSuiteFinished(String uid) {
    Allure.LIFECYCLE.fire(new TestSuiteFinishedEvent(uid));
}
 
Example #10
Source File: SimpleListener.java    From allure1 with Apache License 2.0 4 votes vote down vote up
@Override
public void fire(TestSuiteFinishedEvent event) {
    counts.get(EventType.TESTSUITE_FINISHED_EVENT).incrementAndGet();
}
 
Example #11
Source File: ListenersNotifierTest.java    From allure1 with Apache License 2.0 4 votes vote down vote up
@Test
public void testsuiteFinishedEventTest() throws Exception {
    allure.fire(new TestSuiteStartedEvent("uid", "name"));
    allure.fire(new TestSuiteFinishedEvent("uid"));
    assertThat(listener.get(SimpleListener.EventType.TESTSUITE_FINISHED_EVENT), is(1));
}
 
Example #12
Source File: AllureRunListener.java    From allure1 with Apache License 2.0 4 votes vote down vote up
public void testSuiteFinished(String uid) {
    getLifecycle().fire(new TestSuiteFinishedEvent(uid));
}
 
Example #13
Source File: AllureRunListenerTest.java    From allure1 with Apache License 2.0 4 votes vote down vote up
@Test
public void testSuiteFinishedTest() throws Exception {
    runListener.testSuiteFinished("some-uid");
    verify(allure).fire(eq(new TestSuiteFinishedEvent("some-uid")));
}
 
Example #14
Source File: AllureTestListener.java    From allure1 with Apache License 2.0 4 votes vote down vote up
@Override
public void onFinish(ITestContext iTestContext) {
    getLifecycle().fire(new TestSuiteFinishedEvent(getSuiteUid(iTestContext)));
}
 
Example #15
Source File: LifecycleListener.java    From allure1 with Apache License 2.0 2 votes vote down vote up
/**
 * Called when a test suite finished
 */
public void fire(TestSuiteFinishedEvent event) { // NOSONAR
}