I know that for me to create a data driven test that i need to use a datasource with the test method, and that the datasource had to have already existed.
My question is how about if you want to make a test method data driven but you don't have the datasource file at run time.
Edit
What i mean is I want to basically iterate over the same test X number of times. The reason I dont have the data is because i have to first fetch the data first and then iterate over it.
below i created a test that ran for each of my hyperlink but after the test pass i only get results Passed Once instead for each iteration of my hyperlink. I also tried to launch something in the "[TestInitialize()]" section and assign my data file to it but since the data file has to be constant(or already exist), i cant do it. Any help with this would be great
[TestMethod]
public void Verify_Rates_Links()
{
HomePage getLinks = new HomePage(GlobalVariable.Browser);
int PicCount = 0;
// To generate code for this test, select "Generate Code for Coded UI Test" from the shortcut menu and select one of the menu items.
PageObjects.Shared.SharedBetweenPage StarTest = new PageObjects.Shared.SharedBetweenPage(GlobalVariable.Browser);
getLinks.GetAllHeaderLinks("Rates", "3", GlobalVariable.Rates_Links);
foreach ( HtmlHyperlink links in GlobalVariable.Rates_Links)
{
Assert.IsTrue(
StarTest.LetsGoToHomePage()
.LetsclickLink(links)
.VerifyLocationPage("Rates","Rates", "Rates", "VerifyRateslinkBreadcrumb" + PicCount.ToString() + ".jpg", "VerifyRatesHeader" + PicCount.ToString() + ".jpg"),
"There is an issue with Rates to create new membership APP one or more of the work flows is not work");
//Playback.Cleanup();
//testcl
PicCount++;
}
}
~Will