Junit Framework

View: New views
4 Messages — Rating Filter:   Alert me  

Junit Framework

by ashishsoni2u :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi

Is anyone knows how to get the current executing test method name in the setup method before executing the test method in Junit 3.8.

Thanks in Advance.

Ashish Soni


Re: Junit Framework

by Mike Forsberg :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

You really should upgrade...

Here is the code, hope I'm not doing your homework.

package org.junit.sample3_8_2;

import junit.framework.TestCase;

public class NameTest extends TestCase {

        public void setUp() {
                System.out.println(getName());
        }
       
        public void testA() {
                System.out.println("I'm in testA");
        }
       
        public void testB() {
                System.out.println("I'm in testB");
        }
}

On Sun, Sep 27, 2009 at 12:55 PM, ashishsoni2u <ashishsoni4u@...> wrote:

> Hi
>
> Is anyone knows how to get the current executing test method name in the setup method before executing the test method in Junit 3.8.
>
> Thanks in Advance.
>
> Ashish Soni
>
>
>
> ------------------------------------
>
> Yahoo! Groups Links
>
>
>
>

Re: Junit Framework

by Mike Forsberg :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I'm sorry, that was a very honest and truthful question.  The API for
JUnit 3.8 is hard to find.

It is here: http://www.junit.org/junit/javadoc/3.8.1/

Your method specifically is here:
http://www.junit.org/junit/javadoc/3.8.1/junit/framework/TestCase.html#getName()

I should not reply to e-mail sooo late in my timezone.

On Sun, Sep 27, 2009 at 11:06 PM, Mike Forsberg <bigmike@...> wrote:

> You really should upgrade...
>
> Here is the code, hope I'm not doing your homework.
>
> package org.junit.sample3_8_2;
>
> import junit.framework.TestCase;
>
> public class NameTest extends TestCase {
>
>        public void setUp() {
>                System.out.println(getName());
>        }
>
>        public void testA() {
>                System.out.println("I'm in testA");
>        }
>
>        public void testB() {
>                System.out.println("I'm in testB");
>        }
> }
>
> On Sun, Sep 27, 2009 at 12:55 PM, ashishsoni2u <ashishsoni4u@...> wrote:
>> Hi
>>
>> Is anyone knows how to get the current executing test method name in the setup method before executing the test method in Junit 3.8.
>>
>> Thanks in Advance.
>>
>> Ashish Soni
>>
>>
>>
>> ------------------------------------
>>
>> Yahoo! Groups Links
>>
>>
>>
>>
>

Re: Junit Framework

by michaellufhl :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

--- In junit@..., "ashishsoni2u" <ashishsoni4u@...> wrote:
>
> Hi
>
> Is anyone knows how to get the current executing test method name in the setup method before executing the test method in Junit 3.8.
>
> Thanks in Advance.
>
> Ashish Soni
>

Call this.getName() in setUp method.

Michael