如何在我的功能场景中使用标签?
其实我有一个场景:
- Feature: create module feature
- As a admin
- I want to use create module
- @createModule
- Given I am logged as 'ADMIN'
- And I am on "/admin/create"
- Then The "book_id" field should be empty
我想在我的函数中使用我的标签@createModule然后:
- this.Then(/^The "?([^"]*)"? field should be empty$/,function (el) {
- if (myModule === @createModule) {
- ...
- } else if {
- ...
- }
- return main_po.checkIsEmptyElement(this,el);
- });
我想得到我的标签@createModule,以指定所调用的场景,或者其他替代方案,我想知道调用我的函数的场景.
Solved :
我补充说:
- this.Before(function (scenario,callback) {
- var tags = scenario.getTags();
- this.current_module = tags[0].getName();
- callback();
- });
和我的功能:
- this.Then(/^The "?([^"]*)"? field should be empty$/,function (el) {
- if (this.current_module === @createModule) {
- ...
- } else if {
- ...
- }
- return main_po.checkIsEmptyElement(this,el);
- });