Running single test class or group with Surefire and TestNG

前端 未结 4 1918
忘了有多久
忘了有多久 2021-02-14 09:10

I want to run single test class from command line using Maven and TestNG

Things that doesn\'t work:

mvn -Dtest=ClassName test

I have de

4条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2021-02-14 09:55

    In order to run a single test you need the following from official documentation

    mvn -Dtest=MyFirstTest test

    or

    mvn -Dtest=MyFirstTest,MySecondTest test

    This is tested (and working) on maven 3.

    Then you can avoid using the profiles. I had the same problem as I needed to run load test in isolation and using profiler in parallel to get the real figures.

    Note: Not sure why but make sure that the switches come before the phase i.e. "-Dtest=MyFirstTest" before "test" otherwise it is not working (Mac OSX)

提交回复
热议问题