Issue
I have recently been using junit in eclipse and I am still learning. I know how to pass command line parameters in eclipse, but how do I pass them to a test case in Junit? Also how do I access them?
Solution
You cannot pass command line arguments to the JUnit test because no main method is run. You will need to use system properties and access these in your test case.
Select your test class in the Package Explorer view. Right click and select Run As -> Open Run Dialog In the run dialog window there is an Arguments tab where you can specify Program arguments and VM arguments. You should be able to enter your system property parameters here.
Alternatively, with the desired project as your current one, from the main menu select Run -> Run Configurations to access the Arguments tab.
Answered By - Mark
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.