两个不同功能文件中的多个场景大纲和示例。如何将 Java 步骤从一个功能文件重用到另一个功能文件? 功能 --> ANPost.feature **
Scenario outline : Verify csv file accept
When User perform the post request with localhost <port> <endpoint> <filename>
Then Response contains 201 and response message “Created”
***Example:***
|port|endpoint|filename|
|8080|api/v1/admin|AN.csv|
**
功能 --> BNPost.feature
***Scenario outline :*** Verify csv file accept
When User perform the post request with localhost <port> <endpoint> <filename>
Then Response contains 201 and response message “Created”
***Example:***
|port|endpoint|filename|
|8080|api/v1/admin|AN.csv|
<小时/>
ANPost.java (Implementation code for ANPost.feature) BNPost.java (Implementation code for BNPost.feature) 1, ANPost and BNPost are separefiles in feature folder. While implementing the same steps in 2 different java file I got “Duplicate implementation error”
谁能帮帮我。
最佳答案
不需要在两个不同的类中定义相同的步骤定义。删除其中一个类,框架会通过正则表达式匹配自动选取匹配的步骤定义方法。对于每个场景,都会加载glue 变量中的所有步骤定义类,因此任何单个实现都可以工作。
关于java - 两个不同的功能文件中的多个场景大纲和示例。如何将 Java 步骤从一个功能文件重用到另一个功能文件?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49829992/