xml test results not read by AppVeyor

Mkkulagowski's Avatar

Mkkulagowski

14 May, 2015 05:34 PM

I managed to build our project on AppVeyor. We use gtest to test our code with '--gtest_output=xml' argument, so xml output is created (Sample output xml attached).

I use this PS script:

$testpath = ".\Bin\x64\Debug\nfCommonTest.exe"
if(Test-Path $testpath)
{
$testpath
}
Start-Process $testpath --gtest_output=xml -wait
$wc = New-Object 'System.Net.WebClient'
if (Test-Path ".\test_detail.xml")
{
$tpath = ".\test_detail.xml"
$tpath
}
$wc.UploadFile("https://ci.appveyor.com/api/testresults/xunit/$($env:APPVEYOR_JOB_ID)", (Resolve-Path test_detail.xml))

to:
1. check if test exist, if so - print the path i checked
2. run this test with proper arg
3. check if xml output exists
4. upload it using script from Your Docs.

After script is printed, I get:

.\Bin\x64\Debug\nfCommonTest.exe
.\test_detail.xml
Packaging artifacts...OK
Build success
So that means both files were found...yet when I go to Tests tab theres nothing there.
Why is that?
  1. Support Staff 1 Posted by Feodor Fitsner on 14 May, 2015 05:47 PM

    Feodor Fitsner's Avatar

    Well, attached XML doesn't look like a valid xunit test results.

    Example xunit XML test results:

    <assembly name="C:\Projects\GitHub\appvyr-xunit-tests\xUnit_x86_Clr4\bin\Debug\xUnit_x86_Clr4.dll" run-date="2014-11-28" run-time="14:11:45" configFile="C:\Tools\xUnit\xunit.console.clr4.x86.exe.Config" time="0.130" total="1" passed="0" failed="1" skipped="0" environment="32-bit .NET 4.0.30319.34014" test-framework="xUnit.net 1.9.2.1705">
      <class time="0.130" name="xUnit_x86_Clr4.xUnit_x86_CLR4_Tests" total="1" passed="0" failed="1" skipped="0">
        <test name="xUnit_x86_Clr4.xUnit_x86_CLR4_Tests.TestA" type="xUnit_x86_Clr4.xUnit_x86_CLR4_Tests" method="TestA" result="Fail" time="0.130">
          <failure exception-type="Xunit.Sdk.EqualException">
            <message>
              Assert.Equal() Failure
              Expected: 1
              Actual:   2
            </message>
            <stack-trace>   at xUnit_x86_Clr4.xUnit_x86_CLR4_Tests.TestA() in c:\Projects\GitHub\appvyr-xunit-tests\xUnit_x86_Clr4\xUnit_AnyCPU_CLR2_Tests.cs:line 15</stack-trace>
          </failure>
        </test>
      </class>
    </assembly>
    
  2. Support Staff 2 Posted by Feodor Fitsner on 14 May, 2015 05:49 PM

    Feodor Fitsner's Avatar

    Using PowerShell you can easily iterate over test results in XML and then push them using Build Worker API: http://www.appveyor.com/docs/build-worker-api#add-tests

  3. 3 Posted by Mkkulagowski on 14 May, 2015 06:54 PM

    Mkkulagowski's Avatar

    Well...we already have script in python doing so...yet I'd need to put some extra code using Build Worker API to send outputs to appveyor instead of console ;)

    Too bad, but it's not hard to do so nvm.

    Thanks for answers.

  4. Ilya Finkelshteyn closed this discussion on 25 Aug, 2018 01:56 AM.

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

Recent Discussions

20 Mar, 2019 10:44 PM
20 Mar, 2019 09:03 PM
20 Mar, 2019 08:55 PM
20 Mar, 2019 08:48 PM
20 Mar, 2019 08:02 PM