[testng-dev] Possible bugs with reporter handling

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

[testng-dev] Possible bugs with reporter handling

Christian Mötzing
Hi, I attached a simple project. I was trying to disable default listener and re-enable two of the default listener a.k.a. reporter. The documentation mentions a property -reporter (analogous to -listener). For me this flag is not working. Any reporter set here is silently ignored ('mvn -f pom.xml clean test' in test project). I am calling testng through maven-surefire-plugin but that should not change what is documented here, right? http://testng.org/doc/documentation-main.html (Chapter 4 - Running TestNG).

Second thing is if I set the reporter as listener it gets called but does not work:

java.io.FileNotFoundException: D:\mbc\testng-bug\.\target\surefire-reports\testng-results.xml (The system cannot find the path specified.)
        at java.io.FileOutputStream.open(Native Method)
        at java.io.FileOutputStream.<init>(FileOutputStream.java:205)
        at java.io.FileOutputStream.<init>(FileOutputStream.java:156)
        at java.io.FileWriter.<init>(FileWriter.java:84)
        at org.testng.internal.Utils.writeUtf8File(Utils.java:107)
        at org.testng.reporters.XMLReporter.generateReport(XMLReporter.java:66)
        at org.testng.TestNG.generateReports(TestNG.java:1115)
        at org.testng.TestNG.run(TestNG.java:1074)
        at org.apache.maven.surefire.testng.TestNGExecutor.run(TestNGExecutor.java:115)
        at org.apache.maven.surefire.testng.TestNGDirectoryTestSuite.executeSingleClass(TestNGDirectoryTestSuite.java:128)
        at org.apache.maven.surefire.testng.TestNGDirectoryTestSuite.execute(TestNGDirectoryTestSuite.java:112)
        at org.apache.maven.surefire.testng.TestNGProvider.invoke(TestNGProvider.java:112)
        at org.apache.maven.surefire.booter.ForkedBooter.invokeProviderInSameClassLoader(ForkedBooter.java:200)
        at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:153)
        at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:103)

Execute 'mvn -f pom-2.xml clean test' in test project to reproduce. Same for the SuiteHTMLReporter, it can not find testng.css.

Thx in advance

Christian

--
You received this message because you are subscribed to the Google Groups "testng-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at http://groups.google.com/group/testng-dev.
For more options, visit https://groups.google.com/d/optout.

testng-bug.zip (4K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

[testng-dev] Re: Possible bugs with reporter handling

Christian Mötzing
Can anyone confirm this behaviour or point out a mistake I made? 
Or should I just file a bug report?

Am Montag, 6. Oktober 2014 13:55:56 UTC+1 schrieb Christian Mötzing:
Hi, I attached a simple project. I was trying to disable default listener and re-enable two of the default listener a.k.a. reporter. The documentation mentions a property -reporter (analogous to -listener). For me this flag is not working. Any reporter set here is silently ignored ('mvn -f pom.xml clean test' in test project). I am calling testng through maven-surefire-plugin but that should not change what is documented here, right? <a href="http://testng.org/doc/documentation-main.html" target="_blank" onmousedown="this.href='http://www.google.com/url?q\75http%3A%2F%2Ftestng.org%2Fdoc%2Fdocumentation-main.html\46sa\75D\46sntz\0751\46usg\75AFQjCNFCO6oNdaaQm2UazDt4EC_TxJZSRw';return true;" onclick="this.href='http://www.google.com/url?q\75http%3A%2F%2Ftestng.org%2Fdoc%2Fdocumentation-main.html\46sa\75D\46sntz\0751\46usg\75AFQjCNFCO6oNdaaQm2UazDt4EC_TxJZSRw';return true;">http://testng.org/doc/documentation-main.html (Chapter 4 - Running TestNG).

Second thing is if I set the reporter as listener it gets called but does not work:

java.io.FileNotFoundException: D:\mbc\testng-bug\.\target\surefire-reports\testng-results.xml (The system cannot find the path specified.)
        at java.io.FileOutputStream.open(Native Method)
        at java.io.FileOutputStream.<init>(FileOutputStream.java:205)
        at java.io.FileOutputStream.<init>(FileOutputStream.java:156)
        at java.io.FileWriter.<init>(FileWriter.java:84)
        at org.testng.internal.Utils.writeUtf8File(Utils.java:107)
        at org.testng.reporters.XMLReporter.generateReport(XMLReporter.java:66)
        at org.testng.TestNG.generateReports(TestNG.java:1115)
        at org.testng.TestNG.run(TestNG.java:1074)
        at org.apache.maven.surefire.testng.TestNGExecutor.run(TestNGExecutor.java:115)
        at org.apache.maven.surefire.testng.TestNGDirectoryTestSuite.executeSingleClass(TestNGDirectoryTestSuite.java:128)
        at org.apache.maven.surefire.testng.TestNGDirectoryTestSuite.execute(TestNGDirectoryTestSuite.java:112)
        at org.apache.maven.surefire.testng.TestNGProvider.invoke(TestNGProvider.java:112)
        at org.apache.maven.surefire.booter.ForkedBooter.invokeProviderInSameClassLoader(ForkedBooter.java:200)
        at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:153)
        at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:103)

