0

Does anyone know how should I pass command line arguments to a testClass in JUnit?

Currently, I hard coded the path file in the test class but I want to pass the path file through the command line to the test class and read the file. Path file is shared between all of testCases. Also, I build the testCases with ANT. I need to pass the args to ant target as well.

Thanks in advance,

Ima Vafaei
  • 927
  • 1
  • 14
  • 32
  • 2
    This seems the same as this question: http://stackoverflow.com/questions/2884163/pass-command-line-arguments-to-junit-test-case-being-run-programmatically – ethanfar Jul 22 '14 at 06:34
  • I've tried to use JunitCore, but it doesn't have any addParameters(). I'm using Junit4 though. Finally, I had to use main method in test class to pass the parameters, but I have to run it as a JavaApplication rather than Junit class. I'm looking for a way to run Junit class and pass arguments. – Ima Vafaei Jul 31 '14 at 04:26

0 Answers0