I'm trying to write a custom reporter to gather all of my test results and logging information. I started to use TestNG's Reporter class for logging. I then wrote my own listener, which implements ITestListener, to write a report file as my tests are executed. I'm finding that when I have a simple test that takes no parameter, I am able to do the following and create a report:
public void onTestSuccess(ITestResult tr) {
List<String> outputList = Reporter.getOutput(tr);
// ... write the content in outputList to file
}
In this case, I am able to get the results for each of the executed tests and organize them to different files.
However, when I add a @DataProvider annotation to my test and make it take a parameter, I can't use the Reporter.getOutput(ITestResult) method anymore. When I run with the same listener as listed above, I get no output back.
Is there something that I'm missing? How is each test result mapped to its logging output?
Any advice is appreciated!
Thanks,
Tina Li
---------------------------------------------------------------------
Posted via Jive Forums
http://forums.opensymphony.com/thread.jspa?threadID=43866&messageID=88328#88328
Tina
---------------------------------------------------------------------
Posted via Jive Forums
http://forums.opensymphony.com/thread.jspa?threadID=43866&messageID=88336#88336
I just found out that getting the reports from a testresult if a timeout attribute is added to my Test annotation. If I remove the timeout attribute, I seem to be able to retrieve the report output for my each test result.
Thanks for your fast reply!
It's definitely something to do with the timeOut attribute. All I did was add a timeOut attribute to the test annotation and set that to 160000. When I run the test, I don't see any output. Below is what I've modified and the corresponding output.
------------------------------------------------------------------------------
package test.tmp;
public class ReporterTest {
-----------------------------------------------------------------------------------
Output:
[ReporterTest] ON SUCCESS, OUTPUT:[]
[ReporterTest] ON SUCCESS, OUTPUT:[]
===============================================
Command line suite
Total tests run: 2, Failures: 0, Skips: 0
===============================================
---------------------------------------------------------------------
Posted via Jive Forums
http://forums.opensymphony.com/thread.jspa?threadID=43866&messageID=88342#88342
Tina
---------------------------------------------------------------------
Posted via Jive Forums
http://forums.opensymphony.com/thread.jspa?threadID=43866&messageID=88353#88353