From 2bbef362a51c2fcade88179d4636d1426ba046c1 Mon Sep 17 00:00:00 2001 From: Andrea Spadaccini Date: Fri, 2 Aug 2019 16:31:33 +0100 Subject: [PATCH] Azure Pipelines: upload test results Fixes #9. --- .gitignore | 5 ++++- azure-pipelines.yml | 12 +++++++++++- tools/run-tests.ps1 | 2 +- 3 files changed, 16 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index c807ad8..77e04a9 100644 --- a/.gitignore +++ b/.gitignore @@ -330,4 +330,7 @@ ASALocalRun/ .mfractor/ # External deps -External/ \ No newline at end of file +External/ + +# Test results +test/results.xml \ No newline at end of file diff --git a/azure-pipelines.yml b/azure-pipelines.yml index e044feb..723907c 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -34,6 +34,11 @@ jobs: inputs: filePath: 'tools/run-tests.ps1' pwsh: true + + - task: PublishTestResults@2 + inputs: + testResultsFormat: "NUnit" + testResultsFiles: "test/results.xml" - job: WindowsPowershell pool: @@ -49,8 +54,13 @@ jobs: inputs: filePath: 'tools/run-tests.ps1' + - task: PublishTestResults@2 + inputs: + testResultsFormat: "NUnit" + testResultsFiles: "test/results.xml" + - task: PowerShell@2 displayName: TestManifest inputs: targetType: inline - script: 'Test-ModuleManifest -Path ./FeatureFlags.psd1' + script: 'Test-ModuleManifest -Path ./FeatureFlags.psd1' \ No newline at end of file diff --git a/tools/run-tests.ps1 b/tools/run-tests.ps1 index 3b6532d..8d5121b 100644 --- a/tools/run-tests.ps1 +++ b/tools/run-tests.ps1 @@ -7,7 +7,7 @@ if ($pester.Count -eq 0) { Write-Host "Cannot find the Pester module. Installing it." Install-Module Pester -Force -Scope CurrentUser } -$FailedTests = Invoke-Pester $testDir -EnableExit +$FailedTests = Invoke-Pester $testDir -EnableExit -OutputFile "test/results.xml" -OutputFormat "NUnitXML" -CodeCoverage "$parentDir/FeatureFlags.psm1" if ($FailedTests -gt 0) { Write-Error "Error: $FailedTests Pester tests failed." exit $FailedTests