lundi 4 juin 2018

Automating 'Then' step BDD C# Specflow

I'm fairly new to using specflow. I'm running a test where i'm validating an output from a file (e.g irm_xxx_lkdd_xuxt.csv.ovr) with my expected output "6677,6677_6677,3001,6"

The issue i'm having is my code below isn't being recognised by my specflow 'Then' step. This is because i have mixed Nunit testcase with BDD.

In my 'Then' Step i'm validating and processing a file. I want to essentially combine define my file path e.g irm_xxx_lkdd_xuxt.csv.ovr and the expected result "6677,6677_6677,3001,6" within my method.

   [Then("Transfer measure should be generated for (.*)")]


[TestCase("irm_xxx_lkdd_xuxt.csv.ovr", "6677,6677_6677,3001,6")]
[TestCase("irm_xxx_lkdd_fcvt.csv.ovrr", "6677,6677_6677,3001,6")]
[TestCase("irm_xxx_lkdd_fbvt.csv.ovrr", "6677,6677_6677,3001,6")]

public void ValidateMeasurement(string path, string expected)
{
    const string processFilePath = "/orabin/app/product/inputs/ff/actuals/";
    var actual = Common.LinuxCommandExecutor
                       .RunLinuxcommand($"cat {processFilePath}{path}");

    Assert.AreEqual(expected, actual);

}

Below i have shown an example what i'm trying to achieve but i'm not sure what the right approach to this is. I want to continue to use the processFilePath but then how can i define the path of the files and compare it with my expected outcome.

     public void ValidateInventoryMeasurement(string path, string expected)
    {
        const string processFilePath = "/orabin/app/oracle/product/asos/inputs/ff/ff/actuals/";
        var actual = Common.LinuxCommandExecutor
                           .RunLinuxcommand($"cat {processFilePath}{path}");

        **var path = ("irm_pgfw_trntbf_xuxt.csv.ovr", "6677,6677_6677,3001,6"),("irm_pgfw_trntbf_fcvt.csv.ovrr", "6677,6677_6677,3001,6"),
            ("irm_pgfw_trntbf_fbvt.csv.ovrr", "6677,6677_6677,3001,6")]");**

        Assert.AreEqual(expected, actual);

Below is my feature file defining what will be happening at each step.

Given I Loaded LifeCycle Measurement for Current
And Inventory interface is generated 
When Inventory batch is executed
Then Transfer measure should be generated Current
Examples:
| Lifecyclestatus |
| PreNew          |
| New             |
| Current         |
| Clearance       |
| Old             |

Aucun commentaire:

Enregistrer un commentaire