【问题标题】:How to run specific tests using SBT Jenkins Plugin for ScalaTest test如何使用 SBT Jenkins 插件运行特定测试以进行 ScalaTest 测试
【发布时间】:2014-06-14 09:47:24
【问题描述】:

目前我们正在使用 IntelliJ、Scala、SBT 在本地环境中启动我们的测试。使用 SBT 命令行,我们可以指定特定的测试、套件、通配符,如下所示:

ScalaTest.org Page

如“仅测试 *RedSuite”

但是在我们的 CI Jenkins 服务器上,使用 SBT 插件,当指定这个时,它会给出一个错误。

在操作字段中,使用了以下值:

操作:编译仅测试 test.package.name

使用以下方法确实适用于所有测试:

动作:编译测试

[success] Total time: 240 s, completed Apr 28, 2014 12:29:36 PM
[error] Expected ID character
[error] Not a valid command: org (similar: export)
[error] Expected project ID
[error] Expected configuration
[error] Expected ':' (if selecting a configuration)
[error] Expected key
[error] Not a valid key: org (similar: fork, run, doc)
[error] org.company.scalatest.abc.regressionsuite
[error]    ^
Build step 'Build using sbt' changed build result to FAILURE
Build step 'Build using sbt' marked build as failure
Recording test results

有谁知道我们是否可以通过 jenkins SBT 插件传递这些参数?

【问题讨论】:

    标签: jenkins sbt scalatest


    【解决方案1】:

    这是一个引用问题,您的 Action 字段被解析为 3 个命令:

    • compile
    • test-only
    • org.company.scalatest.abc.regressionsuite

    因为org 不是一个有效的命令,所以它会窒息。

    使用compile "test-only org.company.scalatest.abc.regressionsuite" 应该可以解决这个问题。

    【讨论】:

    • 重读SBT文档后,我认为错误是使用test-only而不是testOnly。 TestOnly(带引号的参数)完全符合我们的要求,并且回去尝试 gourlaysama 的建议也有效。谢谢!
    • @user1697841 尽可能使用testOnlytest-only 是旧语法(在 sbt 0.13 之前),testOnly 是新语法(仅在 sbt 0.13+ 中支持)。旧的仍然支持向后兼容,但总有一天会消失。
    猜你喜欢
    • 2014-07-26
    • 2015-07-10
    • 2014-04-28
    • 2019-06-09
    • 2016-01-20
    • 2015-09-09
    • 2013-03-23
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多