Cannot upload JUnit XML test results

adam.retter's Avatar


13 May, 2018 12:20 PM

I am following the documentation to try and and upload results from our JUnit tests to the dashboard. I have modified the PowerShell a little, as JUnit produces multiple XML files, my appveyor.xml is here:

I have tried the PowerShell in Windows 10's PowerShell ISE, and once I define equivalent environment variables for APPVEYOR_BUILD_FOLDER and APPVEYOR_JOB_ID, it seems to execute just fine. However, when it is run on AppVeyor I get the following errors:

At line:1 char:56
+ $wc = New-Object 'System.Net.WebClient' foreach ($file in Get-ChildIt ...
+                                                        ~~
Unexpected token 'in' in expression or statement.
At line:1 char:55
+ $wc = New-Object 'System.Net.WebClient' foreach ($file in Get-ChildIt ...
+                                                       ~
Missing closing ')' in expression.
At line:1 char:141
+ ... ath "$($env:APPVEYOR_BUILD_FOLDER)\test\junit\data" -Filter *.xml) {
+                                                                       ~
Unexpected token ')' in expression or statement.

The AppVeyor output with errors can be seen here:

What am I doing wrong in AppVeyor vs. PowerShell ISE?

  1. Support Staff 1 Posted by Ilya Finkelshte... on 14 May, 2018 10:44 PM

    Ilya Finkelshteyn's Avatar

    Please check documentation here. It states: "spaces between lines created by Export YAML menu are mandatory"

    So - ps: >- notation requires new line after each line. If you are not sure in syntax, please copy-paste your script in UI and then press Export YAML to see the correct one.

    Or, if you do not like those new lines (I would not), use - ps: | syntax as described in the same part of documentation.

  2. 2 Posted by adam.retter on 16 May, 2018 07:10 AM

    adam.retter's Avatar

    Unfortunately the "Export YAML" feature would not provide me with a format that used ">-" instead, it converted it to one long string with embedded "\n" characters. Which is quite the opposite to what I wanted.

    I have now switched to using "|", and that works well.

    Thanks for your help :-)

  3. adam.retter closed this discussion on 16 May, 2018 07:10 AM.

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