I just used qunit-reporter-junit to generate the following XML:
<?xml version="1.0" encoding="UTF-8"?>
<testsuites name="http://w188823.example.com:9001/test/workflow.cloning?out=xml" hostname="localhost" tests="19" failures="2" errors="0" time="0.357" timestamp="2013-07-16T19:52:00Z">
<testsuite id="0" name="workflow.cloning.test" hostname="localhost" tests="4" failures="0" errors="0" time="0.002" timestamp="2013-07-16T19:52:00Z">
<testcase name="has schedule departure date predicate" tests="4" failures="0" errors="0" time="0.002" timestamp="2013-07-16T19:52:00Z">
</testcase>
</testsuite>
<testsuite id="1" name="workflow.cloning.test" hostname="localhost" tests="8" failures="0" errors="0" time="0.001" timestamp="2013-07-16T19:52:00Z">
<testcase name="has effective date predicate" tests="4" failures="0" errors="0" time="0.001" timestamp="2013-07-16T19:52:00Z">
</testcase>
</testsuite>
<testsuite id="2" name="workflow.cloning.test" hostname="localhost" tests="12" failures="0" errors="0" time="0.001" timestamp="2013-07-16T19:52:00Z">
<testcase name="has origin and destination predicate" tests="4" failures="0" errors="0" time="0.001" timestamp="2013-07-16T19:52:00Z">
</testcase>
</testsuite>
<testsuite id="3" name="workflow.cloning.test" hostname="localhost" tests="13" failures="1" errors="0" time="0" timestamp="2013-07-16T19:52:00Z">
<testcase name="has AFE detour number predicate" tests="1" failures="1" errors="0" time="0" timestamp="2013-07-16T19:52:00Z">
<failure type="AssertionFailedError" message="Died on test #1: 'undefined' is not an object (evaluating 'data.cloneParams.fromCategory')" />
</testcase>
<system-out>
<![CDATA[
[workflow.cloning.test, has AFE detour number predicate, 1] Died on test #1: 'undefined' is not an object (evaluating 'data.cloneParams.fromCategory')
]]>
</system-out>
</testsuite>
<testsuite id="4" name="workflow.cloning.test" hostname="localhost" tests="14" failures="2" errors="0" time="0" timestamp="2013-07-16T19:52:00Z">
<testcase name="has scenarios predicate" tests="1" failures="1" errors="0" time="0" timestamp="2013-07-16T19:52:00Z">
<failure type="AssertionFailedError" message="Died on test #1: 'undefined' is not an object (evaluating 'data.cloneParams.fromCategory')" />
</testcase>
<system-out>
<![CDATA[
[workflow.cloning.test, has scenarios predicate, 1] Died on test #1: 'undefined' is not an object (evaluating 'data.cloneParams.fromCategory')
]]>
</system-out>
</testsuite>
<testsuite id="5" name="workflow.cloning.test" hostname="localhost" tests="19" failures="2" errors="0" time="0.001" timestamp="2013-07-16T19:52:00Z">
<testcase name="clone warning in comments predicate" tests="5" failures="0" errors="0" time="0.001" timestamp="2013-07-16T19:52:00Z">
</testcase>
</testsuite>
</testsuites>
But when I run it, and the xsd I found at: https://svn.jenkins-ci.org/trunk/hudson/dtkit/dtkit-format/dtkit-junit-model/src/main/resources/com/thalesgroup/dtkit/junit/model/xsd/junit-4.xsd (which is appropriate as we are using Jenkins), through the validator at this site: http://www.freeformatter.com/xml-validator-xsd.html
It reports the errors below. So is qunit-reporter-junit really generating compliant xml? Are there other ways I could be validating this?
Cvc-complex-type.3.2.2: Attribute 'hostname' Is Not Allowed To Appear In Element 'testsuites'.. Line '2', Column '181'.
Cvc-complex-type.3.2.2: Attribute 'timestamp' Is Not Allowed To Appear In Element 'testsuites'.. Line '2', Column '181'.
Cvc-complex-type.3.2.2: Attribute 'tests' Is Not Allowed To Appear In Element 'testcase'.. Line '4', Column '136'.
Cvc-complex-type.3.2.2: Attribute 'failures' Is Not Allowed To Appear In Element 'testcase'.. Line '4', Column '136'.
Cvc-complex-type.3.2.2: Attribute 'errors' Is Not Allowed To Appear In Element 'testcase'.. Line '4', Column '136'.
Cvc-complex-type.3.2.2: Attribute 'timestamp' Is Not Allowed To Appear In Element 'testcase'.. Line '4', Column '136'.
Cvc-complex-type.3.2.2: Attribute 'tests' Is Not Allowed To Appear In Element 'testcase'.. Line '8', Column '127'.
Cvc-complex-type.3.2.2: Attribute 'failures' Is Not Allowed To Appear In Element 'testcase'.. Line '8', Column '127'.
Cvc-complex-type.3.2.2: Attribute 'errors' Is Not Allowed To Appear In Element 'testcase'.. Line '8', Column '127'.
Cvc-complex-type.3.2.2: Attribute 'timestamp' Is Not Allowed To Appear In Element 'testcase'.. Line '8', Column '127'.
Cvc-complex-type.3.2.2: Attribute 'tests' Is Not Allowed To Appear In Element 'testcase'.. Line '12', Column '135'.
Cvc-complex-type.3.2.2: Attribute 'failures' Is Not Allowed To Appear In Element 'testcase'.. Line '12', Column '135'.
Cvc-complex-type.3.2.2: Attribute 'errors' Is Not Allowed To Appear In Element 'testcase'.. Line '12', Column '135'.
Cvc-complex-type.3.2.2: Attribute 'timestamp' Is Not Allowed To Appear In Element 'testcase'.. Line '12', Column '135'.
Cvc-complex-type.3.2.2: Attribute 'tests' Is Not Allowed To Appear In Element 'testcase'.. Line '16', Column '126'.
Cvc-complex-type.3.2.2: Attribute 'failures' Is Not Allowed To Appear In Element 'testcase'.. Line '16', Column '126'.
Cvc-complex-type.3.2.2: Attribute 'errors' Is Not Allowed To Appear In Element 'testcase'.. Line '16', Column '126'.
Cvc-complex-type.3.2.2: Attribute 'timestamp' Is Not Allowed To Appear In Element 'testcase'.. Line '16', Column '126'.
Cvc-complex-type.3.2.2: Attribute 'tests' Is Not Allowed To Appear In Element 'testcase'.. Line '26', Column '118'.
Cvc-complex-type.3.2.2: Attribute 'failures' Is Not Allowed To Appear In Element 'testcase'.. Line '26', Column '118'.
Cvc-complex-type.3.2.2: Attribute 'errors' Is Not Allowed To Appear In Element 'testcase'.. Line '26', Column '118'.
Cvc-complex-type.3.2.2: Attribute 'timestamp' Is Not Allowed To Appear In Element 'testcase'.. Line '26', Column '118'.
Cvc-complex-type.3.2.2: Attribute 'tests' Is Not Allowed To Appear In Element 'testcase'.. Line '36', Column '134'.
Cvc-complex-type.3.2.2: Attribute 'failures' Is Not Allowed To Appear In Element 'testcase'.. Line '36', Column '134'.
Cvc-complex-type.3.2.2: Attribute 'errors' Is Not Allowed To Appear In Element 'testcase'.. Line '36', Column '134'.
Cvc-complex-type.3.2.2: Attribute 'timestamp' Is Not Allowed To Appear In Element 'testcase'.. Line '36', Column '134'.
Take a look at this discussion at GitHub please. The issue is already closed - maybe it depends on the product version.
Related
I need to use Multi Reporters for Mocha, so I choose:
https://github.com/stanleyhlng/mocha-multi-reporters
Everything is ok, but I need use custom reporter - mocha-junit-reporter .
How can I use in mocha-multi-reporters mocha-junit-reporter ?
I've tried something like this:
"junitReporterOptions": {
"id": "junit",
"reporter": "mocha-junit-reporter",
"output": "../../cms2/raportUnitTestsjunit.xml"
},
But I've got "Reporter does not found! junit" . Is it compatible with mocha-multi-reporters ?
You can install "mocha-multi-reporters#1.1.1" to use "mocha-junit-reporter" custom reporter.
// File: config.json
{
"reporterEnabled": "mocha-junit-reporter",
"mochaJunitReporterReporterOptions": {
"mochaFile": "junit-custom.xml"
}
}
$ ./node_modules/.bin/mocha --reporter mocha-multi-reporters --reporter-options configFile=config.json
1..4
ok 1 mocha-test 1 sample test 1.1
ok 2 mocha-test 1 sample test 1.2
ok 3 mocha-test 2 sample test 2.1
ok 4 mocha-test 2 sample test 2.2 # SKIP -
# tests 3
# pass 3
# fail 0
$ cat xunit-custom.xml
<?xml version="1.0" encoding="UTF-8"?>
<testsuites name="Mocha Tests" time="0.001" tests="4" failures="0" skipped="1">
<testsuite name="Root Suite" timestamp="2016-10-30T02:27:54" tests="0" failures="0" time="0">
</testsuite>
<testsuite name="mocha-test #1" timestamp="2016-10-30T02:27:54" tests="2" failures="0" time="0.001">
<testcase name="mocha-test #1 sample test #1.1" time="0.001" classname="sample test #1.1">
</testcase>
<testcase name="mocha-test #1 sample test #1.2" time="0" classname="sample test #1.2">
</testcase>
</testsuite>
<testsuite name="mocha-test #2" timestamp="2016-10-30T02:27:54" tests="2" failures="0" time="0">
<testcase name="mocha-test #2 sample test #2.1" time="0" classname="sample test #2.1">
</testcase>
</testsuite>
</testsuites>
You can find a demo project # https://github.com/stanleyhlng/mocha-multi-reporters-demo
Hope this help!
I am using Google Test to generate an XML Report. I am also using pandoc to write my reports.
Is it possible to use pandoc to convert the XML Google Test report into an HTML file where the XML elements are represented in nice tables automagically?
Here is the example of the XML report of a failing test:
<?xml version="1.0" encoding="UTF-8"?>
<testsuites tests="8" failures="1" disabled="0" errors="0" timestamp="2015-05-29T11:40:56" time="0.018" name="AllTests">
<testsuite name="orientPoints" tests="8" failures="1" disabled="0" errors="0" time="0.018">
<testcase name="trianglePolygon" status="run" time="0" classname="orientPoints" />
<testcase name="regularOctogon" status="run" time="0" classname="orientPoints" />
<testcase name="orientRegularOctogon" status="run" time="0" classname="orientPoints" />
<testcase name="square" status="run" time="0" classname="orientPoints" />
<testcase name="rectangleDuplicateEdges" status="run" time="0" classname="orientPoints" />
<testcase name="orientationBug" status="run" time="0" classname="orientPoints" />
<testcase name="randomCirclePointsOrientedByProjection" status="run" time="0.018" classname="orientPoints" />
<testcase name="uniqueSquareWithDuplicatePoints" status="run" time="0" classname="orientPoints">
<failure message="geomTestOrient.C:425
Value of: pointChainIsOriented( squareOriented.begin(), squareOriented.end(), squareNormal )
Actual: false
Expected: true" type=""><![CDATA[geomTestOrient.C:425
Value of: pointChainIsOriented( squareOriented.begin(), squareOriented.end(), squareNormal )
Actual: false
Expected: true]]></failure>
<failure message="geomTestOrient.C:443
Value of: squareOriented.size() == 4
Actual: false
Expected: true
failed iteration : 0
square size : 14
oriented unique square size : 6
input front : (-5.9729471176018073e-16 1.0000000000000007 6.1131855418087139e-16)
input back : (1.0000000000000004 0.99999999999999933 5.2878054241263088e-16)
" type=""><![CDATA[geomTestOrient.C:443
Value of: squareOriented.size() == 4
Actual: false
Expected: true
failed iteration : 0
square size : 14
oriented unique square size : 6
input front : (-5.9729471176018073e-16 1.0000000000000007 6.1131855418087139e-16)
input back : (1.0000000000000004 0.99999999999999933 5.2878054241263088e-16)
]]></failure>
</testcase>
</testsuite>
</testsuites>
Inside a div ,place xml data for fusion chart(StackedChart3D), while getting innerHtml of div self terminated category tag are getting close in wrong order ..below is code snipshot..I am not sure what is going wrong in gatting data from DOM
Graph Data
<div id="myRewardsHistorydivXML">
<graph bgColor='F1f1f1' caption='' subcaption='' xaxisname='' yaxisname='' canvasbgcolor='F1F1F1' numdivlines='0' showLegend='1' yAxisMaxValue='50'>
**<categories font='Arial' fontSize='10' fontColor='000000'>
<category name='2011' />
<category name='2012' />
</categories>**
<dataset seriesname='My Life' color='1941A5' showValues='0' alpha='100'>
<set value='25675' color='1941A5'></set>
<set value='22475' color='1941A5'></set>
</dataset>
<dataset seriesname='My Health' color='FF0000' showValues='0' alpha='100'>
<set value='21675' color='1941A5'></set>
<set value='23531' color='1941A5'></set>
</dataset>
<graph>
</div>
in Watch Window of Browser while checking innerHTML of element document.getElementById("myRewardsHistorydivXML").innerHTML ..Its apperaing
<graph bgColor='F1f1f1' caption='' subcaption='' xaxisname='' yaxisname='' canvasbgcolor='F1F1F1' numdivlines='0' showLegend='1' yAxisMaxValue='50'>
<categories font='Arial' fontSize='10' fontColor='000000'>
**<category name='2011'>
<category name='2012'>
</category></category>**
</categories>
<dataset seriesname='My Life' color='1941A5' showValues='0' alpha='100'>
<set value='25675' color='1941A5'></set>
<set value='22475' color='1941A5'></set>
</dataset>
<dataset seriesname='My Health' color='FF0000' showValues='0' alpha='100'>
<set value='21675' color='1941A5'></set>`enter code here`
<set value='23531' color='1941A5'></set>
</dataset>
<graph>
You are dumping XML into an HTML document and the browser is trying to parse it as HTML.
<category name='2011' /> is treated as a start tag for an unrecognised element, not as a self-closing tag.
The end tags are not being rearranged, they are missing and the browser is inserting them at where it thinks the right place is to keep the DOM valid.
I have a problem whit EWS (Exchange Webservice)
I send an request for FindFolders
<?xml version="1.0"?>
<soap12:Envelope xmlns:soap12="http://schemas.xmlsoap.org/soap/envelope" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://www.w3.org/2003/05/soap-encoding" xmlns:M="http://schemas.microsoft.com/exchange/services/2006/messages" soap12:encodingStyle="http://www.w3.org/2003/05/soap-encoding" xmlns:T="http://schemas.microsoft.com/exchange/services/2006/types">
<soap12:Body>
<M:FindFolder>
<request SOAP-ENC:id="1" xsi:type="M:FindFolder" Traversal="Deep">
<FolderShape xsi:nil="true"/>
<IndexedPageFolderView SOAP-ENC:id="2" xsi:type="T:IndexedPageViewType" Offset="0" BasePoint="Beginning"/>
<ParentFolderIds xsi:nil="true"/>
</request>
<Impersonation xsi:nil="true"/>
<S2SAuth xsi:nil="true"/>
<MailboxCulture xsi:type="xsd:string">de-DE</MailboxCulture>
<RequestVersion SOAP-ENC:id="3" xsi:type="T:RequestServerVersion" Version="Exchange2007_SP1"/>
</M:FindFolder>
</soap12:Body>
</soap12:Envelope>
and get following xml from server
<?xml version="1.0"?>
<soap11:Envelope xmlns:soap11="http://schemas.xmlsoap.org/soap/envelope/">
<soap11:Header>
<t:ServerVersionInfo MajorVersion="8" MinorVersion="3" MajorBuildNumber="245" MinorBuildNumber="0" xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types" />
</soap11:Header>
<soap11:Body>
<soap11:Fault>
<faultcode>soap11:Client</faultcode>
<faultstring>The request failed schema validation: The required attribute 'Traversal' is missing.</faultstring>
<detail>
<e:ResponseCode xmlns:e="http://schemas.microsoft.com/exchange/services/2006/errors">ErrorSchemaValidation</e:ResponseCode>
<e:Message xmlns:e="http://schemas.microsoft.com/exchange/services/2006/errors">
The required attribute 'Traversal' is missing.
</e:Message>
<e:Line xmlns:e="http://schemas.microsoft.com/exchange/services/2006/errors">2
</e:Line>
<e:Position xmlns:e="http://schemas.microsoft.com/exchange/services/2006/errors">446
</e:Position>
</detail>
</soap11:Fault>
</soap11:Body>
</soap11:Envelope>
So why the Server say that Traversal is missing ?
(I also have tested it with the T:Traversal = Deep T: for the namespaceentry for the types)
Can someone can help me with this problem?
Traversal is required on the FindFolder element. Try changing it from...
<M:FindFolder>
<!-- ... -->
To this...
<M:FindFolder Traversal="Deep">
<!-- ... -->
The Traversal attribute must adhere to the following XSD schema:
<simpleType name="FolderQueryTraversalType">
<restriction base="{http://www.w3.org/2001/XMLSchema}string">
<enumeration value="Shallow"/>
<enumeration value="Deep"/>
<enumeration value="SoftDeleted"/>
</restriction>
</simpleType>
i have tryed following constellations
<M:FindFolder M:Traversal="DEEP>
The request failed schema validation: The 'http://schemas.microsoft.com/exchange/services/2006/messages:Traversal' attribute is not declared.
<M:FindFolder T:Traversal="DEEP>
The request failed schema validation: The 'http://schemas.microsoft.com/exchange/services/2006/types:Traversal' attribute is not declared.
<M:FindFolder Traversal="DEEP">
The request failed schema validation: The 'Traversal' attribute is invalid - The value 'DEEP' is invalid according to its datatype 'http://schemas.microsoft.com/exchange/services/2006/types:FolderQueryTraversalType' - The Enumeration constraint failed.
I'm trying to parse an xml file output from googletest to display the results in a pretty way in an html page. I have had a fair crack at it and have a working solution. Only one thing left to do.
Currently each class has a header and each function+test is displayed underneath, I'm looking for a way to extract the function name from the xml attribute to have it as its own sub-heading. Example below
Current Output
Class Name
functionName_testName
functionName_test2Name
function2Name_testName
Desired Output
Class Name
functionName
testName
test2Name
function2Name
testName
XML To be Parsed
<testsuite name="testPacketProcessor" tests="27" failures="0" disabled="0" errors="0" time="36.875">
<testcase name="testInitialise_IpNotSet" status="run" time="0" classname="testPacketProcessor" />
<testcase name="testInitialise_GoodIp" status="run" time="2.046" classname="testPacketProcessor" />
<testcase name="testInitialise_BadIp" status="run" time="0.032" classname="testPacketProcessor" />
</testsuite>
XSL Currently Implemented
<xsl:for-each select="testsuites/testsuite">
<div class="testHeading">
<span><xsl:value-of select="substring-after(#name,'test')"/></span>
</div>
<xsl:for-each select="testcase">
<div class="testReport">
<xsl:if test="not(starts-with(#name,'DISABLED'))"><xsl:value-of select="substring-after(#name,'test')"/></xsl:if>
<xsl:if test="starts-with(#name,'DISABLED')"><xsl:value-of select="substring-after(#name,'DISABLED_test')"/></xsl:if>
<xsl:text> - </xsl:text>
<xsl:if test="starts-with(#status,'run')">
<xsl:if test="failure"><xsl:text>Fail</xsl:text></xsl:if>
<xsl:if test= "not(failure)"><xsl:text>Pass</xsl:text></xsl:if>
</xsl:if>
<xsl:if test="starts-with(#status,'not')"><xsl:text>Disabled</xsl:text></xsl:if>
</div>
</xsl:for-each>
</xsl:for-each>
Using the above xml as an example I would like a subheading of "Initialise" under the packet processor heading with each test doucumented under the subheading
Any advice on the best way to go about this would be much appreciated. I've looked at xsl variables but cannot fathom how to deal with not being able to change the value. Have also read a little on xsl templates and recursion but I'm not sure how that would work for this situation.
Thanks in advance
Dougie
This transformation produces the subheading and name for each testcase:
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output omit-xml-declaration="yes" indent="yes"/>
<xsl:strip-space elements="*"/>
<xsl:template match="testcase">
Subheading: <xsl:value-of select=
"substring-before(substring-after(#name, 'test'),
'_'
)
"/>
Name: <xsl:value-of select="substring-after(#name, '_')"/>
<xsl:text>
</xsl:text>
</xsl:template>
</xsl:stylesheet>
When applied on the provided XML document:
<testsuites>
<testsuite name="testPacketProcessor" tests="27" failures="0" disabled="0" errors="0" time="36.875">
<testcase name="testInitialise_IpNotSet" status="run" time="0" classname="testPacketProcessor" />
<testcase name="testInitialise_GoodIp" status="run" time="2.046" classname="testPacketProcessor" />
<testcase name="testInitialise_BadIp" status="run" time="0.032" classname="testPacketProcessor" />
</testsuite>
</testsuites>
the wanted, correct result is produced:
Subheading: Initialise
Name: IpNotSet
Subheading: Initialise
Name: GoodIp
Subheading: Initialise
Name: BadIp
Explanation: Using the standard XPath functions substring-before() and substring-after()
Edit: In a comment the OP clarified that he wanted grouping by function (tired of bad questions ?):
This transformation performs the wanted grouping:
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output omit-xml-declaration="yes" indent="yes"/>
<xsl:strip-space elements="*"/>
<xsl:key name="kTestsByFunction" match="testcase"
use="substring-before(substring-after(#name, 'test'),
'_'
)"
/>
<xsl:template match=
"testcase
[generate-id()
=
generate-id(key('kTestsByFunction',
substring-before(substring-after(#name, 'test'),
'_'
)
)[1]
)
]
">
Subheading:
<xsl:value-of select=
"substring-before(substring-after(#name, 'test'),
'_'
)
"/>
<xsl:for-each select=
"key('kTestsByFunction',
substring-before(substring-after(#name, 'test'),
'_'
)
)
">
Name:
<xsl:value-of select="substring-after(#name, '_')"/>
<xsl:text>
</xsl:text>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>
and produces the wanted result:
Subheading:
Initialise
Name:
IpNotSet
Name:
GoodIp
Name:
BadIp