Quantcast

Sonar is not able to consume SBT unit test output xmls

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Sonar is not able to consume SBT unit test output xmls

Avinash Kumar
Hi guys,

I am using SBT(Simple Build Tool) to compile and unit test and jacoco plugin for code coverage for my sample play/java project. 
I am trying to use sonar runner to consume reports generated by SBT jacoco plugin and SBT test.

Code coverage bit is working fine and giving me stats on sonar dashboard but I do not see unit test outputs reflected in unit test widget.
 
SBT unit test outputs are generated in xml format. One file for each test class. I know SBT is not directly supported but outputs are standard JUnit xmls.  
I am attaching these files in the email. The only issue here is no summary file is gets generated. You don't get a consolidated xml for entire project files.

Here are my settings:

# required metadata
sonar.projectKey=com.xyz.intl:portal.web
sonar.projectName=xyz-intl-portal
sonar.projectVersion=1.0

sonar.dynamicAnalysis=reuseReports 
sonar.core.codeCoveragePlugin=jacoco
sonar.surefire.reportsPath=target/test-reports/
sonar.jacoco.reportPath=target/scala-2.9.1/jacoco/jacoco.exec

sources=app/
tests=test/
binaries=target/scala-2.9.1/classes




Please help me out in this regard.

Thanks,
Avinash


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email

ApplicationTest.xml (7K) Download Attachment
SimpleTest.xml (7K) Download Attachment
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Sonar is not able to consume SBT unit test output xmls

Freddy Mallet
Hi Avinash,

If something must be patched I guess this is the SurefireStaxHandler.java file. Feel free to have a look and we'll be happy to apply any provided patch :


Kind regards,
Freddy

-----
Sonar for Continuous Inspection



On Tue, Jun 19, 2012 at 7:00 PM, Avinash Kumar <[hidden email]> wrote:
Hi guys,

I am using SBT(Simple Build Tool) to compile and unit test and jacoco plugin for code coverage for my sample play/java project. 
I am trying to use sonar runner to consume reports generated by SBT jacoco plugin and SBT test.

Code coverage bit is working fine and giving me stats on sonar dashboard but I do not see unit test outputs reflected in unit test widget.
 
SBT unit test outputs are generated in xml format. One file for each test class. I know SBT is not directly supported but outputs are standard JUnit xmls.  
I am attaching these files in the email. The only issue here is no summary file is gets generated. You don't get a consolidated xml for entire project files.

Here are my settings:

# required metadata
sonar.projectKey=com.xyz.intl:portal.web
sonar.projectName=xyz-intl-portal
sonar.projectVersion=1.0

sonar.dynamicAnalysis=reuseReports 
sonar.core.codeCoveragePlugin=jacoco
sonar.surefire.reportsPath=target/test-reports/
sonar.jacoco.reportPath=target/scala-2.9.1/jacoco/jacoco.exec

sources=app/
tests=test/
binaries=target/scala-2.9.1/classes




Please help me out in this regard.

Thanks,
Avinash


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

   http://xircles.codehaus.org/manage_email


Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Sonar is not able to consume SBT unit test output xmls

Avinash Kumar
Hi Freddy,

Thank you very much for your response. The problem here is not related to SurefireStaxHandler.java. 
This is due  to AbstractSureFireParser.java,  getReports(File dir) function.

Surefire only senses test result xml files which starts with "TEST-", "TESTS-" . SBT does not follow this convention to generate its test output files. SBT test output files are just <ClassName>.xml

I am not sure whats the reason behind this. I can fix this for my application by running a batch script, but it would be great to actually go inside all xml files and look for "testsuite" xml tag from surefire plugin side. Let me know your view on this. If you feel same I will send a patch to you.

Thanks,
Avinash

On Thu, Jun 21, 2012 at 6:15 AM, Freddy Mallet <[hidden email]> wrote:
Hi Avinash,

If something must be patched I guess this is the SurefireStaxHandler.java file. Feel free to have a look and we'll be happy to apply any provided patch :


Kind regards,
Freddy

-----
Sonar for Continuous Inspection



