How to edit | customize test suite name in the result.xml file for mocha
Er-Prakash opened this issue · comments
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">