[英]SpecFlow Re-usable step definitions
有沒有辦法讓SpecFlow重用步驟定義?
在其他工具中,我使用了包含諸如的方法的GivenWhenThen基類
WhenAnOrderIsCreated - 這將通過繼承類來使用受保護的訂單成員。
似乎無法使用SpecFlow(似乎不喜歡繼承)
有沒有辦法分享各個功能的步驟?
非常感謝
為什么是可能的 - 查看步驟功能的調用步驟( https://specflow.org/documentation/Calling-Steps-from-Step-Definitions/ )
簡而言之,您創建一個繼承自以下步驟的步驟定義類:
[Binding]
public class CallingStepsFromStepDefinitionSteps : Steps
{}
然后你可以簡單地調用這樣的其他步驟:
[Given(@"I am logged in")]
public void GivenIAmLoggedIn()
{
Given("I am on the index page");
When("I enter my unsername nad password");
And("I click the login button");
incStepCount();
}
我希望我能正確理解你的問題,這是對它的回答
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.