Test script fails and doesn't move forward with upload
From the docs, it says I can upload a script (http://www.appveyor.com/docs/running-tests) with test results.
However, when running a script, if the tests fail, the whole thing stops and nothing is uploaded:
https://ci.appveyor.com/project/ferventcoder/chocolatey/build/1.0.17
Note that the script (set to powershell) contains:
$chocoDir = $env:ChocolateyInstall
if(!$chocoDir){$chocoDir="$env:SystemDrive\chocolatey"}
$pesterDir = (dir $chocoDir\lib\Pester*)
if($pesterDir.length -gt 0) {$pesterDir = $pesterDir[-1]}
Write-Host "Pester is located at $pesterDir"
$args="."
Import-Module "$pesterDir\tools\Pester.psm1";
Invoke-Pester -OutputXml Test.xml -EnableExit $args
$testsPassed = $?
# http://stackoverflow.com/questions/10666035/powershell-difference-between-and-lastexitcode
# upload results to AppVeyor
$wc = New-Object 'System.Net.WebClient'
$wc.UploadFile("https://ci.appveyor.com/api/testresults/nunit/$($env:APPVEYOR_JOB_ID)", (Resolve-Path .\test.xml))
if (! $testsPassed) {
exit 1;
}
Comments are currently closed for this discussion. You can start a new one.
Keyboard shortcuts
Generic
? | Show this help |
---|---|
ESC | Blurs the current field |
Comment Form
r | Focus the comment reply box |
---|---|
^ + ↩ | Submit the comment |
You can use Command ⌘
instead of Control ^
on Mac
1 Posted by ferventcoder on 03 Sep, 2014 04:43 PM
I think this might have to do with setting -EnableExit http://help.appveyor.com/discussions/problems/558-setting-exit-code...
That way the script can move forward.
Support Staff 2 Posted by Feodor Fitsner on 03 Sep, 2014 06:01 PM
Well, yeah, but in general I could see the issue with other applications. I think more general and nicer solution to the problem will be adding "On build complete script" section.
Will add that into today's update.
Support Staff 3 Posted by Feodor Fitsner on 04 Sep, 2014 04:01 AM
Update deployed. There is a new "On build finish script" block that runs before finishing build whether it's successful of failed.
In
appveyor.yml
it's:4 Posted by ferventcoder on 04 Sep, 2014 12:19 PM
I'm guessing this is not available in the UI yet.
5 Posted by ferventcoder on 04 Sep, 2014 12:20 PM
Also, it would be wicked if I could finish setting up everything in the UI and then export my settings as an appveyor.yml file. I'll start a new discussion on that.
6 Posted by ferventcoder on 04 Sep, 2014 12:27 PM
I see the on build finish in the UI, just want to verify that it happens AFTER the test scripts have run? In the UI it's a bit confusing as it looks like it happens earlier in the pipeline (during the compile phase).
7 Posted by ferventcoder on 04 Sep, 2014 12:42 PM
It went in the correct order, so awesome!
ferventcoder closed this discussion on 04 Sep, 2014 12:42 PM.