Java Code Examples for com.aventstack.extentreports.Status#SKIP

The following examples show how to use com.aventstack.extentreports.Status#SKIP . 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: ExtentTestManager.java    From extentreports-testng-adapter with Apache License 2.0 6 votes vote down vote up
public static synchronized void log(ITestResult result, Boolean createTestAsChild) {
    String msg = "Test ";
    Status status = Status.PASS;
    switch (result.getStatus()) {
        case ITestResult.SKIP:
            status = Status.SKIP;
            msg += "skipped";
            break;
        case ITestResult.FAILURE:
            status = Status.FAIL;
            msg += "failed";
            break;
        default:
            msg += "passed";
            break;
    }
    if (ExtentTestManager.getTest(result) == null) {
        ExtentTestManager.createMethod(result, createTestAsChild);
    }
    if (result.getThrowable() != null) {
        ExtentTestManager.getTest(result).log(status, result.getThrowable());
        return;
    }
    ExtentTestManager.getTest(result).log(status, msg);
}
 
Example 2
Source File: NamedAttributeContext.java    From extentreports-java with Apache License 2.0 5 votes vote down vote up
private synchronized void refresh(Test test) {
    if (test.getStatus() == Status.PASS)
        passed++;
    else if (test.getStatus() == Status.FAIL)
        failed++;
    else if (test.getStatus() == Status.SKIP)
        skipped++;
    else
        others++;
}
 
Example 3
Source File: ExtentCucumberAdapter.java    From extentreports-cucumber4-adapter with Apache License 2.0 4 votes vote down vote up
private synchronized void updateResult(Result result) {
    switch (result.getStatus().lowerCaseName()) {
        case "failed":
            stepTestThreadLocal.get().fail(result.getError());
            break;
        case "undefined":
        	if (strict) {
        		stepTestThreadLocal.get().fail("Step undefined");
        		break;
        	}
        	stepTestThreadLocal.get().skip("Step undefined");
        	break;
        case "pending":
        case "skipped":
        	if (isHookThreadLocal.get()) {
        		ExtentService.getInstance().removeTest(stepTestThreadLocal.get());
        		break;
        	}
            Boolean currentEndingEventSkipped = stepTestThreadLocal.get().getModel().getLogContext() != null 
                && !stepTestThreadLocal.get().getModel().getLogContext().isEmpty()
                    ? stepTestThreadLocal.get().getModel().getLogContext().getLast().getStatus() == Status.SKIP
                    : false;
            if (result.getError() != null) {
                stepTestThreadLocal.get().skip(result.getError());
            } else if (!currentEndingEventSkipped) {
                String details = result.getErrorMessage() == null ? "Step skipped" : result.getErrorMessage();
                stepTestThreadLocal.get().skip(details);
            }
            break;
        case "passed":
            if (stepTestThreadLocal.get()!= null && stepTestThreadLocal.get().getModel().getLogContext().isEmpty() && !isHookThreadLocal.get()) {
        		stepTestThreadLocal.get().pass("");
            }
            if (stepTestThreadLocal.get() != null) {
             Boolean hasLog = TestService.testHasLog(stepTestThreadLocal.get().getModel());
             Boolean hasScreenCapture = hasLog && LogService.logHasScreenCapture(stepTestThreadLocal.get().getModel().getLogContext().getFirst());
             if (isHookThreadLocal.get() && !hasLog && !hasScreenCapture) {
                 ExtentService.getInstance().removeTest(stepTestThreadLocal.get());
             }
            }
            break;
        default:
            break;
    }
}