Execute Cucumber step before/after a specific feature

前端 未结 3 1985
青春惊慌失措
青春惊慌失措 2020-12-17 08:28

I want to specify certain setup and tear down steps for each specific feature file. I\'ve seen hooks that allows code to execute before every scenario, and hooks to execute

3条回答
  •  半阙折子戏
    2020-12-17 09:21

    Try this :

    In feature file :

    @tagToIdentifyThatBeginAfterShouldRunForThisFeatureOnly
    Feature : My new feature ....
    

    In Stepdefinitions.java :

    @Before("@tagToIdentifyThatBeginAfterShouldRunForThisFeatureOnly")
    public void testStart() throws Throwable {
    }
    
    @After("@tagToIdentifyThatBeginAfterShouldRunForThisFeatureOnly")
    public void testStart() throws Throwable {
    }
    

提交回复
热议问题