Execute 'mvn -f pom-2.xml clean test' in test project to reproduce. Same for the SuiteHTMLReporter, it can not find testng.css.

Thx in advance

Christian

--
You received this message because you are subscribed to the Google Groups "testng-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at http://groups.google.com/group/testng-dev.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

[testng-dev] Re: Possible bugs with reporter handling

Christian Mötzing
In reply to this post by Christian Mötzing
It looks like the reporters do NOT create the output directory if it does not exist.

public class HtmlAndXmlReporter implements IReporter {

    private final XMLReporter xmlReporter = new XMLReporter();

    @Override
   public void generateReport(List<XmlSuite> xmlSuites, List<ISuite> suites, String outputDirectory) {
       File dir = new File(outputDirectory);
       if (!dir.exists()) {
           dir.mkdirs();
       }
       xmlReporter.setOutputDirectory(outputDirectory);
       xmlReporter.generateReport(xmlSuites, suites, outputDirectory);
   }
}

This works for me. Not sure where the folder gets create with default listeners enbaled though.



Am Montag, 6. Oktober 2014 13:55:56 UTC+1 schrieb Christian Mötzing:
Hi, I attached a simple project. I was trying to disable default listener and re-enable two of the default listener a.k.a. reporter. The documentation mentions a property -reporter (analogous to -listener). For me this flag is not working. Any reporter set here is silently ignored ('mvn -f pom.xml clean test' in test project). I am calling testng through maven-surefire-plugin but that should not change what is documented here, right? <a href="http://testng.org/doc/documentation-main.html" target="_blank" onmousedown="this.href='http://www.google.com/url?q\75http%3A%2F%2Ftestng.org%2Fdoc%2Fdocumentation-main.html\46sa\75D\46sntz\0751\46usg\75AFQjCNFCO6oNdaaQm2UazDt4EC_TxJZSRw';return true;" onclick="this.href='http://www.google.com/url?q\75http%3A%2F%2Ftestng.org%2Fdoc%2Fdocumentation-main.html\46sa\75D\46sntz\0751\46usg\75AFQjCNFCO6oNdaaQm2UazDt4EC_TxJZSRw';return true;">http://testng.org/doc/documentation-main.html (Chapter 4 - Running TestNG).

Second thing is if I set the reporter as listener it gets called but does not work:

java.io.FileNotFoundException: D:\mbc\testng-bug\.\target\surefire-reports\testng-results.xml (The system cannot find the path specified.)
        at java.io.FileOutputStream.open(Native Method)
        at java.io.FileOutputStream.<init>(FileOutputStream.java:205)
        at java.io.FileOutputStream.<init>(FileOutputStream.java:156)
        at java.io.FileWriter.<init>(FileWriter.java:84)
        at org.testng.internal.Utils.writeUtf8File(Utils.java:107)
        at org.testng.reporters.XMLReporter.generateReport(XMLReporter.java:66)
        at org.testng.TestNG.generateReports(TestNG.java:1115)
        at org.testng.TestNG.run(TestNG.java:1074)
        at org.apache.maven.surefire.testng.TestNGExecutor.run(TestNGExecutor.java:115)
        at org.apache.maven.surefire.testng.TestNGDirectoryTestSuite.executeSingleClass(TestNGDirectoryTestSuite.java:128)
        at org.apache.maven.surefire.testng.TestNGDirectoryTestSuite.execute(TestNGDirectoryTestSuite.java:112)
        at org.apache.maven.surefire.testng.TestNGProvider.invoke(TestNGProvider.java:112)
        at org.apache.maven.surefire.booter.ForkedBooter.invokeProviderInSameClassLoader(ForkedBooter.java:200)
        at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:153)
        at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:103)

Execute 'mvn -f pom-2.xml clean test' in test project to reproduce. Same for the SuiteHTMLReporter, it can not find testng.css.

Thx in advance

Christian

--
You received this message because you are subscribed to the Google Groups "testng-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at http://groups.google.com/group/testng-dev.
For more options, visit https://groups.google.com/d/optout.