Wiki
Clone wikiWebAutomation / SpecFlow
WebAutomation.SpecFlow
Integration between WebAutomation and SpecFlow.
Installation
To install WebAutomation.SpecFlow, run the following command in the Package Manager Console
PM> Install-Package WebAutomation.SpecFlow
How to
In order to use WebAutomation in SpecFlow tests, you have to:
- create a new class that will inherit from
WebAutomation.SpecFlow.SpecFlowTestBase
- add
[Binding]
attribute to that class - create your own step implementations
Example:
using TechTalk.SpecFlow; using WebAutomation.SpecFlow; using OpenQA.Selenium.Firefox; [Binding] public class MySteps : SpecFlowTestBase { public MySteps(ScenarioContext scenarioContext) : base(scenarioContext) { } [Given(@"user navigates to '(.*)'")] public void GivenNavigation(string url) { this.WebDriver = new FirefoxDriver(); this.WebDriver.Navigate().GoToUrl(url); } [When(@"user is logged as '(.*)' with '(.*)' password")] public void WhenLogin(string user, string password) { var myLoginPage = this.GetContainer<MyLoginPage>(); myLoginPage.UsernameInput.Perform.Fill(user); myLoginPage.PasswordInput.Perform.Fill(password); myLoginPage.LoginButton.Perform.Click(); } }
Updated