I have a maven project with junit tests classes. I want to run a tests in a specific class . how can i do that from the terminal ? for example i have a test spring junit test class named AccountServiceImplTest under the package com.openmind.service.impl . how can i run all or individual junit tests declared in this test class . I dont want to use mvn clean test as this run all the tests within the project. appreciate any help thank you so much
Asked
Active
Viewed 9,982 times
-4
-
3https://maven.apache.org/surefire/maven-surefire-plugin/examples/single-test.html – yegodm Dec 03 '18 at 14:27
-
mvn surefire:test -Dtest=com.openmind.primecast.service.impl.PrimecastAccountServiceImplTest shouldCreateAccount i tried this option however ERROR] Unknown lifecycle phase "shouldCreateAccount". You must specify a valid lifecycle phase or a goal in the format
: – Globe Admin Dec 03 '18 at 14:34or : [: ]: . Available lifecycle phases are: validate, initialize, generate-sources, proc
1 Answers
4
mvn -Dtest=TestCircle test
see https://maven.apache.org/surefire/maven-surefire-plugin/examples/single-test.html

MC Ninjava
- 214
- 2
- 7
-
1yes it works . i tried like this in my case mvn -X -Dtest=com.openmind.primecast.service.impl.PrimecastAccountServiceImplTest compile test to run a specific test mvn -X -Dtest=com.openmind.primecast.service.impl.PrimecastAccountServiceImplTest#shouldCreateAccount compile test – Globe Admin Dec 03 '18 at 16:00