通过maven命令行运行特定的scalatest测试

时间:2015-04-03 21:27:28

标签: scala maven scalatest

我有一个scalatest文件

// MyDefaultTest.scala
import collection.mutable.Stack
import org.scalatest._

class StackSpec extends FlatSpec {
  "A Stack" should "pop values in last-in-first-out order" in {
    val stack = new Stack[Int]
    stack.push(1)
    stack.push(2)
    assert(stack.pop() === 2)
    assert(stack.pop() === 1)
  }

  it should "throw NoSuchElementException if an empty stack is popped" in {
    val emptyStack = new Stack[String]
    intercept[NoSuchElementException] {
      emptyStack.pop()
    }
  }
}

我的项目使用Maven。我想,从命令行开始,只运行"堆栈应该以后进先出的顺序弹出值"

我该怎么做?

到目前为止,我只想出了如何运行文件:

  

mvn test -DwildcardSuites = com.package.whatever.MyStupidTest

scalatest has options for a single test,但那不是a maven command

0 个答案:

没有答案