English 中文(简体)
为SBT中的多个测试文件夹设置操作
原标题:Setting up actions for multiple test folders in SBT

关于上一个问题,我希望有多个测试文件夹用于不同类型的测试,并能够使用单独的SBT操作。

例如,一个操作测试单元将只运行src/test/scala/unit文件夹下的测试,而一个测试功能操作将只运行<em>src/test/stcala/functional下的测试。我们将如何制定行动来做到这一点?

问题回答

如果您使用xsbt0.10.0,您可以轻松创建其他测试配置,通过在项目文件夹中的Scala文件中定义完整的构建配置。下面是集成测试的wiki示例。默认目录布局与您的有点不同,单元测试在src/test/Scala中,集成测试在src/it/Scala中。然后,您可以从控制台运行test执行ute单元测试或it:test用于集成测试。

import sbt._
import Keys._

object B extends Build
{
  lazy val root =
    Project("root", file("."))
      .configs( IntegrationTest )
      .settings( Defaults.itSettings : _*)
      .settings( libraryDependencies += specs )

  lazy val specs = "org.scala-tools.testing" %% "specs" % "1.6.8" % "it"
}




相关问题
How to flatten a List of different types in Scala?

I have 4 elements:List[List[Object]] (Objects are different in each element) that I want to zip so that I can have a List[List[obj1],List[obj2],List[obj3],List[obj4]] I tried to zip them and I ...

To use or not to use Scala for new Java projects? [closed]

I m impressed with Twitter and investigating to use Scala for a new large scale web project with Hibernate and Wicket. What do you think about Scala, and should I use it instead of Java? EDIT: And, ...

Why does Scala create a ~/tmp directory when I run a script?

When I execute a Scala script from the command line, a directory named "tmp" is created in my home directory. It is always empty, so I simply deleted it without any apparent problem. Of course, when I ...

Include jar file in Scala interpreter

Is it possible to include a jar file run running the Scala interpreter? My code is working when I compile from scalac: scalac script.scala -classpath *.jar But I would like to be able to include a ...

Scala and tail recursion

There are various answers on Stack Overflow which explain the conditions under which tail recursion is possible in Scala. I understand the limitations and how and where I can take advantage of tail ...