How to run all tests in a particular package with Maven?

后端 未结 9 1558
别跟我提以往
别跟我提以往 2021-01-30 02:18

I can find in the Maven docs where it shows how to run:

  1. A single test
  2. All tests in a single test class
  3. All tests in classes matching a particular
9条回答
  •  执笔经年
    2021-01-30 02:46

    You can take fererence from following scenarios:

    (1) Skip all test execution during maven build

    mvn package -DskipTests
    

    (2) Execute All test cases

    mvn test
    

    (3) Execute specific test group

    mvn test -DincludeGroups=TestGroup1,TestGroup2
    

    (4) Exclude specific test group during execution

    mvn test -DexcludeGroups=TestGroup3,TestGroup4
    

    (5) Execute specific package testcases

    mvn test -Dtest="test.java.com.service.map.**"
    

    (6) Execute specific test

    mvn test -Dtest=Test1,Test2
    

    I hope it will be more helpful to you with different combination of execution.

提交回复
热议问题