我为我的specflow'Then'步骤编写了一段代码。我理解如何阅读一个文件。但我希望我的代码遵循某个路径("/orabin/app/inputs/ff/actuals/"
)然后读取(Cat)多个文件。然后,我将根据预期的数据输出验证数据。
processFilePath将始终保持不变,但{Path}应更改为不同的文件名。
.RunLinuxcommand($"cat {processFilePath}{path}");
[Then("Transfer out measure should be generated for (.*)")]
public void ValidateInventoryMeasurement(string path, string expected)
{
const string processFilePath = "/orabin/app/inputs/ff/actuals/";
var actual = Common.LinuxCommandExecutor
.RunLinuxcommand($"cat {processFilePath}{path}");
//xxx_xxx.csv.ovrr, xxx.xxx.xxx.csv.ovrr
// Multiple file name above
Assert.AreEqual(expected, actual);
}
功能文件:
Given I Loaded Measurement in domain for Current
And interface is generated
When batch is executed
Then Transfer out measure should be generated Current
Examples:
| Lifecyclestatus |
| PreNew |
| New |
| Current |
答案 0 :(得分:1)
您应该在Steps
类中定义[Then(@"Transfer out measure (.*) should be generated as (.*)")]
public void ValidateInventoryMeasurement(string path, string expected)
以接受2个输入参数。
Given I Loaded Measurement in domain for Current
And interface is generated
When batch is executed
Then Transfer out measure <inputPath> should be generated as <expectedPath>
Examples:
| inputPath | expectedPath |
| Lifecyclestatus | placeyourvalhere |
| PreNew | placeyourvalhere |
| New | placeyourvalhere |
| Current | placeyourvalhere |
功能文件应定义如下。并定义测试输入参数。
placeyourvalhere
确保根据输入更改{{1}}预期值。