【问题标题】:Scalatest Spec output in EclipseEclipse 中的 Scalatest Spec 输出
【发布时间】:2012-01-08 20:30:18
【问题描述】:

我在 Eclipse 中使用 Scala 测试规范和 JunitTestRunner。规范输出在哪里?有没有办法将它路由到控制台?

例如:

  val p = new SQLParser
  describe("given a sql string with an order clause") {
     describe("(when direction is asc)") {
        val sql = "select name from users order by name asc"
        it("should be parsed into an Asc object containing the given field") {
           val query = p.parse(sql).get
           query.operation should be (Select("name"))
           query.from should be (From("users"))
           query.order should be (Option(Asc("name")))
        }
    }
 }

只给我第一个“描述”的规范输出。

这就是你想要的一切,但我希望看到这一切。

【问题讨论】:

    标签: scala scalatest scala-ide


    【解决方案1】:

    输出出现在 JUnit 视图中。如果我使用:

    import org.scalatest.Spec
    import org.junit.runner.RunWith
    import org.scalatest.junit.JUnitRunner
    
    @RunWith(classOf[JUnitRunner])
    class ExampleSpec extends Spec {
    
      describe("A Stack") {
    
        it("should pop values in last-in-first-out order")(pending)
    
        it("should throw NoSuchElementException if an empty stack is popped")(pending)
      }
    
    }
    

    然后作为 JUnit 运行,我从 JUnit 视图中得到以下输出:

    这不是你想要的吗?

    【讨论】:

      猜你喜欢
      • 2011-09-10
      • 1970-01-01
      • 1970-01-01
      • 2012-04-04
      • 2014-10-07
      • 2015-06-10
      • 2012-11-15
      • 2023-03-10
      • 2016-08-04
      相关资源
      最近更新 更多