TestNG Tutorial
Introduction to TestNG Configuration and set up of TestNG project Simple TestNG project in IntelliJ IDEA TestNG annotations Assertions in TestNG Difference between assertEquals and assertSame Ignoring the tests in TestNG Grouping the tests timeOut tests in TestNG Exception tests in TestNG dependsOnMethods dependsOnGroups Hard and Soft dependencies Passing parameters using XML file Passing parameters using Data providers Dynamic Data Providers group-by-instances attribute in TestNG XML suite file Test priorities in TestNG invocationCount in TestNG Executing Selenium tests using TestNG Executing TestNG tests using main method Executing JUnit tests from within TestNG Running tests in Parallel in TestNG Executing only failed tests in TestNG TestNG integration with Maven TestNG integration with Gradle Reporter class in TestNG TestNG Reports Execution Listener Test Listener Comparison between JUnit and TestNGReporter class in testng
In TestNG framework, we have a class called as org.testng.Reporter. This class can be used to send custom logs to TestNG HTML report. As shown in below example, you can use static methods to dump data in report. In below example, we have used log method of Reporter class.
@Test(dependsOnMethods = "org.softpost.Class2.test1")
public void test1(){
System.out.println("Test1 from Class1");
Reporter.log("This will be displayed in report");
Assert.assertTrue(2==3);
}
Here is the HTML report showing the log. Reporter output in TestNG Reporter output in TestNGWeb development and Automation testing
solutions delivered!!