Play! framework: customize which tests are run

后端 未结 5 970
温柔的废话
温柔的废话 2021-02-13 15:11

I have a Play! 2 for Scala application, and I am using Specs2 for tests. I can run all tests with the test command, or a particular specification with test-on

5条回答
  •  北荒
    北荒 (楼主)
    2021-02-13 15:26

    First, following the specs2 guide one must add tags to the specifications, like this

    class MySpec extends Specification with Tags {
      "My spec" should {
        "exclude this test" in {
          true
        } tag ("foo")
    
        "include this one" in {
          true
        }
      }
    }
    

    The command line arguments to include are documented here

    Then one can selectively include or exclude test with

    test-only MySpec -- exclude foo
    test-only MySpec -- include foo
    

提交回复
热议问题