Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to edit | customize test suite name in the result.xml file for mocha #200

Open
Er-Prakash opened this issue Jan 24, 2024 · 0 comments
Open

Comments

@Er-Prakash
Copy link

This may not be an issue because I am suspecting the configuration mismatch. But need inputs from you,

Snippet from the package.json file

"scripts": {
    "test": "mocha <localpath>\\verifyAPIEndPoints.js --reporter mocha-junit-reporter --reporter-options mochaFile=./<local_path>/test-results.xml",
    "test:userAPI" : "mocha <localpath>\\userAPIValidation.js --reporter mocha-junit-reporter --reporter-options mochaFile=./<localpath>/userAPI-test-results.xml",
    "test:orderAPI" : "mocha <localpath>\\orderAPIValidation.js --reporter mocha-junit-reporter --reporter-options mochaFile=./<localpath>/orderAPI-test-results.xml",
    "test:all": "npm run test & npm run test:userAPI & npm run test:orderAPI"
  },

This is running absolutely file and it is creating respective result.xml file, but I want to modify the result.xml file

<?xml version="1.0" encoding="UTF-8"?>
<testsuites name="Mocha Tests" time="7.545" tests="23" failures="0">
  <testsuite name="Root Suite" timestamp="2024-01-22T13:32:58" tests="23" time="7.543" failures="0">

I want to modify the testsuite name="Root Suite" to respective name like for test-results.xml it should testsuite name="apitest", is there any way I can do it ?

Like for test

<?xml version="1.0" encoding="UTF-8"?>
<testsuites name="Mocha Tests" time="7.545" tests="23" failures="0">
  <testsuite name="ApiTest" timestamp="2024-01-22T13:32:58" tests="23" time="7.543" failures="0">

Like for [test](test:userAPI)

<?xml version="1.0" encoding="UTF-8"?>
<testsuites name="Mocha Tests" time="7.545" tests="23" failures="0">
  <testsuite name="test_userAPI" timestamp="2024-01-22T13:32:58" tests="23" time="7.543" failures="0">

for test:orderAPI

<?xml version="1.0" encoding="UTF-8"?>
<testsuites name="Mocha Tests" time="7.545" tests="23" failures="0">
  <testsuite name="test_orderAPI" timestamp="2024-01-22T13:32:58" tests="23" time="7.543" failures="0">
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant