1
我有以下功能,我想在黄瓜中进行测试。但是,我只想处理输入文件一次(@Given在下面的功能)。但是,它似乎每次都在执行@Given步骤。是否有可能只在以下功能中执行此@Given一次?在黄瓜功能文件中只执行一次@Given
@fileValidation
Scenario Outline: File Validation
Given a file is uploaded with name "something.csv"
Then response filename created should not match input filename "something.csv"
And reason for errors should be "<Reason>" with error code "<Error code>" for row with RequestId "<RequestId>"
Examples:
| RequestId | Error code | Reason |
| 123 | 101 | Failure 1 |
| 124 | 102 | Failure 1; Failure 2 |
我也尝试过之前和之后通过删除给定步骤没有运气钩。
我也钩尝试过,但仍然是一个来到这个循环中的实例的每一行。
@Before("@fileValidation")
public void file_is_uploaded() throws Throwable {
String fileName = "something.csv";
processInputFile(fileName);
}
@After("@fileValidation")
public void clear() {
outputFileName = null;
}
,并在特征文件我有这样的事情:
@fileValidation
Scenario Outline: File Validation
Background: Read the uploaded file "something.csv"
Then response filename created should not match input filename "something.csv"
And reason for errors should be "<Reason>" with error code "<Error code>" for row with RequestId "<RequestId>"
Examples:
| RequestId | Error code | Reason |
| 123 | 101 | Failure 1 |
| 124 | 102 | Failure 1; Failure 2 |