[英]How to make selenium RC tests run in multiple browsers (using java & eclipse & selenium grid)
I have test cases written in Java in Eclipse that are currently working perfectly with selenium grid but only in one browser at a time. 我有用Java在Eclipse中编写的测试用例,目前可以完美地与硒网格一起使用,但一次只能在一个浏览器中使用。 How do I make it run with multiple browsers simultaneously?
如何使其在多个浏览器上同时运行? Thanks in advance!
提前致谢!
If selenium grid is already running, you're halfway done. 如果硒网格已经在运行,那么您就完成了一半。
As you might know, selenium grid automatically distributes the tests on all registered nodes. 您可能知道,Selenium网格会自动将测试分布在所有已注册的节点上。 If only one browser is opening at a time, it probably means you're not executing your tests in parallel - they are probably executing sequentially.
如果一次只打开一个浏览器,则可能意味着您不是并行执行测试-它们可能是顺序执行的。
What you need to do now is to run your tests in parallel . 您现在需要做的是并行运行测试 。 If you are using maven, you could configure Maven Surefire Plugin to run the tests in multiple threads for you (works both with JUnit 4.7+ and TestNG):
如果您使用的是maven,则可以配置Maven Surefire插件为您在多个线程中运行测试(与JUnit 4.7+和TestNG一起使用):
If you are using Maven, add the following snippet to your <plugins>
section in your pom.xml (change it according to your needs - see doc ). 如果您使用的是Maven,请将以下代码段添加到pom.xml的
<plugins>
部分中(根据需要进行更改-请参阅doc )。
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.5</version>
<configuration>
<parallel>methods</parallel>
<threadCount>4</threadCount>
<perCoreThreadCount>true</perCoreThreadCount>
</configuration>
</plugin>
See http://testng.org/doc/documentation-main.html#parallel-running 参见http://testng.org/doc/documentation-main.html#parallel-running
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.