Open christian-bromann opened 7 years ago
Did you experience this @wvankuipers ?
I am running into the exact same error with Jasmine 2.5.3 when I have a test marked as excluded xit
.
Skipped tests have an undefined value for the title attribute, which throws an error on prepareName(...)
Is that a legitimate situation, having an undefined
title in a pending spec? I'm working on a pull request to more gracefully handle this situation. Would this be a good approach, or there something further upstream that needs to be looked at?
prepareName (name) {
if (name) {
return name.toLowerCase().split(this.suiteNameRegEx).filter(
(item) => item && item.length
).join('_')
}
return ''
}
In my case, there is an undefined value after each Scenario. I do not have a blank title. Imho it looks like a problem upstream.
Here's a test feature and step.
Feature: true test
Scenario: True should always be true
Given blank test
When blank test
Then blank test
var myStepDefinitionsWrapper = function () {
this.Given(/^blank test$/, function () {
});
};
module.exports = myStepDefinitionsWrapper;
{
"name": "test-junit-wdio",
"version": "0.0.0",
"license": "",
"author": "",
"description": "",
"repository": "",
"main": "",
"engines": {
"node": "~6.10.0",
"yarn": "^0.20.0"
},
"scripts": {
"test": "wdio",
"test:report": "wdio"
},
"dependencies": {
"babel-plugin-transform-runtime": "^6.23.0",
"babel-preset-es2015": "^6.24.1",
"babel-register": "^6.24.1",
"babel-runtime": "^6.23.0",
"webdriverio": "^4.6.2"
},
"devDependencies": {
"wdio-browserstack-service": "^0.1.4",
"wdio-cucumber-framework": "^0.2.16",
"wdio-dot-reporter": "0.0.8",
"wdio-junit-reporter": "^0.3.0",
"wdio-phantomjs-service": "^0.2.2",
"wdio-selenium-standalone-service": "0.0.8",
"wdio-spec-reporter": "^0.1.0"
}
}
value: function prepareName(name) {
console.log('prepareName', name);
if(!name) return '';
return name.toLowerCase().split(this.suiteNameRegEx).filter(function (item) {
return item && item.length;
}).join('_');
}
$ yarn run test
yarn run v0.20.3
$ wdio
prepareName true test
prepareName True should always be true
prepareName undefined
prepareName blank test
prepareName blank test
prepareName blank test
Wrote xunit report to [./outputDir].
3 passing (1.00s)
Done in 1.51s.
Did you experience this @wvankuipers ?
@christian-bromann I have not used the junit reporter in combination with the boilerplate. I'm going to look into this.
I am experiencing the same problem as @drawm. I don't have any new lines after Scenario
line but for some reason the SuiteStats
object passed (as one of the keys of capabilities) into prepareXml
method of wdio-junit-reporter
from upstream contains
{
undefined:
TestStats {
type: 'test',
start: 2017-05-10T14:29:40.961Z,
_duration: 0,
uid: 'undefined',
title: undefined,
state: '',
screenshots: [],
output: []
}
@christian-bromann Do you have any idea on why this could be happening? Thanks.
not without having a reproducible example
@christian-bromann Here is a reproducible example repo: https://github.com/mfurtado-mdsol/junit-cucumber-failure.
I basically copied example given by @drawm with one difference(Before hook) in my steps file.
var myStepDefinitionsWrapper = function () {
this.Before(scenario => {
// Do something
});
this.Given(/^blank test$/, function () {
});
};
module.exports = myStepDefinitionsWrapper;
It seems to me adding a Before
hook leads to this issue of undefined newline after Scenario title.
this.Before
is not supported by wdio-cucumber-framework
. Please use wdio hooks. If it is supported in Cucumber v1.x.x
than I am happy to add support for it. PRs welcome.
@christian-bromann thanks. I can live with using wdio hooks. 🍻
From @inspiraller on March 29, 2017 9:9
Using cucumber-boilerplate with junit reporter, I get an error: This is inside my wdio.conf:
This is the error:
Copied from original issue: webdriverio/cucumber-boilerplate#73