Using selenium web driver to run test on multiple browsers

后端 未结 7 968
时光说笑
时光说笑 2021-02-04 19:42

I\'m trying to run a same test across multiple browsers through for loop but it always run only on Firefox.

bros = [\'FIREFOX\',\'CHROME\',\'INTERNET EXPLORER\']         


        
7条回答
  •  不知归路
    2021-02-04 20:21

    So if I got you right, you have one testcase and want this to be tested against different browsers.

    I don't think a loop is a good idea even if it's possible (I don't know atm).

    The idea is to be able to test every testcase standalone on the run with a specific browser (thats the JUnit philosophy), not to run all in order to get to that specific browser .

    So you need to create a WebDriver with the specific browser and the specific testcase.

    I suggest you seperate testcases by creating a testcase-class file for each browser.

    Like: FirefoxTestOne.java, IeTestOne.java, ChromeTestOne.java .

    Note that you can add multiple firefox tests in the FirefoxTestOne without problems. Theres no guarantee that they will be executed in a particular order through (JUnit philosophy).

    For links and tutorials ask google. There are already looooots of examples written.

提交回复
热议问题