How do I run the same test case in 2 different URL which has same functionality

  • 1
    Welcome: 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 Oei
    Dec 15, 2018 at 15:03
  • Your question is not clear can you explain little more.
    – Rao
    Dec 15, 2018 at 15:48

1 Answer 1


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:

public static Object[][] urlDataProvider() {
    return new Object[][] {
            /* ... */

public void multipleURLs(String url) {

TestNG has a similar feature. See this blog post.

Not the answer you're looking for? Browse other questions tagged or ask your own question.