【问题标题】:How to run one test method only in selenium grid如何仅在硒网格中运行一种测试方法
【发布时间】:2012-09-19 11:03:57
【问题描述】:

我正在使用 JUnit 4.8.1 和 Surefire 2.8.1。在我的机器上,我只能通过以下方式运行一种测试方法:

$$ mvn clean test -Dtest=TestClass#TestMethod

但是在网格配置中运行相同的命令时,TestClass 中的所有测试都会运行。

在 pom 中唯一的区别是

<configuration>
   <parallel>both</parallel>
</configuration>

surefire-plugin 中的配置。

任何想法,我如何在网格中只运行一种测试方法?

【问题讨论】:

    标签: java selenium junit selenium-grid surefire


    【解决方案1】:

    可能的解决方案是使用@Categories 注释。但我使用简单的网络驱动程序(不是网格)。 尝试一步一步设置here

    思路如下: 您注释了一组要排除的测试,然后在 POM 文件中显示您以类似的方式排除它们:

    <configuration>
    <excludes>
    <exclude>blablabla.class</exclude>
    </excludes>
    </configuration>
    

    希望这对你有所帮助。

    【讨论】:

    • 这和我想要的不一样。这个想法不是排除给定的类:是选择要执行的类中的各个 @Test 方法。这在本地很容易完成,但在网格中,它不起作用。
    猜你喜欢
    • 1970-01-01
    • 2013-07-29
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-09-19
    • 2018-05-17
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多