Java Code Examples for com.aventstack.extentreports.ExtentTest#info()

The following examples show how to use com.aventstack.extentreports.ExtentTest#info() . 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: MyExtentTestNgFormatter.java    From Java-API-Test-Examples with Apache License 2.0 6 votes vote down vote up
public void afterInvocation(IInvokedMethod iInvokedMethod, ITestResult iTestResult) {
    if (iInvokedMethod.isTestMethod()) {
        ExtentTest test = (ExtentTest) iTestResult.getAttribute("test");
        List<String> logs = Reporter.getOutput(iTestResult);
        for (String log : logs) {
            test.info(log);
        }

        int status = iTestResult.getStatus();
        if (ITestResult.SUCCESS == status) {
            test.pass("Passed");
        } else if (ITestResult.FAILURE == status) {
            test.fail(iTestResult.getThrowable());
        } else {
            test.skip("Skipped");
        }

        for (String group : iInvokedMethod.getTestMethod().getGroups()) {
            test.assignCategory(group);
        }
    }
}
 
Example 2
Source File: MyExtentTestNgFormatter.java    From Java-API-Test-Examples with Apache License 2.0 6 votes vote down vote up
public void afterInvocation(IInvokedMethod iInvokedMethod, ITestResult iTestResult) {
    if (iInvokedMethod.isTestMethod()) {
        ExtentTest test = (ExtentTest) iTestResult.getAttribute("test");
        List<String> logs = Reporter.getOutput(iTestResult);
        for (String log : logs) {
            test.info(log);
        }

        int status = iTestResult.getStatus();
        if (ITestResult.SUCCESS == status) {
            test.pass("Passed");
        } else if (ITestResult.FAILURE == status) {
            test.fail(iTestResult.getThrowable());
        } else {
            test.skip("Skipped");
        }

        for (String group : iInvokedMethod.getTestMethod().getGroups()) {
            test.assignCategory(group);
        }
    }
}
 
Example 3
Source File: MyExtentTestNgFormatter.java    From TestHub with MIT License 6 votes vote down vote up
public void afterInvocation(IInvokedMethod iInvokedMethod, ITestResult iTestResult) {
    if (iInvokedMethod.isTestMethod()) {
        ExtentTest test = (ExtentTest) iTestResult.getAttribute("test");
        List<String> logs = Reporter.getOutput(iTestResult);
        for (String log : logs) {
            test.info(log);
        }

        int status = iTestResult.getStatus();
        if (ITestResult.SUCCESS == status) {
            test.pass("Passed");
        } else if (ITestResult.FAILURE == status) {
            test.fail(iTestResult.getThrowable());
        } else {
            test.skip("Skipped");
        }

        for (String group : iInvokedMethod.getTestMethod().getGroups()) {
            test.assignCategory(group);
        }
    }
}
 
Example 4
Source File: MyExtentTestNgFormatter.java    From Java-API-Test-Examples with Apache License 2.0 5 votes vote down vote up
/**
 * Adds a info log message to the node
 *
 * @param logMessage The log message string
 * @param nodeName   The name of the node
 */
public void addInfoLogToNode(String logMessage, String nodeName) {
    ITestResult result = Reporter.getCurrentTestResult();
    Preconditions.checkState(result != null);
    ExtentTest test = (ExtentTest) result.getAttribute(nodeName);
    test.info(logMessage);
}
 
Example 5
Source File: MyExtentTestNgFormatter.java    From Java-API-Test-Examples with Apache License 2.0 5 votes vote down vote up
/**
 * Adds a info log message to the node
 *
 * @param logMessage The log message string
 * @param nodeName   The name of the node
 */
public void addInfoLogToNode(String logMessage, String nodeName) {
    ITestResult result = Reporter.getCurrentTestResult();
    Preconditions.checkState(result != null);
    ExtentTest test = (ExtentTest) result.getAttribute(nodeName);
    test.info(logMessage);
}
 
Example 6
Source File: MyExtentTestNgFormatter.java    From TestHub with MIT License 5 votes vote down vote up
/**
 * Adds a info log message to the node
 *
 * @param logMessage The log message string
 * @param nodeName   The name of the node
 */
public void addInfoLogToNode(String logMessage, String nodeName) {
    ITestResult result = Reporter.getCurrentTestResult();
    Preconditions.checkState(result != null);
    ExtentTest test = (ExtentTest) result.getAttribute(nodeName);
    test.info(logMessage);
}