While experimenting with AppVeyor to add Continuous Integration to my PowerShell projects (more detailed blog post to follow) I encountered a bug that meant that the Pester test results (uploaded via the NUnit formatted results file) were not appearing in the "Tests" tab of my AppVeyor project.
-- Update: The issue has now been closed by the AppVeyor dev team and I've confirmed that the workaround described below is no longer necessary.
In brief, doing this in isolation doesn't currently work for results generated by the latest version of Pester:
$wc = New-Object 'System.Net.WebClient' $wc.UploadFile("https://ci.appveyor.com/api/testresults/nunit/$($env:APPVEYOR_JOB_ID)", (Resolve-Path .\YourResultsFile.xml))
No error is generated, the Tests tab in AppVeyor just says "The build job has not produced any test results.", although you can still see your results in the Console.
This appears to be due to a change in Pester (3.4.6 was recently released) and a case sensitivity issue which requires a change on AppVeyor's side to fix as discussed here:
In the meantime, you can workaround the issue by doing the following after Pester has run but before you upload the result file/s:
[xml]$content = Get-Content "C:\projects\YourProject\YourResultsFile.xml" $content.'test-results'.'test-suite'.type = "Powershell" $content.Save("C:\projects\YourProject\YourResultsFile.xml")
Watch this issue in Github to know when you can remove that workaround:
It's also worth noting that this issue doesn't break your builds, so if you can live without results in the Tests tab in the meantime you can just wait for it to be fixed.
A side note about AppVeyor support
--TL;DR - It's excellent.
I spent quite a while yesterday evening struggling with this issue as I assumed (because I was very new to AppVeyor) that something was wrong in my appveyor.yml file or due to some other eccentricity of my code/project. Shortly after midnight I gave up trying, sent an email to the AppVeyor support team for help and went to bed.
This morning I saw that Ilya Finkelshteyn from AppVeyor had replied (within about an hour of me sending my email) with the information above. Further, he had forked my code in Github to confirm the workaround worked. I sent a reply this morning with some follow up questions and got another almost instantaneous response.
Considering I am a casual (and brand new) user on the free plan I was grateful to be entitled to support at all, but this really impressed me for both speed and thoroughness. As a first impression, it was a great one. :)