我想在CucumberJS中标记我的BeforeFeature钩子 - 量角器测试
e.g。 - 仅作为特征文件'abc.feature'
在BeforeFeature中以特定用户身份登录在cucumberjs中现有的BeforeFeature实现如下 -
this.registerHandler('BeforeFeature', function (feature) {
//do common action before feature file execution
});
我不确定它是否需要标记作为参数。还有其他方法可以在BeforeFeature级别指定标签吗?
答案 0 :(得分:0)
this.BeforeFeature(function(feature) {
feature.getTags().forEach(function (tag) {
if(tag.getName() === '@myTag') {
//do common action before feature file execution
}
});
});
OR
this.BeforeFeature(function(feature) {
if(feature.getName() === 'ABC') {//Gherkin file => Feature: ABC
//do common action before feature file execution
}
});