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][1]:

<!-- language: lang-java -->

    @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][2].


  [1]: https://github.com/TNG/junit-dataprovider
  [2]: http://toolsqa.com/selenium-webdriver/testng-parameters-data-provider/