tag:help.appveyor.com,2012-11-13:/discussions/questions/467-nodejs-test-suite-integration-with-xunit-reporterAppVeyor: Discussion 2018-08-25T01:47:18Ztag:help.appveyor.com,2012-11-13:Comment/341202562014-08-13T01:36:35Z2014-08-13T01:36:36Znodejs test suite integration with xunit reporter<div><p>I'm checking the code for mocha reporters and it should be
extremely easy to create a custom reporter for appveyor to show the
test directly in the tests tab.</p>
<p>Example: <a href=
"https://github.com/visionmedia/mocha/blob/master/lib/reporters/xunit.js">
https://github.com/visionmedia/mocha/blob/master/lib/reporters/xuni...</a></p>
<p>What do you think?</p></div>Facundo Cabreratag:help.appveyor.com,2012-11-13:Comment/341202562014-08-13T04:33:30Z2014-08-13T04:33:30Znodejs test suite integration with xunit reporter<div><p>Hi Facundo,</p>
<p>Yeah, I think it's doable. First, we have <a href=
"http://www.appveyor.com/docs/build-worker-api#add-tests">Build
Worker REST API</a> for pushing test results in a real-time. Take a
look how it's made in xUnit: <a href=
"https://github.com/xunit/xunit/blob/master/src/xunit.console/Visitors/AppVeyorVisitor.cs">
https://github.com/xunit/xunit/blob/master/src/xunit.console/Visito...</a><br>
xUnit reporter from Mocha looks very similar!</p>
<p>Second, there is another way to push results in XML format:
<a href=
"http://www.appveyor.com/docs/running-tests#test-results">http://www.appveyor.com/docs/running-tests#test-results</a></p>
<p>Let me know if you have any questions.</p></div>Feodor Fitsnertag:help.appveyor.com,2012-11-13:Comment/341202562014-08-13T04:51:42Z2014-08-13T04:51:51Znodejs test suite integration with xunit reporter<div><p>For now I'm doing the following:</p>
<ol>
<li>Run mocha and generate a json report.<br></li>
<li>I have created an PS script to parse the json report and call
the command <code>Add-AppveyorTest "Test A" -Outcome Passed
-Duration 1000 # in milliseconds</code> with the correct
information per test executed.</li>
</ol>
<p>Should I embed the script into the appveyor.yml? because I
didn't see an example calling a .ps file hooking the
<code>after_test</code> property</p>
<p>Thanks!</p></div>Facundo Cabreratag:help.appveyor.com,2012-11-13:Comment/341202562014-08-13T05:16:00Z2014-08-13T05:16:01Znodejs test suite integration with xunit reporter<div><p>Yay, it works!</p>
<p><a href=
"https://ci.appveyor.com/project/dendril/generator-tamagotchi/build/tests">
https://ci.appveyor.com/project/dendril/generator-tamagotchi/build/...</a></p>
<p>If you have any comments, please let me know :D</p></div>Facundo Cabreratag:help.appveyor.com,2012-11-13:Comment/341202562014-08-13T15:45:39Z2014-08-13T15:45:39Znodejs test suite integration with xunit reporter<div><p>Cool, thanks for the update!</p>
<p>I can only add that if you have more than 100 tests a better way
to push them to a build console could be calling REST API directly
and in batches: <a href=
"http://www.appveyor.com/docs/build-worker-api#add-tests">http://www.appveyor.com/docs/build-worker-api#add-tests</a></p></div>Feodor Fitsner