我使用maven surefire插件运行selenium webDriver并使用testNG,并且能够重用我的测试重用一个JVM实例。出于某种原因,我不确定如何运行超过5.我尝试设置
I am running selenium webDriver with the maven surefire plugin and using testNG and have been able to parallelize my tests reusing one JVM instance. for some reason I am unsure how to run more than 5. I tried setting
< threadCountMethods> 10< / threadCountMethods>
希望它一次运行10个线程而不是5个我认为可能是默认的线程价值。
in the hopes that it would run 10 threads at a time rather than 5 which i thought may have been a default value.
我正在对方法进行并行化,如下所示:
I am parallelizing on methods, as shown here:
` org.apache .maven.plugins maven-surefire-plugin 2.17
` org.apache.maven.plugins maven-surefire-plugin 2.17
<configuration> <useUnlimitedThreads>true</useUnlimitedThreads> <threadCountMethods>10</threadCountMethods> <parallel>methods</parallel> <forkCount>0</forkCount> <reuseForks>true</reuseForks> <suiteXmlFiles> <suiteXmlFile>kingHenry.xml</suiteXmlFile> </suiteXmlFiles> </configuration> </plugin>`并且套件文件配置如下:
and the suite file is configured as follows:
<suite name="Suite" parallel="methods" > <parameter name="seleniumHost" value="192.168.1.74" /> <parameter name="seleniumPort" value="4444" /> <parameter name="logHost" value="localhost" /> <parameter name="logPort" value="5000" /> <parameter name="networklogging" value="false" /> <test name="Showdme"> <parameter name="browser" value="phantomjs" /> <classes> <class name="com.something.suites.kingHenry" /> <methods> <include name="testScenario1" /> <include name="testScenario2" /> <include name="testScenario3" /> <include name="testScenario4" /> <include name="testScenario5" /> <include name="testScenario6" /> </methods> </classes> </test> </suite>这里我显示有6种方法可以并行化,但是在附加的图像中一次只运行5个浏览器实例。我想知道我是否需要在我的pom.xml文件中编辑或添加配置属性,或者是否有正在使用的限制5个chromedriver实例的selenium网格的设置。任何帮助将不胜感激...在surefire插件上的一些关于线程/分叉的文档有点令人困惑。
here i am showing that there are 6 methods listed to parallelize on, but in the image that is attached only 5 browser instances run at a time. I am wondering if i need to edit or add a config property in my pom.xml file or if there is a setting for the selenium grid that is being used that limits 5 instances of the chromedriver. any help would be appreciated... some of the documentation on threads/forking on the surefire plugin was a little bit confusing.
推荐答案
如果您使用的是Selenium Grid,那么您的测试一次限制为5是有意义的。工厂Selenium Grid属性允许网格运行:
If you are using a Selenium Grid, then it makes sense that your tests are being limited to 5 at a time. The factory Selenium Grid properties allow a grid to run:
WebDriver: - 5 Google Chrome - 5 Firefox - 1 IE
WebDriver: - 5 Google Chrome - 5 Firefox - 1 IE
遗产(RC): - 5 Google Chrome - 5 Firefox - 1 IE
Legacy (RC): - 5 Google Chrome - 5 Firefox - 1 IE
您可以使用节点配置json文件更改这些值。
You can change these values using a node configuration json file.
{ "capabilities": [ { "browserName": "*chrome", "maxInstances": 2, "seleniumProtocol": "Selenium" } ... (any other browser capabilities here) ], "configuration": { "proxy": "org.openqa.grid.selenium.proxy.DefaultRemoteProxy", "maxSession": 10, "port": 5555, "register": true, "registerCycle": 5000, "hubPort": 4444 } }然后在运行节点时:
java -jar selenium-server-stand alone.jar -role node -nodeConfig nodeConfig.json ...
更多推荐
testNG / selenium webdriver限于5个并行测试
发布评论