Search in sources :

Example 1 with Result

use of cucumber.api.Result in project page-factory-2 by sbtqa.

the class CriticalStepCheckAspect method sendCaseFinished.

@Around("sendCaseFinished(event)")
public void sendCaseFinished(ProceedingJoinPoint joinPoint, TestCaseFinished event) throws Throwable {
    boolean hasFailedNonCriticalStep = hasFailedNonCriticalStep(event.testCase);
    if (hasFailedNonCriticalStep) {
        final Result result = new Result(Result.Type.PASSED, event.result.getDuration(), new AutotestError(NON_CRITICAL_CATEGORY_MESSAGE));
        event = new TestCaseFinished(event.getTimeStamp(), event.getTimeStampMillis(), event.testCase, result);
        Allure.getLifecycle().updateTestCase(getCurrentTestCaseUid(event.testCase), testResult -> testResult.setStatus(Status.PASSED));
        joinPoint.proceed(new Object[] { event });
    } else {
        joinPoint.proceed();
    }
}
Also used : AutotestError(ru.sbtqa.tag.qautils.errors.AutotestError) TestCaseFinished(cucumber.api.event.TestCaseFinished) Result(cucumber.api.Result) TestResult(io.qameta.allure.model.TestResult) Around(org.aspectj.lang.annotation.Around)

Example 2 with Result

use of cucumber.api.Result in project page-factory-2 by sbtqa.

the class CriticalStepCheckAspect method sendStepFinished.

@Around("sendStepFinished(event)")
public void sendStepFinished(ProceedingJoinPoint joinPoint, TestStepFinished event) throws Throwable {
    PickleStep step = getDefinitionMatchStep(event.testStep);
    if (hasError(step)) {
        final Result result = new Result(Result.Type.AMBIGUOUS, event.result.getDuration(), ((PickleStepTag) step).getError());
        event = new TestStepFinished(event.getTimeStamp(), event.getTimeStampMillis(), event.getTestCase(), event.testStep, result);
    }
    joinPoint.proceed(new Object[] { event });
}
Also used : PickleStep(gherkin.pickles.PickleStep) TestStepFinished(cucumber.api.event.TestStepFinished) Result(cucumber.api.Result) TestResult(io.qameta.allure.model.TestResult) Around(org.aspectj.lang.annotation.Around)

Aggregations

Result (cucumber.api.Result)2 TestResult (io.qameta.allure.model.TestResult)2 Around (org.aspectj.lang.annotation.Around)2 TestCaseFinished (cucumber.api.event.TestCaseFinished)1 TestStepFinished (cucumber.api.event.TestStepFinished)1 PickleStep (gherkin.pickles.PickleStep)1 AutotestError (ru.sbtqa.tag.qautils.errors.AutotestError)1