简体   繁体   English

如何使硒RC测试在多个浏览器中运行(使用Java和Eclipse和Selenium网格)

[英]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一起使用):

Using Maven: 使用Maven:

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>

Without Maven: 没有Maven:

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.

相关问题 如何使用Selenium WebDriver在不同的浏览器上同时运行多个测试? - How to run multiple tests on different browsers simultaneously using Selenium WebDriver? 如何使用Java在多个浏览器中运行Selenium测试以进行跨浏览器测试? - How to run Selenium tests in multiple browsers for cross-browser testing using Java? 使用Java在Selenium RC中使用多个浏览器进行单个测试 - Multiple browsers for single test in selenium RC with java 卡在多个浏览器中同时运行 Selenium RC 脚本 - Stuck to run Selenium RC script simultaneously in multiple browsers Java:Selenium Grid:如何在特定节点上运行特定测试 - Java:Selenium Grid: How to Run specific tests on particular node 如何使用Java通过Selenium RC和TestNG顺序运行/执行方法 - How to run/execute methods sequentially by Selenium RC and TestNG using Java 使用相同的Firefox窗口在Selenium WebDriver(Java)中运行多个测试 - Using the same Firefox Window to run multiple tests in Selenium WebDriver (Java) 如何通过命令行使用Selenium RC运行Selenium Java测试用例和套件 - How to run selenium java test case and suite using selenium rc through command line 使用Selenium webdriver + TestNG + Java在不同的浏览器上运行测试 - To run tests on different browsers using Selenium webdriver+ TestNG+Java 硒-使用WebDriver或RC运行硒记录 - Selenium - run selenium recording using webdriver or RC
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM