jeudi 26 mars 2015

Input from CSV file to a text field in Web C#

I am a beginner in coded UI testing, coding isn't my strong suit. I want to ask you guys this with the simples answer possible.



Let's say I have a automated script in C# that
- opens a browser google.com
- Searches for a string value in Google

If I wish to replace the static string value with some values in a CSV file How do I do that?


Expectation: - I write a program that launches Google.com - Fetches a a string from CSV and searches for it - Then repeats it again from same file for other values


Below is my code.



public CodedUITest1()
{
}

[TestMethod]
public void openBrw()
{

BrowserWindow browser = BrowserWindow.Launch("www.google.com");
UITestControl UISearch = new UITestControl(browser);
UISearch.TechnologyName = "Web";
UISearch.SearchProperties.Add("ControlType", "Edit");
UISearch.SearchProperties.Add("Id", "lst-ib");
Keyboard.SendKeys(UISearch, "Australian Cricket Team");
this.UIMap.

MY CSV files looks like this with 1 column

column1
How to win matches
Where to find dragons
japan in 1998


Please tell me the easiest way!

Aucun commentaire:

Enregistrer un commentaire