Skip to main content

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)
}
@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.

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.

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.

Source Link
João Farias
  • 11k
  • 2
  • 20
  • 40

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.