0

I am using command like mvn -q -Dtest=MyJUnitTestClassName#runSingleTest testas per maven & junit documentation it should run ONLY the runSingleTest test method. but problem is all tests are running.

I am using maven3 and junit4.

mvn -q  -Dtest=MyJUnitTestClassName#runSingleTest test
elolelo
  • 774
  • 2
  • 14
  • 25
PGK
  • 131
  • 2
  • 11
  • 1
    The name of the class does not follow the naming convention like `*Test.java` ..apart from that I doubt that things are running... – khmarbaise Sep 12 '19 at 19:14
  • I tried both. i.e. giving fully qualified classname , still somehow it runs ALL methods in that class. – PGK Sep 13 '19 at 04:30

1 Answers1

0

Try quotes around your class and test (i.e. -Dtest="MyJUnitTestClassName#runSingleTest"). I use Maven 3.3 and JUnit 4 and the syntax you listed works for me, but that behavior sounds similar to issues with some versions of the SureFire plugins.

Run a single test method with maven

TomC
  • 11
  • 2
  • Thanks for answer, but it didn't work. I still notice all methods are executed (or tested) – PGK Sep 12 '19 at 23:28