Przeglądaj źródła

Add coverage (#622)

* add coverage

* collect code coverage on build

* add runsettings

* Fix runsettings wildcard
Oren Novotny 7 lat temu
rodzic
commit
4a888c7887

+ 5 - 1
.vsts.ix-shared.yml

@@ -2,6 +2,10 @@ parameters:
   signStep: []
     
 steps:
+- task: DotNetCoreInstaller@0
+  inputs:
+    version: '2.1.400-preview-008975'
+
 - task: DotNetCoreCLI@2
   inputs:
     command: build
@@ -23,7 +27,7 @@ steps:
   inputs:
     command: test
     projects: Ix.NET/Source/**/*.Tests.csproj
-    arguments: -c $(BuildConfiguration)
+    arguments: -c $(BuildConfiguration) --collect:"Code Coverage" -s $(System.DefaultWorkingDirectory)/Ix.NET/Source/CodeCoverage.runsettings /p:DebugType=portable 
   displayName: Run Tests
   
 - ${{ parameters.signStep }}

+ 33 - 0
Ix.NET/Source/CodeCoverage.runsettings

@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- File name extension must be .runsettings -->
+<RunSettings>
+  <DataCollectionRunSettings>
+    <DataCollectors>
+      <DataCollector friendlyName="Code Coverage" uri="datacollector://Microsoft/CodeCoverage/2.0" assemblyQualifiedName="Microsoft.VisualStudio.Coverage.DynamicCoverageDataCollector, Microsoft.VisualStudio.TraceCollector, Version=11.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
+        <Configuration>
+          <CodeCoverage>
+
+            <!--  
+About include/exclude lists:  
+Empty "Include" clauses imply all; empty "Exclude" clauses imply none.  
+Each element in the list is a regular expression (ECMAScript syntax). See http://msdn.microsoft.com/library/2k3te2cs.aspx.  
+An item must first match at least one entry in the include list to be included.  
+Included items must then not match any entries in the exclude list to remain included.  
+-->
+
+            <!-- Match assembly file paths: -->
+            <ModulePaths>
+              <Include>
+                <ModulePath>.*System\.Interactive.*\.dll$</ModulePath>
+              </Include>
+              <Exclude>
+                <ModulePath>.*Tests.*</ModulePath>
+              </Exclude>
+            </ModulePaths>
+
+          </CodeCoverage>
+        </Configuration>
+      </DataCollector>
+    </DataCollectors>
+  </DataCollectionRunSettings>
+</RunSettings>

+ 1 - 0
Ix.NET/Source/Ix.NET.sln

@@ -8,6 +8,7 @@ EndProject
 Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{B733D97A-F1ED-4FC3-BF8E-9AC47A89DE96}"
 	ProjectSection(SolutionItems) = preProject
 		build-new.ps1 = build-new.ps1
+		CodeCoverage.runsettings = CodeCoverage.runsettings
 		Directory.build.props = Directory.build.props
 		Directory.build.targets = Directory.build.targets
 		NuGet.Config = NuGet.Config

+ 1 - 1
Ix.NET/Source/System.Interactive.Async.Tests/System.Interactive.Async.Tests.csproj

@@ -18,7 +18,7 @@
   </ItemGroup>
 
   <ItemGroup>
-    <PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.7.2" />
+    <PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.8.0-preview-20180610-02" />
     <PackageReference Include="xunit.runner.visualstudio" Version="2.4.0-beta.2.build4010" />
     <PackageReference Include="FluentAssertions" Version="4.19.2 " />
 

+ 1 - 1
Ix.NET/Source/System.Interactive.Tests/System.Interactive.Tests.csproj

@@ -17,7 +17,7 @@
   </ItemGroup>
 
   <ItemGroup>
-    <PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.7.2" />
+    <PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.8.0-preview-20180610-02" />
     <PackageReference Include="xunit.runner.visualstudio" Version="2.4.0-beta.2.build4010" />
     <PackageReference Include="FluentAssertions" Version="4.19.2 " />