运行 与 selenium 网格并行测试
Running tests in parallel with selenium grid
我的 testng.xml :
<suite name="Tests Suite" time-out="300000" verbose="1" annotations="JDK" thread-count="4" parallel="tests">
<test name="Tests1">
<classes>
<class name="TestingClass1">
</class>
</classes>
</test>
</suite>
在"TestingClass1"中有4个测试但是
硒网格仅在单个节点上触发测试。
谁能帮我弄清楚我做错了什么,以及如何并行触发测试,在此先感谢。
您已将并行选项作为测试,但您的 xml 中只有一个测试标签。将 parallel = tests
更改为 parallel=methods
我假设您在 TestingClass1.java 文件中有 4 个测试方法(具有 @Test 注释的方法)。您还应该注意使驱动程序对象线程安全。
parallel="tests": TestNG will run all the methods in the same tag in the same thread, but each tag will be in a separate thread. This allows you to group all your classes that are not thread safe in the same and guarantee they will all run in the same thread while taking advantage of TestNG using as many threads as possible to run your tests.
http://testng.org/doc/documentation-main.html#parallel-tests
您可能正在寻找的是有多个测试 classes 并与 parallel="classes"
并行执行它们。在大多数情况下,当涉及 Java 上的 Selenium 时,这是最有效的方法。
您也可以按照上面的正确描述选择 parallel=methods
,尽管这不适用于大多数测试自动化框架,因为需要仔细管理 class 层次结构。
我的 testng.xml :
<suite name="Tests Suite" time-out="300000" verbose="1" annotations="JDK" thread-count="4" parallel="tests">
<test name="Tests1">
<classes>
<class name="TestingClass1">
</class>
</classes>
</test>
</suite>
在"TestingClass1"中有4个测试但是 硒网格仅在单个节点上触发测试。
谁能帮我弄清楚我做错了什么,以及如何并行触发测试,在此先感谢。
您已将并行选项作为测试,但您的 xml 中只有一个测试标签。将 parallel = tests
更改为 parallel=methods
我假设您在 TestingClass1.java 文件中有 4 个测试方法(具有 @Test 注释的方法)。您还应该注意使驱动程序对象线程安全。
parallel="tests": TestNG will run all the methods in the same tag in the same thread, but each tag will be in a separate thread. This allows you to group all your classes that are not thread safe in the same and guarantee they will all run in the same thread while taking advantage of TestNG using as many threads as possible to run your tests.
http://testng.org/doc/documentation-main.html#parallel-tests
您可能正在寻找的是有多个测试 classes 并与 parallel="classes"
并行执行它们。在大多数情况下,当涉及 Java 上的 Selenium 时,这是最有效的方法。
您也可以按照上面的正确描述选择 parallel=methods
,尽管这不适用于大多数测试自动化框架,因为需要仔细管理 class 层次结构。