-
Notifications
You must be signed in to change notification settings - Fork 280
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #211 from giggio/OpenCover
Add code coverage
- Loading branch information
Showing
7 changed files
with
66 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,8 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<packages> | ||
<package id="coveralls.io" version="1.1.73-beta" /> | ||
<package id="NuGet.CommandLine" version="2.8.2" /> | ||
<package id="OpenCover" version="4.5.3607-rc27" /> | ||
<package id="ReportGenerator" version="2.0.4.0" /> | ||
<package id="xunit.runners" version="2.0.0-beta5-build2785" /> | ||
</packages> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
$rootDir = [System.IO.Path]::GetFullPath("$PSScriptRoot\..\..") | ||
$packagesDir = "$rootDir\packages" | ||
$openCoverExe = "$packagesDir\OpenCover.4.5.3607-rc27\OpenCover.Console.exe" | ||
$xunitConsoleExe = "$packagesDir\xunit.runners.2.0.0-beta5-build2785\tools\xunit.console.x86.exe" | ||
$testDll = "CodeCracker.Test.CSharp.dll" | ||
$testDir = "$PSScriptRoot\CodeCracker.Test\bin\Debug" | ||
$logDir = "$rootDir\log" | ||
$outputXml = "$logDir\CodeCoverageResults.xml" | ||
$reportGeneratorExe = "$packagesDir\ReportGenerator.2.0.4.0\ReportGenerator.exe" | ||
$coverageReportDir = "$logDir\codecoverage\" | ||
$converallsNetExe = "$packagesDir\coveralls.io.1.1.73-beta\tools\coveralls.net.exe" | ||
|
||
$allPaths = $openCoverExe, $xunitConsoleExe, $testDir, $logDir, $reportGeneratorExe | ||
|
||
function testPath($paths) { | ||
$notFound = @() | ||
foreach($path in $paths) { | ||
if ((Test-Path $path) -eq $false) | ||
{ | ||
$notFound += $path | ||
} | ||
} | ||
$notFound | ||
} | ||
|
||
if ((Test-Path $logDir) -eq $false) | ||
{ | ||
Write-Host -ForegroundColor DarkBlue "Creating log directory $logDir" | ||
mkdir $logDir | Out-Null | ||
} | ||
|
||
$notFoundPaths = testPath $allPaths | ||
if ($notFoundPaths.length -ne 0) { | ||
Write-Host -ForegroundColor DarkRed "Paths not found: " | ||
foreach($path in $notFoundPaths) { | ||
Write-Host -ForegroundColor DarkRed " $path" | ||
} | ||
return | ||
} | ||
|
||
Write-Host -ForegroundColor DarkBlue "Running Code Coverage" | ||
. $openCoverExe -register:user "-target:$xunitConsoleExe" "-targetargs:$testDll -noshadow" "-filter:+[CodeCracker*]* -[CodeCracker.Test*]*" "-output:$outputXml" -coverbytest:*.Test.*.dll "-targetdir:$testDir" -log:All | ||
Write-Host -ForegroundColor DarkBlue "Exporting code coverage report" | ||
. $reportGeneratorExe -verbosity:Info -reports:$outputXml -targetdir:$coverageReportDir | ||
if ($env:COVERALLS_REPO_TOKEN -ne $null) { | ||
Write-Host -ForegroundColor DarkBlue "Uploading coverage report to Coveralls.io" | ||
. $converallsNetExe --opencover $outputXml | ||
} |