Test script fails and doesn't move forward with upload

ferventcoder's Avatar


03 Sep, 2014 03:15 PM

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:


Note that the script (set to powershell) contains:

$chocoDir = $env:ChocolateyInstall
$pesterDir = (dir $chocoDir\lib\Pester*)
if($pesterDir.length -gt 0) {$pesterDir = $pesterDir[-1]}

Write-Host "Pester is located at $pesterDir"

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;
  1. 1 Posted by ferventcoder on 03 Sep, 2014 04:43 PM

    ferventcoder's Avatar

    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.

  2. Support Staff 2 Posted by Feodor Fitsner on 03 Sep, 2014 06:01 PM

    Feodor Fitsner's Avatar

    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.

  3. Support Staff 3 Posted by Feodor Fitsner on 04 Sep, 2014 04:01 AM

    Feodor Fitsner's Avatar

    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:

      - my script
  4. 4 Posted by ferventcoder on 04 Sep, 2014 12:19 PM

    ferventcoder's Avatar

    I'm guessing this is not available in the UI yet.

  5. 5 Posted by ferventcoder on 04 Sep, 2014 12:20 PM

    ferventcoder's Avatar

    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. 6 Posted by ferventcoder on 04 Sep, 2014 12:27 PM

    ferventcoder's Avatar

    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. 7 Posted by ferventcoder on 04 Sep, 2014 12:42 PM

    ferventcoder's Avatar

    It went in the correct order, so awesome!

  8. ferventcoder closed this discussion on 04 Sep, 2014 12:42 PM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts


? 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