File tree Expand file tree Collapse file tree
Microsoft.OpenApi.Hidi.Tests
Microsoft.OpenApi.Readers.Tests Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -100,12 +100,24 @@ extends:
100100 arguments : ' --configuration $(BuildConfiguration) --no-incremental'
101101
102102 # Run the Unit test
103- - task : DotNetCoreCLI@2
103+ - pwsh : |
104+ dotnet test "$(Build.SourcesDirectory)\Microsoft.OpenApi.slnx" `
105+ --configuration $(BuildConfiguration) `
106+ --no-build `
107+ -- `
108+ --report-xunit-trx `
109+ --results-directory "$(Agent.TempDirectory)\TestResults" `
110+ --minimum-expected-tests 1
104111 displayName: 'test'
112+
113+ - task : PublishTestResults@2
114+ displayName : ' Publish test results'
115+ condition : succeededOrFailed()
105116 inputs :
106- command : test
107- projects : ' $(Build.SourcesDirectory)\Microsoft.OpenApi.slnx'
108- arguments : ' --configuration $(BuildConfiguration) --no-build'
117+ testResultsFormat : VSTest
118+ testResultsFiles : ' $(Agent.TempDirectory)\TestResults\*.trx'
119+ failTaskOnMissingResultsFile : true
120+ failTaskOnFailedTests : true
109121
110122 - task : EsrpCodeSigning@6
111123 displayName : ' ESRP CodeSigning binaries'
Original file line number Diff line number Diff line change 4545 id : run_unit_tests
4646 shell : pwsh
4747 run : |
48- dotnet test Microsoft.OpenApi.slnx -c Release --no-build - v n --collect:"XPlat Code Coverage"
48+ dotnet test --solution Microsoft.OpenApi.slnx -c Release -v n --coverlet --coverlet-output-format cobertura
4949
5050 - name : Install report generator
5151 shell : pwsh
5555 - name : Generate coverage report
5656 shell : pwsh
5757 run : |
58- reportgenerator -reports:**/coverage.cobertura.xml -targetdir:./reports/coverage -reporttypes:"Html;MarkdownSummaryGithub;Cobertura"
58+ reportgenerator -reports:**/coverage.cobertura* .xml -targetdir:./reports/coverage -reporttypes:"Html;MarkdownSummaryGithub;Cobertura"
5959
6060 - name : Add coverage to job summary
6161 shell : bash
Original file line number Diff line number Diff line change @@ -61,12 +61,10 @@ jobs:
6161 - name : Build and analyze
6262 env :
6363 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
64- CollectCoverage : true
65- CoverletOutputFormat : ' opencover' # https://github.com/microsoft/vstest/issues/4014#issuecomment-1307913682
6664 shell : pwsh
6765 run : |
68- dotnet tool run dotnet-sonarscanner begin /k:"microsoft_OpenAPI.NET" /o:"microsoft" /d:sonar.token="${{ secrets.SONAR_TOKEN }}" /d:sonar.host.url="https://sonarcloud.io" /d:sonar.cs.opencover.reportsPaths="test/ **/coverage.opencover.xml"
66+ dotnet tool run dotnet-sonarscanner begin /k:"microsoft_OpenAPI.NET" /o:"microsoft" /d:sonar.token="${{ secrets.SONAR_TOKEN }}" /d:sonar.host.url="https://sonarcloud.io" /d:sonar.cs.opencover.reportsPaths="**/coverage.opencover* .xml"
6967 dotnet workload restore
7068 dotnet build
71- dotnet test Microsoft.OpenApi.slnx --no-build -- verbosity normal /p:CollectCoverage=true /p:CoverletOutputFormat= opencover
69+ dotnet test --solution Microsoft.OpenApi.slnx --verbosity normal --coverlet --coverlet-output-format opencover
7270 dotnet tool run dotnet-sonarscanner end /d:sonar.token="${{ secrets.SONAR_TOKEN }}"
Original file line number Diff line number Diff line change 11{
22 "sdk" : {
33 "version" : " 10.0.400"
4+ },
5+ "test" : {
6+ "runner" : " Microsoft.Testing.Platform"
47 }
58}
Original file line number Diff line number Diff line change 1010 <NoWarn >CA2007</NoWarn >
1111 <SignAssembly >true</SignAssembly >
1212 <AssemblyOriginatorKeyFile >..\..\src\Microsoft.OpenApi.snk</AssemblyOriginatorKeyFile >
13+ <UseMicrosoftTestingPlatformRunner >true</UseMicrosoftTestingPlatformRunner >
1314 </PropertyGroup >
1415
1516 <ItemGroup >
16- <PackageReference Include =" coverlet.msbuild " Version =" 10.0.1" PrivateAssets =" all" />
17+ <PackageReference Include =" coverlet.MTP " Version =" 10.0.1" PrivateAssets =" all" />
1718 <PackageReference Include =" Microsoft.NET.Test.Sdk" Version =" 18.9.0" />
1819 <PackageReference Include =" Moq" Version =" 4.20.72" />
19- <PackageReference Include =" xunit.v3" Version =" 3.2.2" />
20- <PackageReference Include =" xunit.runner.visualstudio" Version =" 3.1.5" PrivateAssets =" all" />
21- <PackageReference Include =" coverlet.collector" Version =" 10.0.1" PrivateAssets =" all" />
20+ <PackageReference Include =" xunit.v3" Version =" 4.0.0" />
2221 </ItemGroup >
2322
2423 <ItemGroup >
Original file line number Diff line number Diff line change 44 <GeneratePackageOnBuild >false</GeneratePackageOnBuild >
55 <SignAssembly >true</SignAssembly >
66 <AssemblyOriginatorKeyFile >..\..\src\Microsoft.OpenApi.snk</AssemblyOriginatorKeyFile >
7+ <UseMicrosoftTestingPlatformRunner >true</UseMicrosoftTestingPlatformRunner >
78 </PropertyGroup >
89 <ItemGroup >
910 <EmbeddedResource Include =" **\*.yaml" Exclude =" **\bin\**;**\obj\**" >
1516 </ItemGroup >
1617
1718 <ItemGroup >
18- <PackageReference Include =" coverlet.collector" Version =" 10.0.1" PrivateAssets =" all" />
19- <PackageReference Include =" coverlet.msbuild" Version =" 10.0.1" PrivateAssets =" all" />
19+ <PackageReference Include =" coverlet.MTP" Version =" 10.0.1" PrivateAssets =" all" />
2020 <PackageReference Include =" Microsoft.NET.Test.Sdk" Version =" 18.9.0" />
2121 <PackageReference Include =" FluentAssertions" Version =" 7.2.2" />
22- <PackageReference Include =" xunit.v3" Version =" 3.2.2" />
23- <PackageReference Include =" xunit.runner.visualstudio" Version =" 3.1.5" PrivateAssets =" all" />
22+ <PackageReference Include =" xunit.v3" Version =" 4.0.0" />
2423 </ItemGroup >
2524
2625 <ItemGroup >
Original file line number Diff line number Diff line change 55 <SignAssembly >true</SignAssembly >
66 <OutputType >Library</OutputType >
77 <AssemblyOriginatorKeyFile >..\..\src\Microsoft.OpenApi.snk</AssemblyOriginatorKeyFile >
8+ <UseMicrosoftTestingPlatformRunner >true</UseMicrosoftTestingPlatformRunner >
89 </PropertyGroup >
910
1011 <ItemGroup >
11- <PackageReference Include =" coverlet.collector" Version =" 10.0.1" PrivateAssets =" all" />
12- <PackageReference Include =" coverlet.msbuild" Version =" 10.0.1" PrivateAssets =" all" />
12+ <PackageReference Include =" coverlet.MTP" Version =" 10.0.1" PrivateAssets =" all" />
1313 <PackageReference Include =" FluentAssertions" Version =" 7.2.2" />
1414 <PackageReference Include =" Microsoft.NET.Test.Sdk" Version =" 18.9.0" />
1515 <PackageReference Include =" Moq" Version =" 4.20.72" />
1616 <PackageReference Include =" Verify.XunitV3" Version =" 31.28.0" />
17- <PackageReference Include =" xunit.v3" Version =" 3.2.2" />
18- <PackageReference Include =" xunit.runner.visualstudio" Version =" 3.1.5" PrivateAssets =" all" />
17+ <PackageReference Include =" xunit.v3" Version =" 4.0.0" />
1918 </ItemGroup >
2019
2120 <ItemGroup >
You can’t perform that action at this time.
0 commit comments