0

I'd like to run a specific test routine called T20 which is in the class UploadTest which is part of the test suite TestSuite (Junit4). There is a @BeforeClass in my test suite that I need to run before running T20.

Is it possible to do this with maven and Junit 4 ? If not, is there any other test framework that allows it ?

I tried :

mvn test -DtestSuite=TestSuite -Dtest=UploadTest#T20 

but it did not work.

abdev
  • 597
  • 4
  • 17
the duck
  • 375
  • 3
  • 13
  • Have you tried with maven surefire plugin? Check this http://maven.apache.org/surefire/maven-surefire-plugin/examples/single-test.html – dcalap Mar 24 '19 at 22:23
  • Yes, I've seen this page. It talks about running a unit test inside a test class but they don't explain how to do the same with test suites. – the duck Mar 24 '19 at 22:31
  • 1
    Workaround with profiles: https://stackoverflow.com/a/35009569/1230748 – dcalap Mar 24 '19 at 22:40
  • Thanks for the profile hint. It would certainly work. I used TestNG with various xml files instead and it fixed my problem. – the duck Apr 03 '19 at 19:38

0 Answers0