Cucumber js - 标记为 BeforeFeature
Cucumber js - Tagged BeforeFeature
我希望在 CucumberJS - Protractor 测试中标记我的 BeforeFeature 挂钩
- 挂钩仅针对具有该标签的功能文件运行
- 钩子中的代码只在功能文件开始之前运行一次,而不是在每个场景之前运行
例如- 仅在 BeforeFeature 中以特定用户身份登录功能文件 'abc.feature'
cucumberjs 中现有的 BeforeFeature 实现如下 -
this.registerHandler('BeforeFeature', function (feature) {
//do common action before feature file execution
});
我不确定它是否将标签作为参数。有没有其他方法可以在 BeforeFeature 级别指定标签?
this.BeforeFeature(function(feature) {
feature.getTags().forEach(function (tag) {
if(tag.getName() === '@myTag') {
//do common action before feature file execution
}
});
});
或
this.BeforeFeature(function(feature) {
if(feature.getName() === 'ABC') {//Gherkin file => Feature: ABC
//do common action before feature file execution
}
});
我希望在 CucumberJS - Protractor 测试中标记我的 BeforeFeature 挂钩
- 挂钩仅针对具有该标签的功能文件运行
- 钩子中的代码只在功能文件开始之前运行一次,而不是在每个场景之前运行
例如- 仅在 BeforeFeature 中以特定用户身份登录功能文件 'abc.feature'
cucumberjs 中现有的 BeforeFeature 实现如下 -
this.registerHandler('BeforeFeature', function (feature) {
//do common action before feature file execution
});
我不确定它是否将标签作为参数。有没有其他方法可以在 BeforeFeature 级别指定标签?
this.BeforeFeature(function(feature) {
feature.getTags().forEach(function (tag) {
if(tag.getName() === '@myTag') {
//do common action before feature file execution
}
});
});
或
this.BeforeFeature(function(feature) {
if(feature.getName() === 'ABC') {//Gherkin file => Feature: ABC
//do common action before feature file execution
}
});