Created
January 3, 2017 06:09
-
-
Save executeautomation/b412b1eb67091520864abb8b2d6a5a93 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using OpenQA.Selenium; | |
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Text; | |
using System.Threading; | |
using System.Threading.Tasks; | |
using TechTalk.SpecFlow; | |
using TechTalk.SpecFlow.Assist; | |
namespace SpecflowParallelTest.Steps | |
{ | |
[Binding] | |
class UserFormSteps | |
{ | |
private IWebDriver _driver; | |
public UserFormSteps(IWebDriver driver) | |
{ | |
_driver = driver; | |
} | |
[Given(@"I start entering user form details like")] | |
public void GivenIStartEnteringUserFormDetailsLike(Table table) | |
{ | |
dynamic data = table.CreateDynamicInstance(); | |
_driver.FindElement(By.Id("Initial")).SendKeys((string)data.Initial); | |
_driver.FindElement(By.Id("FirstName")).SendKeys((string)data.FirstName); | |
_driver.FindElement(By.Id("MiddleName")).SendKeys((string)data.MiddleName); | |
Thread.Sleep(2000); | |
} | |
[Given(@"I click submit button")] | |
public void GivenIClickSubmitButton() | |
{ | |
_driver.FindElement(By.Name("Save")).Click(); | |
} | |
[Given(@"I verify the entered user form details in the application database")] | |
public void GivenIVerifyTheEnteredUserFormDetailsInTheApplicationDatabase(Table table) | |
{ | |
//Mock data collection | |
List<AUTDatabase> mockAUTData = new List<AUTDatabase>() | |
{ | |
new AUTDatabase() | |
{ | |
FirstName = "Karthik", | |
Initial = "k", | |
MiddleName = "k" | |
}, | |
new AUTDatabase() | |
{ | |
FirstName = "Prashanth", | |
Initial = "k", | |
MiddleName = "k" | |
} | |
}; | |
//For verification with single row data | |
var result = table.FindAllInSet(mockAUTData); | |
//For verification againt Multiple row data | |
var resultnew = table.FindAllInSet(mockAUTData); | |
} | |
} | |
public class AUTDatabase | |
{ | |
public string Initial { get; set; } | |
public string FirstName { get; set; } | |
public string MiddleName { get; set; } | |
public string Gender { get; set; } | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment