简体   繁体   English

如何使用Junit并行化同一Selenium套件的多个实例?

[英]How can I parallelize multiple instances of the same Selenium suite using Junit?

I have a Junit test suite that I am using to run a series of selenium tests. 我有一个Junit测试套件,用于运行一系列硒测试。 I need to run these tests on several platforms (browser/OS combos, mobile devices). 我需要在多个平台(浏览器/ OS组合,移动设备)上运行这些测试。 Is there a way for me to run the suite in parallel with 4 other instances of the same suite (5 total), each with different config settings (settings for the RemoteWebDriver). 有没有一种方法可以让我将该套件与同一套件的其他4个实例(总共5个)并行运行,每个实例具有不同的配置设置(RemoteWebDriver的设置)。

Should I us a parallelized runner (I've seen a few options) on each test within the suite or parallelize the suite itself? 我应该在套件中的每个测试上使用并行化的运行器(我已经看到了几个选项)还是对套件本身进行并行化?

Also, is there a way to run a sequence of these parallel runs? 另外,是否有办法运行这些并行运行的序列? (ie 5 parallel runs followed by another 5 parallel runs, etc.) (即5次并行运行,然后再进行5次并行运行,依此类推)

You want to use Selenium Grid for this. 您要为此使用Selenium Grid

To run tests in parallel with JUnit4, you will also need Maven . 要与JUnit4并行运行测试,您还需要Maven

Remember that Selenium grid does not provide the parallel distribution of your tests, it is simply a way to allow multiple threads hit the same endpoint to support parallel testing. 请记住,Selenium网格不提供测试的并行分发,它只是允许多个线程到达同一端点以支持并行测试的一种方法。

You still need a mechanism to support the parallel distribution of your tests. 您仍然需要一种机制来支持测试的并行分发。

I know this can be achieved with JUnit, but in my experience it is easier with TestNG 我知道可以使用JUnit来实现,但是以我的经验,使用TestNG会更容易

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM