1

I am running my script in java and getting the results in testNG. But in my application after filling up the form I am getting a confirmation alert message. I am able to read that alert message and capture screenshot using selenium but I want to write/include that alert message and screenshot (or its path) in the testNG report.

Is there any way to do that as I am new to testNG

1

1 Answer 1

1

You can use reportNG. Its the reporting plugin for testNG. You can add your message using Reporter.log("Your Message");

If you want to add your alert messages in report and your project is Maven project then add following in pom.xml

<reporting>
    <plugins>
        <plugin>
            <groupId>org.testng.xslt</groupId>
            <artifactId>testng-xslt-plugin</artifactId>
            <version>1.1</version>
            <configuration>
                <showRuntimeTotals>true</showRuntimeTotals>
                <sortTestCaseLinks>true</sortTestCaseLinks>
                <testDetailsFilter>FAIL,PASS,SKIP,CONF</testDetailsFilter>
            </configuration>
        </plugin>
    </plugins>
</reporting>

Using Reporter.log("Your message"); you can add your messages and can see in Test Output-> index.html ->Reporter Output

For more details http://seleniumeasy.com/testng-tutorials/configuring-reportng-with-testng-to-generate-html-reports

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.