webdriverio: Can't generate Allure report while test failed

Environment (please complete the following information):

  • WebdriverIO version: 5.18.7
  • Mode: WDIO Testrunner
  • If WDIO Testrunner, running sync/async: sync
  • Node.js version: 12.16.0
  • NPM version: 6.13.4
  • Browser name and version: Chrome 80.0.3987.106
  • Platform name and version: Windows 10
  • Additional wdio packages used (if applicable): @wdio/allure-reporter

Config of WebdriverIO ? Where should your tests be launched? local ? Where is your automation backend located? On my local machine ? Which framework do you want to use? cucumber ? Do you want to run WebdriverIO commands synchronous or asynchronous? sync ? Where are your feature files located? ./features/**/*.feature ? Where are your step definitions located? ./features/step-definitions ? Which reporter do you want to use? spec, allure ? Do you want to add a service to your test setup? chromedriver ? What is the base url? http://localhost

Describe the bug While I run the test successfully, the allure-reporter can generate the xml file. But when the test failed, the allure-reporter didn’t generate any file so that I can’t check the failed test result.

To Reproduce The allure-reporter configure is

reporters: ['spec', ['allure', {
    outputDir: './allure-results',
    useCucumberStepReporter: true
 }]],

Then I run wdio wdio.conf.js. The test failed (This is what I expected), the result xml file not generated (This is not what I expected). Besides, I found some error message may related to this bug

[0-0] 2020-02-18T09:17:34.384Z ERROR @wdio/runner: Error: charData should not contain characters not allowed in XML
    at XmlCharData.set [as charData] (D:\c\Desktop\ProgramProject\HTML\Homework\HW-5\node_modules\xmlcreate\lib\nodes\XmlCharData.js:75:23)
    at new XmlCharData (D:\c\Desktop\ProgramProject\HTML\Homework\HW-5\node_modules\xmlcreate\lib\nodes\XmlCharData.js:53:24)
    at XmlElement.charData (D:\c\Desktop\ProgramProject\HTML\Homework\HW-5\node_modules\xmlcreate\lib\nodes\XmlElement.js:168:28)
    at parseString (D:\c\Desktop\ProgramProject\HTML\Homework\HW-5\node_modules\js2xmlparser\lib\main.js:53:27)
    at parseValue (D:\c\Desktop\ProgramProject\HTML\Homework\HW-5\node_modules\js2xmlparser\lib\main.js:227:5)
    at parseObjectOrMapEntry (D:\c\Desktop\ProgramProject\HTML\Homework\HW-5\node_modules\js2xmlparser\lib\main.js:132:5)
    at parseObjectOrMap (D:\c\Desktop\ProgramProject\HTML\Homework\HW-5\node_modules\js2xmlparser\lib\main.js:152:13)
    at parseValue (D:\c\Desktop\ProgramProject\HTML\Homework\HW-5\node_modules\js2xmlparser\lib\main.js:220:9)
    at parseObjectOrMapEntry (D:\c\Desktop\ProgramProject\HTML\Homework\HW-5\node_modules\js2xmlparser\lib\main.js:132:5)
    at parseObjectOrMap (D:\c\Desktop\ProgramProject\HTML\Homework\HW-5\node_modules\js2xmlparser\lib\main.js:152:13)
    at parseValue (D:\c\Desktop\ProgramProject\HTML\Homework\HW-5\node_modules\js2xmlparser\lib\main.js:220:9)
    at D:\c\Desktop\ProgramProject\HTML\Homework\HW-5\node_modules\js2xmlparser\lib\main.js:192:9
    at Array.forEach (<anonymous>)
    at parseArrayOrSet (D:\c\Desktop\ProgramProject\HTML\Homework\HW-5\node_modules\js2xmlparser\lib\main.js:187:16)
    at parseValue (D:\c\Desktop\ProgramProject\HTML\Homework\HW-5\node_modules\js2xmlparser\lib\main.js:224:9)
    at parseObjectOrMapEntry (D:\c\Desktop\ProgramProject\HTML\Homework\HW-5\node_modules\js2xmlparser\lib\main.js:132:5)
[0-0] Error: charData should not contain characters not allowed in XML

Expected behavior When test failed, allure-reporter should also generate the result xml file.

Log Full log is here Sorry for containing some Chinese words in the log.

Additional context Nope

Please use the correct markdown

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 17 (14 by maintainers)

Commits related to this issue

Most upvoted comments

@christian-bromann the same issue is here

I think we should close 3 with reference to this one.

We use expect as a base library for expect-webdriverio so we should handle this ourself. I think it is a good idea to clean the output from terminal colors in the reporter. Thanks for clarifying all!

@benebsiny yes I reproduced issue. Culprit is jest expect. As I get it uses chalk and print the error with terminal colors. It makes allure xml generation fail.

I don’t really know how it can be fixed now. Probably we can sanitise the error stacktrace from runner and then passing it into allure.

as workaround you can still use chai assertion library.

I put it on here You have to npm run server first, then npm run test. Try to modified the .feature file then run again, you’ll get the error message I mentioned above