How do I run the same test case in 2 different URL which has same functionality
-
1Welcome: have a look here for how to ask. You likely will get downvotes for no code and unclear to name two reasons. In general it would help if you provided insights in what you researched and tried yourself and where you got stuck. If it is purely a coding question: StackOverflow is a better place to ask.– Ray OeiCommented Dec 15, 2018 at 15:03
-
Your question is not clear can you explain little more.– RaoCommented Dec 15, 2018 at 15:48
Add a comment
|
1 Answer
It depends on the test runner you are using - most of them provide a feature called Data Provider.
In JUnit, you would use TNG/junit-dataprovider:
@DataProvider
public static Object[][] urlDataProvider() {
return new Object[][] {
"google.com",
"facebook.com",
/* ... */
};
}
@Test
@UseDataProvider("urlDataProvider")
public void multipleURLs(String url) {
driver.get(url)
}
TestNG has a similar feature. See this blog post.