Search code examples
javatestngreportng

How to extend ReportNG?


I am using TestNG to configure my tests and using ReportNG for reporting.

Code Set up

I have a class that has a TestNG data provider which is configured with parallel=true and for every element that Data Provider provides, different threads are spawned (thread count is configurable) to run a @Test

Question

The reportNG result looks nice and appears something like below in html

MyTestName 0.297s Method arguments: "URL1"

MyTestName 0.156s Method arguments: "URL2"

Based on the logic in my @Test MyTestName, I would like to pass/fail @Test and print messages which will appear in ReportNG report. How would I do this that would be thread safe? could some one point me to sample examples?

Thank you!


Solution

  • Have you tried using Reporter.log()? (it's part of the TestNG API)