Giter Site home page Giter Site logo

newman-reporter-junitxray's People

Contributors

aaswtest avatar ratheeshart avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

newman-reporter-junitxray's Issues

Error getting test execution time

There is an error getting and reporting into Xray the execution time of a test. Next I will try to explain the best I can do.

Executing a test suite with newman and junitxray report, I got the next xml report

<?xml version="1.0" encoding="UTF-8"?>
<testsuites name="Arlo-mocks" tests="2">
  <testsuite id="d8261b5c-c114-4bcf-b2b1-072e766ee614" name="common-service / suite for xray" tests="1" timestamp="2020-10-27T13:20:18.428" time="0.022" failures="0" errors="0">
    <testcase classname="ArloMocks" name="getConnected" time="0.000"/>
  </testsuite>
</testsuites>

As you can see, time is well reported in the testsuite node, but in the testscase node, the time value is 0.000. Time value in the testscase node is the one that Xray uses to inform the "Duration" period in the test execution details. Show you this in the next picture

image

Reading the code I found that the value for this field is obtained in index.js line 117

executionTime = _.get(testExecution, "response.responseTime") / 1000 || 0;

The problem is that the object response is always empty (in all my cases), even when the service tested has a response. May be some change from Newman framework.

So the solution I get is to obtain the value from time in testcase node as the same way as doing for the time value in testsuite node. Doing that the next result is obtained

junitxray report

<?xml version="1.0" encoding="UTF-8"?>
<testsuites name="Arlo-mocks" tests="2">
  <testsuite id="d8261b5c-c114-4bcf-b2b1-072e766ee614" name="common-service / suite for xray" tests="1" timestamp="2020-10-27T13:20:18.428" time="0.022" failures="0" errors="0">
    <testcase classname="ArloMocks" name="getConnected" time="0.022"/>
  </testsuite>
</testsuites>

xray report

image

Global variable getting override while using loop

global = xml.create("testsuites", { version: "1.0", encoding: "UTF-8" }); global.att("name", collection.name);

Issue:
I need to run multiple collection using newman. On each collection the reports were generated at the same time the global gets overrided with xml. This cause the next collection fail at newman SecureFS class.

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.