我正在运行我的specflow测试。在我的'然后'步。我不确定为什么会发生这种异常。我的代码没有任何例外,我相信我的'然后'步骤已正确实施。
我的'然后'步骤编码,以便查找特定的文件路径,然后使用我的预期数据验证文件路径中的数据。
例外
Message: Expected string length 21 but was 942. Strings differ at index 0.
Expected: "6677,6677_6677,3001,6"
But was: "----- Executing Environment setup script - /orabin/app/oracle..."
-----------^
代码:
[Given(@"Inventory interface is generated")]
public void GivenInventoryInterfaceIsGenerated()
{
Row TestData = Common.Common.ReadDataFromCSV("Inventory");
ScenarioContext.Current["Inventory"] = TestData;
new ConvertToCSV().CreateInterfaceData(ConfigurationManager.AppSettings["InventoryDatFile"], TestData["Inventory"]);
}
[Given("I Loaded LifeCycle Measurement in domain for the (.*)")]
public void GivenLifecyclestatusIsLoaded(string LifeCycleStatus)
{
Row TestData = Common.Common.ReadDataFromCSV("Foundation");
new ConvertToCSV().CreateInterfaceData(ConfigurationManager.AppSettings[LifeCycleStatus + "lifecyclestatusCSVFileName"],
TestData["lifecyclestatus"]);
}
[When(@"Inventory batch is executed")]
public void InventoryBatchIsExecuted()
{
Row TestData = (Row)ScenarioContext.Current["Inventory"];
Common.LinuxCommandExecutor
.RunLinuxcommand(TestData["InventoryCommands"].ToString());
}
[Then(@"Transfer out measure should be generated (.*)")]
public void ValidateInventoryMeasurement(string lifecyclestatus)
{
var Path = "irm_pgfw_trntmf_fcvt.csv.ovr";
const string processFilePath = "/orabin/app/oracle/product/asos/inputs/ff/ff/actuals/";
var actual = Common.LinuxCommandExecutor
.RunLinuxcommand($"cat {processFilePath} {Path}");
var expected = "6677,6677_6677,3001,6";
Assert.AreEqual(expected, actual);
}