0

I am trying to concept out how to implement a Factory to test a test class on all browsers that I have defined. Is there a better way to do this. Can anyone suggest a basic improvement?

public class FactoryDataProviderTestBase extends MyTestBase 
{
  @Factory(dataProvider = "dp")
  public FactoryDataProviderTestBase( SauceTestHelper helper, 
       Map<String,String> csvArgMap ) {
    super( helper,  csvArgMap );
  }

  @DataProvider( name = "factory" )
  static public Object[][] factoryDataProvider() {

    // do stuff here to initialize csvArgMap from csv file

    return new Object[][] {
      new Object[] { new SauceTestHelper(browser.FirefoxLatest), argMap },
      new Object[] { new SauceTestHelper(browser.IE8), argMap },
      new Object[] { new SauceTestHelper(browser.IE9), argMap },
      new Object[] { new SauceTestHelper(browser.IE10), argMap },
      new Object[] { new SauceTestHelper(browser.IE11), argMap },
      new Object[] { new SauceTestHelper(browser.Safari7), argMap },
      new Object[] { new SauceTestHelper(browser.Chrome), argMap }
    };

  }
}

In the code above, TestNG should create multiple instances of the class FactoryDataProviderTestBase, one for each defined browser?

djangofan
  • 28,471
  • 61
  • 196
  • 289
  • I am not familiar with TestNG but JUnit has a parameterized runner option that allows you to setup parameters before running a test. TestNG might have something similar. See if this answer helps your case http://stackoverflow.com/questions/26604745/parameterized-selenium-tests-in-parallel-with-testng. – shri046 Nov 03 '14 at 16:10

1 Answers1

-1

You should use Selenium's Grid for this. Setup and configuration information can be found here

user2272115
  • 986
  • 1
  • 10
  • 22
  • I do use Selenium Grid, in the form of Sauce Labs grid. Also, my question IS NOT about Selenium Grid configuration. – djangofan Oct 03 '14 at 20:05