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

后端 未结 9 1557
别跟我提以往
别跟我提以往 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:47

    It may not be the best answer, but you could run a single TestSuite (which is a Test) which includes all the test you want in one package.

    0 讨论(0)
  • 2021-01-30 02:48

    It can also be done by

    mvn clean test -Dtest="**/service/**/*.java"
    

    eg: I am in my /home/repository and I want to run tests on /home/repository/service folder only

    Here service folder is inside my current folder.

    0 讨论(0)
  • 2021-01-30 02:53

    Had the same problem (how to run all tests in a particular package) and tried many ways, two commands that worked were:

    mvn -Dtest=com.package.my.package.** test
    
    mvn -Dtest=com.package.my.package.**.* test
    
    0 讨论(0)
提交回复
热议问题