【问题标题】:Selectively run tests in broken project using SBT使用 SBT 在损坏的项目中选择性地运行测试
【发布时间】:2011-03-30 02:45:27
【问题描述】:

this 关于在损坏的构建中运行 sbt 测试的问题之后,我如何增强下面的 just-test 操作,使其具有与仅测试类似的功能。 IE。 仅测试 *SomeTest

import sbt._

class Project(info: ProjectInfo) extends DefaultProject(info) {
  lazy val justTest = testTask(testFrameworks, testClasspath, testCompileConditional.analysis, testOptions)
}

【问题讨论】:

    标签: scala sbt


    【解决方案1】:

    这家伙应该做的伎俩:

    lazy val justTestOnly = testQuickMethod(testCompileConditional.analysis, testOptions)(
      o => testTask(testFrameworks, testClasspath, testCompileConditional.analysis, o)
    )
    

    它的作用与testOnly 相同——将任务创建转发给名为testQuickMethod 的助手。唯一的区别在于它在第二个参数列表中提供的函数 - 它使用测试选项o 使用testTask 方法创建Task,但没有在末尾附加dependsOn

    dependsOn 附加到testTask 可用于为此任务创建一些依赖项。

    【讨论】:

    猜你喜欢
    • 2011-07-03
    • 2021-09-30
    • 2023-01-08
    • 2014-11-15
    • 1970-01-01
    • 2013-12-07
    • 2023-03-20
    • 2014-11-05
    • 1970-01-01
    相关资源
    最近更新 更多