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

"David Saff [email protected] [junit]" <[email protected]> Thu, 27 Nov 2014 19:55:05 -0500
Newsgroups gmane.comp.java.junit.user
Message-ID <CALrw-PxELNCXsHVXxPfahiTH+p979LeHJKeo7XJ4=3rKPR3HVw@mail.gmail.com>
The reason I asked if you needed to call it repeatedly is that if you had a
method foo(x, y), and just needed to call it once, I would just call it
from a separate test method:

@Test
public void testFoo() {
  assertEquals(someValue, foo(3, 5));
}

Even if you have a small number of ways you want to call it, this can be
scalable:

@Test public void testFooOn3And5() {
  assertEquals(someValue, foo(3, 5));
}

@Test public void testFooOn6and6() {
   assertEquals(anotherValue, foo(6, 6));
}

etc.

Until you get above 5 or 6 different parameter groups, this is probably
less work than any of the existing automated parameterized testing
techniques.

   David Saff

On Tue, Nov 25, 2014 at 4:09 AM, ishan gupta [email protected]
[junit] <[email protected]> wrote:

>
>
> hi,
>
> i need to use the two parameters directly. Just like a normal function
> call.
>
>
>
>   On Monday, November 24, 2014 10:33 PM, "David Saff [email protected]
> [junit]" <[email protected]> wrote:
>
>
>
>  First question is, do you need to use the test method with two
> parameters directly?  Are you calling it multiple times with different
> parameters, or just once?  Thanks,
>
>    David Saff
>
> On Sun, Nov 23, 2014 at 11:59 PM, [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
>
>
>
>
>    
>