-2

I have a java main program. This program holds function main(String[] args). I have another program that holds function of Junit. Both are independent program and under different packages. After running methods from class (having main function), I want to transfer control to Junit class file (i.e. junit class file take control and run program according to @ annotation).

Is this possible?

Note:

  • JUnitCore() is not the option. It doesn't for my scenario.
  • I do not want to run Junit inside my main program. I want it to run as separate application.

Any other suggestions?

Jason C
  • 38,729
  • 14
  • 126
  • 182
Asvhini
  • 55
  • 6

1 Answers1

0

Yes, you can..

Create the object of org.junit.runner.JUnitCore and invoke the run method with argument as your class containing junit test cases. Invoke the run method when you want to transfer the control.

ajay_t
  • 2,347
  • 7
  • 37
  • 62