On Tue, Jun 19, 2012 at 7:00 PM, Avinash Kumar <[hidden email]> wrote:
Hi guys,

I am using SBT(Simple Build Tool) to compile and unit test and jacoco plugin for code coverage for my sample play/java project. 
I am trying to use sonar runner to consume reports generated by SBT jacoco plugin and SBT test.

Code coverage bit is working fine and giving me stats on sonar dashboard but I do not see unit test outputs reflected in unit test widget.
 
SBT unit test outputs are generated in xml format. One file for each test class. I know SBT is not directly supported but outputs are standard JUnit xmls.  
I am attaching these files in the email. The only issue here is no summary file is gets generated. You don't get a consolidated xml for entire project files.

Here are my settings:

# required metadata
sonar.projectKey=com.xyz.intl:portal.web
sonar.projectName=xyz-intl-portal
sonar.projectVersion=1.0

sonar.dynamicAnalysis=reuseReports 
sonar.core.codeCoveragePlugin=jacoco
sonar.surefire.reportsPath=target/test-reports/
sonar.jacoco.reportPath=target/scala-2.9.1/jacoco/jacoco.exec

sources=app/
tests=test/
binaries=target/scala-2.9.1/classes




Please help me out in this regard.

Thanks,
Avinash


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

   http://xircles.codehaus.org/manage_email



Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Sonar is not able to consume SBT unit test output xmls

Freddy Mallet
Indeed Avinash, by adding a new branch at the end of this AbstractSureFireParser.getReports(File dir) method looks like we could support SBT framework : 

    File[] unitTestResultFiles = findXMLFilesStartingWith(dir, "TEST-");
    if (unitTestResultFiles.length == 0) {
      // maybe there's only a test suite result file
      unitTestResultFiles = findXMLFilesStartingWith(dir, "TESTS-");
    }
    if (unitTestResultFiles.length == 0) {
      // maybe there's only a test suite result file
      unitTestResultFiles = findXMLFiles(dir);
    }

I don't see any possible side effects but that's my only concern. Feel free to create a JIRA ticket .

Thanks
Freddy
-----
Sonar for Continuous Inspection



On Sun, Jun 24, 2012 at 9:14 AM, Avinash Kumar <[hidden email]> wrote:
Hi Freddy,

Thank you very much for your response. The problem here is not related to SurefireStaxHandler.java. 
This is due  to AbstractSureFireParser.java,  getReports(File dir) function.

Surefire only senses test result xml files which starts with "TEST-", "TESTS-" . SBT does not follow this convention to generate its test output files. SBT test output files are just <ClassName>.xml

I am not sure whats the reason behind this. I can fix this for my application by running a batch script, but it would be great to actually go inside all xml files and look for "testsuite" xml tag from surefire plugin side. Let me know your view on this. If you feel same I will send a patch to you.

Thanks,
Avinash


On Thu, Jun 21, 2012 at 6:15 AM, Freddy Mallet <[hidden email]> wrote:
Hi Avinash,

If something must be patched I guess this is the SurefireStaxHandler.java file. Feel free to have a look and we'll be happy to apply any provided patch :


Kind regards,
Freddy

-----
Sonar for Continuous Inspection



On Tue, Jun 19, 2012 at 7:00 PM, Avinash Kumar <[hidden email]> wrote:
Hi guys,

I am using SBT(Simple Build Tool) to compile and unit test and jacoco plugin for code coverage for my sample play/java project. 
I am trying to use sonar runner to consume reports generated by SBT jacoco plugin and SBT test.

Code coverage bit is working fine and giving me stats on sonar dashboard but I do not see unit test outputs reflected in unit test widget.
 
SBT unit test outputs are generated in xml format. One file for each test class. I know SBT is not directly supported but outputs are standard JUnit xmls.  
I am attaching these files in the email. The only issue here is no summary file is gets generated. You don't get a consolidated xml for entire project files.

Here are my settings:

# required metadata
sonar.projectKey=com.xyz.intl:portal.web
sonar.projectName=xyz-intl-portal
sonar.projectVersion=1.0

sonar.dynamicAnalysis=reuseReports 
sonar.core.codeCoveragePlugin=jacoco
sonar.surefire.reportsPath=target/test-reports/
sonar.jacoco.reportPath=target/scala-2.9.1/jacoco/jacoco.exec

sources=app/
tests=test/
binaries=target/scala-2.9.1/classes




Please help me out in this regard.

Thanks,
Avinash


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

   http://xircles.codehaus.org/manage_email




Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Sonar is not able to consume SBT unit test output xmls

Avinash Kumar
Thanks Freddy.

https://github.com/avinashk/sonar/commit/4dba3fadcf2d1d7a80de3e2f6530b079b2b771d3

My checkin in the branch is the lamest way to fix the issue. I have not submitted any test supporting the change.
Due to time constraints, I should probably create a JIRA ticket.

Thanks,
Avinash

On Sun, Jun 24, 2012 at 10:25 AM, Freddy Mallet <[hidden email]> wrote:
Indeed Avinash, by adding a new branch at the end of this AbstractSureFireParser.getReports(File dir) method looks like we could support SBT framework : 

    File[] unitTestResultFiles = findXMLFilesStartingWith(dir, "TEST-");
    if (unitTestResultFiles.length == 0) {
      // maybe there's only a test suite result file
      unitTestResultFiles = findXMLFilesStartingWith(dir, "TESTS-");
    }
    if (unitTestResultFiles.length == 0) {
      // maybe there's only a test suite result file
      unitTestResultFiles = findXMLFiles(dir);
    }

I don't see any possible side effects but that's my only concern. Feel free to create a JIRA ticket .

Thanks
Freddy
-----
Sonar for Continuous Inspection



On Sun, Jun 24, 2012 at 9:14 AM, Avinash Kumar <[hidden email]> wrote:
Hi Freddy,

Thank you very much for your response. The problem here is not related to SurefireStaxHandler.java. 
This is due  to AbstractSureFireParser.java,  getReports(File dir) function.

Surefire only senses test result xml files which starts with "TEST-", "TESTS-" . SBT does not follow this convention to generate its test output files. SBT test output files are just <ClassName>.xml

I am not sure whats the reason behind this. I can fix this for my application by running a batch script, but it would be great to actually go inside all xml files and look for "testsuite" xml tag from surefire plugin side. Let me know your view on this. If you feel same I will send a patch to you.

Thanks,
Avinash


On Thu, Jun 21, 2012 at 6:15 AM, Freddy Mallet <[hidden email]> wrote:
Hi Avinash,

If something must be patched I guess this is the SurefireStaxHandler.java file. Feel free to have a look and we'll be happy to apply any provided patch :


Kind regards,
Freddy

-----
Sonar for Continuous Inspection



On Tue, Jun 19, 2012 at 7:00 PM, Avinash Kumar <[hidden email]> wrote:
Hi guys,

I am using SBT(Simple Build Tool) to compile and unit test and jacoco plugin for code coverage for my sample play/java project. 
I am trying to use sonar runner to consume reports generated by SBT jacoco plugin and SBT test.

Code coverage bit is working fine and giving me stats on sonar dashboard but I do not see unit test outputs reflected in unit test widget.
 
SBT unit test outputs are generated in xml format. One file for each test class. I know SBT is not directly supported but outputs are standard JUnit xmls.  
I am attaching these files in the email. The only issue here is no summary file is gets generated. You don't get a consolidated xml for entire project files.

Here are my settings:

# required metadata
sonar.projectKey=com.xyz.intl:portal.web
sonar.projectName=xyz-intl-portal
sonar.projectVersion=1.0

sonar.dynamicAnalysis=reuseReports 
sonar.core.codeCoveragePlugin=jacoco
sonar.surefire.reportsPath=target/test-reports/
sonar.jacoco.reportPath=target/scala-2.9.1/jacoco/jacoco.exec

sources=app/
tests=test/
binaries=target/scala-2.9.1/classes




Please help me out in this regard.

Thanks,
Avinash


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

   http://xircles.codehaus.org/manage_email





Loading...