specs2Scala 软件测试库

联合创作 · 2023-10-01 18:27

Specs2是一个用于编写可执行软件说明的Scala库。可以用它来编写可知性测试和性能测试。

示例代码:

  import org.specs2.mutable._

  class HelloWorldSpec extends Specification {

    "The 'Hello world' string" should {
      "contain 11 characters" in {
        "Hello world" must have size(11)
      }
      "start with 'Hello'" in {
        "Hello world" must startWith("Hello")
      }
      "end with 'world'" in {
        "Hello world" must endWith("world")
      }
    }
  }

 

浏览 7
点赞
评论
收藏
分享

手机扫一扫分享

编辑
举报
评论
图片
表情
推荐
点赞
评论
收藏
分享

手机扫一扫分享

编辑
举报