2016-03-08 64 views
1

我想做一些自定义任务来运行测试(scalatest)的标记。例如:现在我可以在SBT控制台运行此:自定义sbt任务运行测试标记

sbt test-only -- -n UnitTests 

我希望排除测试运行此做这样的事情

sbt test-unit // or something like that 

我也想做同样的

SBT测试只 - -l ExternalTests

到:

sbt test-exclude-external 

为了完成我试图创建一个自定义SBT任务......但我不知道该怎么办了-- -l东西

val testUnit = taskKey[Unit]("Launch unit tests") 
testUnit := { 
    // sbt test-only -- -n UnitTests 
    //(test in Test) 
} 

这将是有用的,如果我也可以运行通过命名空间测试在自定义的SBT任务:

sbt testOnly integration.actors.* 

你能帮助我的家伙?我有点新手与SBT :(

回答

1

fullInput不能很好地与“试验”工作。我终于做到了这一点:

val unit = taskKey[Unit]("Launch unit tests") 
unit := { 
    (testOnly in Test).toTask(s" com.trololo.unit.*").value 
}