Reusing Cucumber-JVM step definitions in other projects

前端 未结 1 1952
说谎
说谎 2020-12-28 23:23

How can I reuse Cucumber-JVM Step Definitions in other projects to test some typical web actions. The point is that I\'ve created some java project just with Step Definition

1条回答
  •  南方客
    南方客 (楼主)
    2020-12-28 23:49

    Well, I've found solution. It appears quite easy.

    There is annotation @CucumberOptions which has parameter "glue". Pointing with this parameter to the base package that has the step definitions forces Cucumber to search in that base package. The test runner will look like:

    @RunWith(Cucumber.class)
    @CucumberOptions(glue = { "com.example.stepdefspackage" })
    public class Run{
    }
    

    0 讨论(0)
提交回复
热议问题