Skip to content

Commit 930cbbf

Browse files
committed
Export Pester NUnit results and upload to AppVeyor
1 parent 8c47e17 commit 930cbbf

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
lines changed

appveyor.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
os: WMF 5
55

66
# Skip on updates to the readme.
7-
# We can force this by adding [skip ci] or [ci skip] anywhere in commit message
7+
# We can force this by adding [skip ci] or [ci skip] anywhere in commit message
88
skip_commits:
99
message: /updated readme.*|update readme.*s/
1010

@@ -16,4 +16,7 @@ build: false
1616

1717
#Kick off the CI/CD pipeline
1818
test_script:
19-
- ps: . .\build.ps1 -Task Test
19+
- ps: |
20+
. .\build.ps1 -Task Test
21+
(New-Object 'System.Net.WebClient').UploadFile("https://ci.appveyor.com/api/testresults/nunit/$($env:APPVEYOR_JOB_ID)", (Resolve-Path '.\TestsResults-Mod.xml'))
22+
(New-Object 'System.Net.WebClient').UploadFile("https://ci.appveyor.com/api/testresults/nunit/$($env:APPVEYOR_JOB_ID)", (Resolve-Path '.\TestsResults-Meta.xml'))

psake.ps1

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,14 +33,15 @@ task Analyze -Depends Init {
3333
}
3434
}
3535

36-
task Pester-Meta -Depends Init {
36+
task Pester-Meta -Depends Init {
3737
if(-not $ENV:BHProjectPath) {
3838
Set-BuildEnvironment -Path $PSScriptRoot\..
3939
}
4040
Remove-Module $ENV:BHProjectName -ErrorAction SilentlyContinue
4141
Import-Module (Join-Path $ENV:BHProjectPath $ENV:BHProjectName) -Force
4242

43-
$testResults = Invoke-Pester -Path $metaTests -PassThru
43+
$testResultsFile = "$projectRoot\TestResults-Meta.xml"
44+
$testResults = Invoke-Pester -Path $metaTests -PassThru -OutputFormat NUnitXml -OutputFile $testResultsFile
4445
if ($testResults.FailedCount -gt 0) {
4546
$testResults | Format-List
4647
Write-Error -Message 'One or more Pester tests failed. Build cannot continue!'
@@ -54,7 +55,8 @@ task Pester-Module -depends Init {
5455
Remove-Module $ENV:BHProjectName -ErrorAction SilentlyContinue
5556
Import-Module (Join-Path $ENV:BHProjectPath $ENV:BHProjectName) -Force
5657

57-
$testResults = Invoke-Pester -Path $unitTests -PassThru
58+
$testResultsFile = "$projectRoot\TestResults-Module.xml"
59+
$testResults = Invoke-Pester -Path $unitTests -PassThru -OutputFormat NUnitXml -OutputFile $testResultsFile
5860
if ($testResults.FailedCount -gt 0) {
5961
$testResults | Format-List
6062
Write-Error -Message 'One or more Pester tests failed. Build cannot continue!'

0 commit comments

Comments
 (0)