[sonar-dev] csharp: integration test coverage

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

[sonar-dev] csharp: integration test coverage

petr.toman

Hello,

 

I have a question regarding integration test coverage.


We already have unit test coverage set up: we run MSTest+dotCover via TeamCity, and feed the .html results into Sonar (v5) + csharp (3.3) + visual-studio (1.2), which works fine.

 

This is a part of our sonar-project.properties file:

sonar.language=cs

sonar.visualstudio.solution=<project>.sln

sonar.dotnet.visualstudio.solution.file=<project>.sln

sonar.cs.vstest.reportsPaths=TestResults.trx

sonar.visualstudio.enable=true

 

#exclude system generated or code that is inappropriate for analysis

sonar.exclusions=**/ThirdParty/**/*.*

 

# Encoding of the source code

sonar.sourceEncoding=UTF-8

 

# Code Coverage

sonar.cs.dotcover.reportsPaths=dotCover.html

 

Now, we’d like to set up also integration test coverage:

I’ve added this line to the properties file above:

sonar.cs.dotcover.it.reportsPaths=dotCoverIT.html

and I’ve ran the separate suite of integration tests in MSTest, processed with dotCover (which produced the dotCoverIT.html) and fed into Sonar.

However the integration tests coverage report seems to be ignored by SonarRunner.

 

I should also say that our unit tests and integration tests sit withing the same .cs files and modules, and are only distinguished by the test category attribute:

Integration tests have TestCategory("Integration") and unit tests have nothing (!Integration).

Hence we can’t use the sonar.dotnet.visualstudio.itProjectPattern/ sonar.dotnet.visualstudio.testProjectPattern or sonar.dotnet.test.assemblies/ sonar.dotnet.it.assemblies properties.

 

Is there a way to achieve both unit test and integration test coverage in this case?

 

Best regards

Petr

_______________________________________________

This message is for information purposes only, it is not a recommendation, advice, offer or solicitation to buy or sell a product or service nor an official confirmation of any transaction. It is directed at persons who are professionals and is not intended for retail customer use. Intended for recipient only. This message is subject to the terms at: www.barclays.com/emaildisclaimer.

For important disclosures, please see: www.barclays.com/salesandtradingdisclaimer regarding market commentary from Barclays Sales and/or Trading, who are active market participants; and in respect of Barclays Research, including disclosures relating to specific issuers, please see http://publicresearch.barclays.com.

_______________________________________________

Reply | Threaded
Open this post in threaded view
|

Re: [sonar-dev] csharp: integration test coverage

Dinesh Bolkensteyn-2
Hello Petr,

Integration test code coverage is not yet supported: https://jira.codehaus.org/browse/SONARNTEST-5

FYI, the properties sonar.dotnet.visualstudio.itProjectPattern sonar.dotnet.visualstudio.testProjectPattern, sonar.dotnet.test.assemblies and sonar.dotnet.it.assemblies, or in fact all sonar.dotnet.* properties, are deprecated and/or no longer supported. These properties were supported by the 2.x version of the C# plugin.

Kind regards,



On Fri, May 15, 2015 at 10:31 AM, <[hidden email]> wrote:

Hello,

 

I have a question regarding integration test coverage.


We already have unit test coverage set up: we run MSTest+dotCover via TeamCity, and feed the .html results into Sonar (v5) + csharp (3.3) + visual-studio (1.2), which works fine.

 

This is a part of our sonar-project.properties file:

sonar.language=cs

sonar.visualstudio.solution=<project>.sln

sonar.dotnet.visualstudio.solution.file=<project>.sln

sonar.cs.vstest.reportsPaths=TestResults.trx

sonar.visualstudio.enable=true

 

#exclude system generated or code that is inappropriate for analysis

sonar.exclusions=**/ThirdParty/**/*.*

 

# Encoding of the source code

sonar.sourceEncoding=UTF-8

 

# Code Coverage

sonar.cs.dotcover.reportsPaths=dotCover.html

 

Now, we’d like to set up also integration test coverage:

I’ve added this line to the properties file above:

sonar.cs.dotcover.it.reportsPaths=dotCoverIT.html

and I’ve ran the separate suite of integration tests in MSTest, processed with dotCover (which produced the dotCoverIT.html) and fed into Sonar.

However the integration tests coverage report seems to be ignored by SonarRunner.

 

I should also say that our unit tests and integration tests sit withing the same .cs files and modules, and are only distinguished by the test category attribute:

Integration tests have TestCategory("Integration") and unit tests have nothing (!Integration).

Hence we can’t use the sonar.dotnet.visualstudio.itProjectPattern/ sonar.dotnet.visualstudio.testProjectPattern or sonar.dotnet.test.assemblies/ sonar.dotnet.it.assemblies properties.

 

Is there a way to achieve both unit test and integration test coverage in this case?

 

Best regards

Petr

_______________________________________________

This message is for information purposes only, it is not a recommendation, advice, offer or solicitation to buy or sell a product or service nor an official confirmation of any transaction. It is directed at persons who are professionals and is not intended for retail customer use. Intended for recipient only. This message is subject to the terms at: www.barclays.com/emaildisclaimer.

For important disclosures, please see: www.barclays.com/salesandtradingdisclaimer regarding market commentary from Barclays Sales and/or Trading, who are active market participants; and in respect of Barclays Research, including disclosures relating to specific issuers, please see http://publicresearch.barclays.com.

_______________________________________________