tags:

views:

206

answers:

2

Hi I am using junit for unit testing. I am using Eclipse. I have given 12 test cases that is 12 different functions. When I right click on the paticular function in Outline and give RunAS--->Junit Test it is executing all the test cases. How to overcome this ? I just want to run only one test case or one function !!!

Any idea ?

+1  A: 

The following page has discussion on this issue, specifically versions and changes to JUnit 4, etc.

http://srivaths.blogspot.com/2009/04/run-single-junit-test-method-in-eclipse.html

You'd need to give more information regarding versions etc if you need more help but as that discussion suggests, in JUnit 4 it works if you don't extend junit.framework.TestCase.

polygenelubricants
A: 

I know two ways of just running one

1)
Click in the method name of the test you want to run.
The method name will now become marked in a special color ( for me, it's gray ).
While the method name is marked, right click and select "Run as JUnit Test".
That should do it.

2)
Run all your tests once.
In the JUnit windows, right click the test you want to run and select "Run as JUnit Test".

This works, for me, both in Eclipse 3.5.1 and SpringSource Tool Suite 2.3.0

Hope this helps

Jonas Söderström