2017-04-13 1 views
0
내가 CucumberJS 내 BeforeFeature 후크를 태그 할

- 각도기 테스트 후크가 태그 오이 JS - 태그 BeforeFeature

  • 후크 내부의 코드와 기능 파일 만 실행 등

    1. 그 전에 한 번만 실행 모든 시나리오 이전이 아닌 피쳐 파일의 시작이 아님.

    예. -

    this.registerHandler('BeforeFeature', function (feature) { 
         //do common action before feature file execution 
        }); 
    

    나는 그것이 인수로 태그 걸리는 경우 확실하지 않다 - 단지 기능 파일 'abc.feature'

    cucumberjs에서 BeforeFeature의 기존 구현은 다음과 같습니다에 대한 BeforeFeature의 특정 사용자로 로그인 . BeforeFeature 레벨에서 태그를 지정하는 다른 방법이 있습니까?

  • 답변

    0
    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 
        } 
    }); 
    
    관련 문제