Hi,
I am using SonarClound in AzureDevops to run on our c# projects. We have some integration tests we want to exclude from our code coverage. We only want to use the unit test for code coverage. Integration tests and unit test are separated into ther own folders.
We have tried to set the test folder and then exclude this from source by using the following two parameters:
sonar.tests=Source/NetTransferCapacityService.FunctionApp.Tests/Unit/
sonar.exclusions=/NetTransferCapacityService.FunctionApp.Tests/Unit//*
But we keep getting the error below. Any way to solve this or is there a smarter way to exclude tests from code coverage?
> INFO: Test paths: Source/NetTransferCapacityService.FunctionApp.Tests/Unit
>
> INFO: Excluded sources: **/build-wrapper-dump.json, **/NetTransferCapacityService.FunctionApp.Tests/Unit/**/*
>
> INFO: Excluded sources for coverage: **/NetTransferCapacityService.FunctionApp/Startup.cs, **/NetTransferCapacityService.FunctionApp.Persistence/DbContext/Migrations/*, **/NetTransferCapacityService.FunctionApp/Infrastructure/Http/*
>
> INFO: Excluded sources for duplication: **/NetTransferCapacityService.FunctionApp.Persistence/DbContext/Migrations/*
>
> INFO: ------------------------------------------------------------------------
>
> INFO: EXECUTION FAILURE
>
> INFO: ------------------------------------------------------------------------
>
> INFO: Total time: 22.704s
>
> INFO: Final Memory: 21M/74M
>
> INFO: ------------------------------------------------------------------------
>
> ##[error]ERROR: Error during SonarScanner execution
>
> ERROR: Error during SonarScanner execution
>
> ##[error]ERROR: File Source/NetTransferCapacityService.FunctionApp.Tests/Unit/Application/Extensions/DateOnlyExtensionsTests.cs can't be indexed twice. Please check that inclusion/exclusion patterns produce disjoint sets for main and test files
>
> ERROR:
>
> ERROR: File Source/NetTransferCapacityService.FunctionApp.Tests/Unit/Application/Extensions/DateOnlyExtensionsTests.cs can't be indexed twice. Please check that inclusion/exclusion patterns produce disjoint sets for main and test files
>
> ERROR:
>
> ##[error]The SonarScanner did not complete successfully