webdriverio-boneyard / wdio-junit-reporter

A WebdriverIO v4 plugin. Report results in junit xml format.
http://v4.webdriver.io
MIT License
11 stars 42 forks source link

Import Execution Results - REST - Xray: Execution Details has no Error Message #86

Closed mcelotti closed 6 years ago

mcelotti commented 6 years ago

Hi, I'm importing the test results to Jira using the Xray plugin but the error message for failed tests is ignored.

Versions I've used: JIRA v7.7.0 Xray 2.3.2 wdio-junit-reporter 0.3.1

After a bit of debugging I found out that the fix is:

from

                        if (test.error) {
                            testCase.error(test.error.message)
                            testCase.standardError(`\n${test.error.stack}\n`)
                        }

to

                        if (test.error) {
                            testCase.stacktrace(test.error.message)
                            testCase.failure(test.error.message)
                            testCase.standardError(`\n${test.error.stack}\n`)
                        }

In my case failure(message) was not enough to let Jira show the error message, so the combination of failure and stacktrace did the trick.

Thanks

christian-bromann commented 6 years ago

Would you mind making a pull request? Shouldn't it be:

                        if (test.error) {
                            testCase.stacktrace(test.error.stack) // <-- stack instead of message
                            testCase.failure(test.error.message)
                            testCase.standardError(`\n${test.error.stack}\n`)
                        }
mcelotti commented 6 years ago

Yes, I've used the test.error.message because we did not want to see the complete stacktrace, but your note is right. I did not create a PR because honestly I'm not really sure that this is the right thing to do, maybe for other tools it's better to use the standard error() method.

christian-bromann commented 6 years ago

@mcelotti so what would you suggest?

mcelotti commented 6 years ago

Maybe we could use a configuration flag to choose between error or failure + stacktrace? Or something similar, since we have 4 options: testCase.error / testCase.failure / testCase.stacktrace / testCase.standardError, and I think all could be useful depending on the situation

christian-bromann commented 6 years ago

@mcelotti I think an option would be fine for that, would you mind proposing a PR for it?

mcelotti commented 6 years ago

No, no problem, I'll take a look