GithubHelp home page GithubHelp logo

junit reporter format? about newman HOT 17 CLOSED

postmanlabs avatar postmanlabs commented on August 27, 2024
junit reporter format?

from newman.

Comments (17)

Ernesto-Maserati-CH avatar Ernesto-Maserati-CH commented on August 27, 2024 2

I don't understand the latest state of this issue.
Is it now built into Newman?
Or does it to be converted with a custom script by each guy who wants a xUnit report?

from newman.

prakhar1989 avatar prakhar1989 commented on August 27, 2024

Hi @mattaylor, this sounds like a great idea. We'll work on this and release an update. Will keep you posted! 👍

from newman.

patimen avatar patimen commented on August 27, 2024

+1 on this!

from newman.

mattaylor avatar mattaylor commented on August 27, 2024

FYI heres a brain dead livescript module to convert the json output to xunit...

report = require './testReport.json'
xml = '<?xml version="1.0" encoding="UTF-8"?>'
for suite in report.results
   xml += "<testsuite name='#{suite.name}'>"
   for test, count of suite.testPassFailCounts then xml += "<testcase label='#test' failures=#{count.fail} />"
   xml += "</testsuite>"
console.log xml

from newman.

morozgrafix avatar morozgrafix commented on August 27, 2024

+1 on junit/xunit reporter to be built into newman

from newman.

nbalsamo avatar nbalsamo commented on August 27, 2024

This would be awesome to have junit/xunit built in.

from newman.

jimthedev avatar jimthedev commented on August 27, 2024

This would be fantastic since most CI tools can easily parse xunit style reporting.

from newman.

jaetask avatar jaetask commented on August 27, 2024

+1 one this. Any update? would be very nice to integrate with jenkins

from newman.

jxf86 avatar jxf86 commented on August 27, 2024

+1

from newman.

abhijitkane avatar abhijitkane commented on August 27, 2024

Newman 1.2.0 now supports junit-style output for tests. (Thanks @pal-thomassen)

Sample response:

<?xml version="1.0" encoding="UTF-8"?>
<testsuites>
    <testsuite name="TestRequest" id="609a5233-6542-c2ed-b308-446101ac693d" timestamp="2014-12-02T07:06:21.186Z" time="51.50 ms" totalTime="103 ms" tests="4" iterations="2">
        <testcase name="SampleTest1" successes="2" failures="0" />
        <testcase name="SampleTest2" successes="2" failures="0" />
        <testcase name="SampleTest3" successes="1" failures="1" />
        <testcase name="SampleTest4" successes="0" failures="2" />
    </testsuite>
</testsuites>

from newman.

sciutand avatar sciutand commented on August 27, 2024

The syntax of the report file does not seem to correspond to the junit supported syntax found at http://llg.cubic.org/docs/junit/

successes is not recognised.
failures property should live in the testsuite not testcase. Just tested with Jenkins junit plugin and success es/failures are not reported correctly because of malformed syntax

from newman.

Torquem avatar Torquem commented on August 27, 2024

Jenkins seems to expect the optional failure inside the testcase.


<testcase ...>
    <failure message="I so fail" type="epic" />
</testcase>

from newman.

abhijitkane avatar abhijitkane commented on August 27, 2024

A <testsuite> element corresponds to a request.
A single request can have multiple tests (represented by the tests[] array).
Each test corresponds to a <testcase>.

In case of multiple iterations, each test is run multiple times. So having a single <failure> element inside the <testcase> isn't suitable.

The next newman version (v1.2.5) will have successes and failures attributes in the <testsuite> element, that'll aggregate the counts in the constituent <testcase> elements

from newman.

sbutlerjr avatar sbutlerjr commented on August 27, 2024

just tested 1.2.6. successes and failures are in the testsute and testcase node. The testsuite node is aggregating the test case node. However Jenkins still isn't parsing that format it seems. Jenkins reads that junit output, it shows them all as successful, even when there are failures in the junit xml.

from newman.

sbutlerjr avatar sbutlerjr commented on August 27, 2024

To add some additional detail to this, the Jenkins xsd for jUnit is located here: 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

So, an example file would like like below, if there were an error. Seems like the current version that newman creates is missing the failures sumed up in the testsuites node, and its also missing the failure node within the testcase (if it had an error). For example:

<testsuite failures="1" tests="3">
    <testcase classname="foo1" name="ASuccessfulTest"/>
    <testcase classname="foo2" name="AnotherSuccessfulTest"/>
    <testcase classname="foo3" name="AFailingTest" failures="1">
        <failure type="NotEnoughFoo"> details about failure </failure>
    </testcase>
</testsuite>

from newman.

rclayton-the-terrible avatar rclayton-the-terrible commented on August 27, 2024

+10

from newman.

sbutlerjr avatar sbutlerjr commented on August 27, 2024

Tested the patch from commit #184 and it worked. Thanks!

from newman.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.