gpt4 book ai didi

java - 如何配置 Jenkins 运行 1 个 selenium 测试用例

转载 作者:太空宇宙 更新时间:2023-11-04 14:05:03 25 4
gpt4 key购买 nike

我在 Windows 7 上将 Jenkins 作为服务运行。

我的包中有大约 100 个 Selenium 测试用例,但我只想运行 1 个测试用例。

是否可以将 Jenkins 配置为运行 1 个而不是全部测试?

最佳答案

根据 Jenkins 构建的配置方式,您可以在某处指定 Maven 目标。这些可以配置为指定要执行的测试,如here所述。 :

mvn -Dtest=TestCircle#mytest test

请注意,这需要 Surefire 2.7.3 或更高版本,以及 Junit 4.X 或 TestNG:

As of Surefire 2.7.3, you can also run only a subset of the tests in a test class.

NOTE: This feature is supported only for Junit 4.x and TestNG.

对于旧版本的 Surefire 插件/JUnit,似乎只能在类级别上进行控制,即您无法在类中指定特定测试:

mvn -Dtest=TestCircle test

关于java - 如何配置 Jenkins 运行 1 个 selenium 测试用例,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28943517/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com