Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

send parameters from test suite to test case in junit 4

I've got four junit cases and I need to pass them a parameter, that is the same for all of them, but this parameter is created in a dynamic way in the test suite. How can I pass a parameter from the test suite to all the tests in the test case?

like image 673
Alexander Herrera Avatar asked Sep 21 '11 14:09

Alexander Herrera


1 Answers

If its just a string parameter, you can set the System Property and access it in test cases.

If you want to programmatically do it, you can do it at one place System.setProperty("x","123"); otherwise you can always pass System properties from command line as -Dx=123.

like image 161
kdabir Avatar answered Oct 05 '22 05:10

kdabir