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

The following examples show how to use ru.yandex.qatools.allure.events.TestCaseCanceledEvent. 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: AllureMarathonRunListener.java    From marathonv5 with Apache License 2.0 5 votes vote down vote up
public void fireTestCaseFailure(Throwable throwable) {
    if (throwable instanceof AssumptionViolatedException) {
        getLifecycle().fire(new TestCaseCanceledEvent().withThrowable(throwable));
    } else {
        getLifecycle().fire(new TestCaseFailureEvent().withThrowable(throwable));
    }
}
 
Example #2
Source File: AllureRunListener.java    From allure-cucumberjvm with Apache License 2.0 5 votes vote down vote up
public void fireTestCaseFailure(Throwable throwable) {
    if (throwable instanceof AssumptionViolatedException) {
        getLifecycle().fire(new TestCaseCanceledEvent().withThrowable(throwable));
    } else {
        getLifecycle().fire(new TestCaseFailureEvent().withThrowable(throwable));
    }
}
 
Example #3
Source File: AllureRunListener.java    From allure1 with Apache License 2.0 5 votes vote down vote up
public void fireTestCaseFailure(Throwable throwable) {
    if (throwable instanceof AssumptionViolatedException) {
        getLifecycle().fire(new TestCaseCanceledEvent().withThrowable(throwable));
    } else {
        getLifecycle().fire(new TestCaseFailureEvent().withThrowable(throwable));
    }
}
 
Example #4
Source File: AllureRunListenerTest.java    From allure1 with Apache License 2.0 5 votes vote down vote up
@Test
public void testFailureWithAssumptionTest() throws Exception {
    Description description = mock(Description.class);
    when(description.isTest()).thenReturn(true);
    Throwable exception = mock(AssumptionViolatedException.class);

    Failure failure = mockFailureWith(exception, description);

    runListener.testFailure(failure);

    verify(allure).fire(eq(new TestCaseCanceledEvent().withThrowable(exception)));
}
 
Example #5
Source File: AllureTestListener.java    From allure1 with Apache License 2.0 5 votes vote down vote up
private void fireTestCaseCancel(ITestResult iTestResult) {
    Throwable skipMessage = new Throwable() {
        private static final long serialVersionUID = 1L;

        @Override
        public String getMessage() {
            return "Skipped due to dependency on other skipped or failed test methods";
        }
    };
    getLifecycle().fire(new TestCaseCanceledEvent().withThrowable(skipMessage));
}
 
Example #6
Source File: AllureTestListenerTest.java    From allure1 with Apache License 2.0 5 votes vote down vote up
@Test
public void skipTestWithoutThrowable() {
    when(testResult.getTestContext()).thenReturn(testContext);
    when(testResult.getName()).thenReturn(DEFAULT_TEST_NAME);

    doReturn(new Annotation[0]).when(testngListener).getMethodAnnotations(testResult);

    testngListener.onTestSkipped(testResult);

    verify(allure).fire(isA(TestCaseCanceledEvent.class));
}
 
Example #7
Source File: AllureTestListenerTest.java    From allure1 with Apache License 2.0 5 votes vote down vote up
@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 #8
Source File: AllureTestListener.java    From allure1 with Apache License 2.0 4 votes vote down vote up
@Override
public void onTestFailedButWithinSuccessPercentage(ITestResult iTestResult) {
    Throwable throwable = iTestResult.getThrowable();
    getLifecycle().fire(new TestCaseCanceledEvent().withThrowable(throwable));
    fireFinishTest();
}