Skip to content

Instantly share code, notes, and snippets.

@toddb
Created August 9, 2011 06:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save toddb/1133509 to your computer and use it in GitHub Desktop.
Save toddb/1133509 to your computer and use it in GitHub Desktop.
Test tasks for Gallio in powershell with psake - helps with unit, integration and system tests
<#
Usage for Gallio tests:
Task Test-System -Description "Runs the system tests via Gallio" {
Test-Gallio $proj $configuration $platform $dll "system" "Test.System"
# Test-Gallio ".\src\Test.Unit\Test.Unit.csproj" Release x64 ".\src\Test.Unit\bin\Release\x64\Test.Unit.dll" "unit"
}
}
#>
function Test-Gallio($proj, $configuration, $platform, $dll, $report_name, $namespace_filter){
Add-PSSnapIn Gallio
exec { msbuild $proj "/p:Configuration=$configuration" "/p:Platform=$platform" }
$result = Run-Gallio $dll -filter Namespace:/$namespace_filter/ -ReportTypes text,html -ReportNameFormat $report_name-test-report
$report_dir = resolve-path .
get-content "$report_dir\Reports\$report_name-test-report.txt" | Write-Host
Write-Host $result.ResultsSummary
if ($result.Statistics.FailedCount -gt 0) {
Write-Warning "Some unit tests have failed."
$Error = $result.ResultsSummary
exit $result.ResultCode
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment