传递参数c#selenium test BDD

时间:2018-05-24 10:58:57

标签: c# selenium bdd specflow

我写了一个specflow场景。

Given Inventory interface is generated  
And I Loaded LifeCycle Measurement in integration domain for <lifecyclestatus>
When Inventory batch is executed
Then Transfer out measure should be generated <lifecyclestatus>
Examples: 
| Lifecyclestatus |
| Prenew          |
| New             |
| Current         |
| Clearance       |
| Old             |

如何在c#代码中传递参数,以便它在表格中运行所有不同的状态?

1 个答案:

答案 0 :(得分:0)

您可以通过创建下面给出的步骤定义方法来传递参数。

    [And(@"I Loaded LifeCycle Measurement in integration domain for (.*)")]
    public void AndILoadedLifeCycleMeasurementInIntegrationDomainFor(string lifecycleStatus)
    {
       //your code goes here
    }

    [Then(@"Transfer out measure should be generated (.*)")]
    public void ThenTransferOutMeasureShouldBeGenerated(string lifecycleStatus)
    {
       //your code goes here
    }