Re: passing arguments to test case while adding them to test suite

"Stefan Bechtold [email protected] [junit]" <[email protected]> Tue, 25 Nov 2014 07:11:40 +0100
Newsgroups gmane.comp.java.junit.user
Message-ID <[email protected]>
Hi,

I am wondering if you have had a look at the parametrized runner of junit:
https://blogs.oracle.com/jacobc/entry/parameterized_unit_tests_with_junit

Also you might be interested in JUnit Data Provider Plugin:
https://github.com/TNG/junit-dataprovider

Nevertheless, do you really require the test method to have arguments?
How about creating a test method without arguments that simply calls your "tests" with parameters that you want to have?
I know that this way you have the downside, that the first failing test will stop processing, but maybe that is enough for your use-case?

All the best,

Stefan Bechtold

Am 24.11.2014 um 20:49 schrieb Manan Patel [email protected] [junit] <[email protected]>:

> 
> Is it the myClass that you want to pass in parameter or you want to pass another class
> 
> Sent from my iPad
> 
> On 24-Nov-2014, at 10:29 am, "[email protected] [junit]" <[email protected]> wrote:
> 
>>  
>> 
>> hi all,
>> 
>> 
>> 
>> i need help on passing arguments to a test case when i am adding it to test suite.
>> 
>> for example:
>> 
>> 
>> 
>> myClass has a method testingMethod(String arg1, String arg2) which takes 2 arguments as input.
>> 
>> now i am adding myClass to a test suite using suite.addTest(myClass.class).
>> 
>> 
>> 
>> i need to pass 2 string arguments also along with the class name so that the method testingMethod receives the parameter values.
>> 
>> 
>> 
>> Kindly help me on this topic.
>> 
>> Thanks in advance.
>> 
>> Ishan
>> 
>> 
> 
> 



[Non-text portions of this message have been removed]



------------------------------------
Posted by: Stefan Bechtold <[email protected]>
------------------------------------