2012-11-08 52 views
0

我正在使用Selenium,并且我目前有一个集线器连接到两台运行所有浏览器的虚拟机。使用Selenium网格和测试套件的并行执行

我能够启动浏览器。然而,事件hough我有两个vms,我所有的测试都在单个虚拟机上的单个浏览器上运行。 Selenium不会在虚拟机中启动多个浏览器。我已将最大实例设置为5,并反映在我的gris控制台中。我有测试套件需要运行在Linux和Windows VM,它必须同时运行。我使用WebDriver像这样调用我的网格。

capabilities = new DesiredCapabilities(); 
      capabilities.setBrowserName("firefox"); 
      driver = new RemoteWebDriver(new URL("http://XXX.XXX.XXX.:4444/wd/hub"), capabilities); 

这是我如何创建我的测试套件:

testNames.add(SupportPortalTestSuite.class.getName()); 
     JUnitCore.main(testNames.toArray(new String[testNames.size()])); 

此外,当注册我的节点我得到:

11:28:47.403 INFO - using the json request : {"class":"org.openqa.grid.common.RegistrationRequest","capabilities":[{"platform":"LINUX","seleniumProtocol":"Selenium","browserName":"*firefox","maxInstances":5},{"platform":"LINUX","seleniumProtocol":"Selenium","browserName":"*googlechrome","maxInstances":5},{"platform":"LINUX","seleniumProtocol":"Selenium","browserName":"*iexplore","maxInstances":1},{"platform":"LINUX","seleniumProtocol":"WebDriver","browserName":"firefox","maxInstances":5},{"platform":"LINUX","seleniumProtocol":"WebDriver","browserName":"chrome","maxInstances":5},{"platform":"WINDOWS","seleniumProtocol":"WebDriver","browserName":"internet explorer","maxInstances":1}],"configuration":{"port":5555,"register":true,"host":"10.235.132.161","proxy":"org.openqa.grid.selenium.proxy.DefaultRemoteProxy","maxSession":5,"hubHost":"10.235.1.50","role":"node","registerCycle":5000,"hub":"http://10.235.1.50:4444/grid/register","hubPort":4444,"url":"http://10.235.132.161:5555","remoteHost":"http://10.235.132.161:5555"}} 
11:28:47.407 INFO - starting auto register thread. Will try to register every 5000 ms. 

我需要运行在所有可用的浏览器测试同时在vms上。

回答

0

Selenium Grid让您能够并行运行测试,但不会自动处理它。这通常是由测试运行者为您处理它。一些像TestNG这样的框架具有这种内置功能,但可能需要根据您的代码进行一些定制。

0

尽管最好使用一些框架如testNG,但也可以使用普通的java Threaded方式运行它们。

相关问题