Found a problem wherein I had the XML for my results in casperJS via XUnit.
1. CasperJS Results can be held within an XML via the switch --xunit
casperjs test chatPairing.js basicChatDropAllEndpoints.js --xunit=log.xml
Now when checked at all places, there seemed no way. There is the build.xml and ant thisng. But it said my xml was invalid as it seemed the junit xsd that ant uses refused to match the xml generated by xunit.
2. So here is the simplest solution I formulated found post much working
a. Get a copy of JUNIT.XSL from the web. OR http://svn.apache.org/repos/asf/directory/studio/trunk/tests/test.integration.core/resources/test-plugins/org.eclipse.test_3.2.0/JUNIT.XSL
b. Add the following
casperjs test chatPairing.js basicChatDropAllEndpoints.js --xunit=log.xml
sed -i 's#UTF-8"?>#UTF-8"?><?xml-stylesheet type="text/xsl" href="JUNIT.XSL"?>#' log.xml
c. Now log.xml is rendered as a transformed xml file containing your results formatted like an html in supported browsers.
~joviano_dias@hotmail.com
This comment has been removed by the author.
ReplyDeleteThanks for this post!
ReplyDeleteI borrowed your idea of using junit.xsl. Instead of using sed though have made a slight modification in the xunit.js module in casperjs. Added the xml stylesheet in return statement of exporter, so that every time you run, results will be html format. Snippet below;
/**
* JUnit XML (xUnit) exporter for test results.
*
*/
function XUnitExporter() {
"use strict";
this.results = undefined;
this._xml = utils.node('testsuites');
this._xml.toString = function toString() {
var serializer = new XMLSerializer();
return '! Style sheet added here !' + serializer.serializeToString(this);
};
}