aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author杨宇千 <crupest@outlook.com>2019-08-05 00:40:05 +0800
committer杨宇千 <crupest@outlook.com>2019-08-05 00:40:05 +0800
commit86e9d577c22c55892f848130b6a448eb5ab31ece (patch)
treecfb6bf0f94d115244d800edaa7d841b11fd1f6b7
parentb1fa31027706f7c0e31970089e8145dc70d48e6d (diff)
downloadtimeline-86e9d577c22c55892f848130b6a448eb5ab31ece.tar.gz
timeline-86e9d577c22c55892f848130b6a448eb5ab31ece.tar.bz2
timeline-86e9d577c22c55892f848130b6a448eb5ab31ece.zip
Add code coverage.
-rw-r--r--CI/build-pipeline.yml8
-rw-r--r--Timeline.Tests/Timeline.Tests.csproj4
2 files changed, 11 insertions, 1 deletions
diff --git a/CI/build-pipeline.yml b/CI/build-pipeline.yml
index c515f181..64a851f0 100644
--- a/CI/build-pipeline.yml
+++ b/CI/build-pipeline.yml
@@ -14,7 +14,7 @@ steps:
dotnet restore Timeline.Tests/Timeline.Tests.csproj --configfile nuget.config
displayName: Dotnet Restore
-- script: dotnet test Timeline.Tests/Timeline.Tests.csproj --configuration $(buildConfiguration) --no-restore --logger trx
+- script: dotnet test Timeline.Tests/Timeline.Tests.csproj --configuration $(buildConfiguration) --no-restore --logger trx --collect:"XPlat Code Coverage"
displayName: Dotnet Test
- task: PublishTestResults@2
@@ -22,3 +22,9 @@ steps:
inputs:
testRunner: VSTest
testResultsFiles: '**/*.trx'
+
+- task: PublishCodeCoverageResults@1
+ condition: succeededOrFailed()
+ inputs:
+ codeCoverageTool: 'Cobertura'
+ summaryFileLocation: '**/coverage.cobertura.xml'
diff --git a/Timeline.Tests/Timeline.Tests.csproj b/Timeline.Tests/Timeline.Tests.csproj
index 1a5f2850..854c63ac 100644
--- a/Timeline.Tests/Timeline.Tests.csproj
+++ b/Timeline.Tests/Timeline.Tests.csproj
@@ -5,6 +5,10 @@
</PropertyGroup>
<ItemGroup>
+ <PackageReference Include="coverlet.collector" Version="1.0.1">
+ <PrivateAssets>all</PrivateAssets>
+ <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
+ </PackageReference>
<PackageReference Include="Microsoft.AspNetCore.App" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.Testing" Version="2.2.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="2.2.6" />