How to modify testNG report in selenium java



  • 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



  • 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



Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2