| Author |
@Test equivalent on Junit 3?
|
Akhilesh Trivedi
Ranch Hand
Joined: Jun 22, 2005
Posts: 1493
|
|
I use annotation
to control which tests to be executed on Junit4.
For some reason, I have to be on java 1.4 and hence I am restricted on JUnit 3.
How do I have the above control as handy in JUnit 3, because on 1.4 annotations are not supported.
|
Keep Smiling Always — My life is smoother when running silent. -paul
[FAQs] [Certification Guides] [The Linux Documentation Project]
|
 |
Jaikiran Pai
Marshal
Joined: Jul 20, 2005
Posts: 8142
|
|
From what I remember any method that started with the test prefix was considered a test method. Example:
|
[My Blog] [JavaRanch Journal]
|
 |
Akhilesh Trivedi
Ranch Hand
Joined: Jun 22, 2005
Posts: 1493
|
|
That's right.
But I am talking about when we have more than one test method and we selectively want to run one/some of them.
On Junit 4
will run both testMethod1() and testMethod2()
And
will run only testMethod1().
In above case it will run only testMethod2().
How to achieve this control with ease on JUnit3.
|
 |
E Armitage
Ranch Hand
Joined: Mar 17, 2012
Posts: 220
|
|
|
Changing the method name from testXXX to atestXXX could be viewed as just as easy as commenting out an annotation.
|
 |
Junilu Lacar
Bartender
Joined: Feb 26, 2001
Posts: 4115
|
|
Aside from renaming your test methods, you can create a TestSuite that only includes the tests you want to run.
BTW, in JUnit4, use the @Ignore annotation to temporarily disable a test instead of commenting out the @Test annotation
When you use the @Ignore annotation, JUnit will report that there are ignored tests. If you just comment out the @Test annotation, JUnit will not say anything and it's easy to forget to uncomment later.
|
Junilu - [How to Ask Questions] [How to Answer Questions] [MiH]
|
 |
Akhilesh Trivedi
Ranch Hand
Joined: Jun 22, 2005
Posts: 1493
|
|
Junilu Lacar wrote:Aside from renaming your test methods, you can create a TestSuite that only includes the tests you want to run.
Any references?
|
 |
Junilu Lacar
Bartender
Joined: Feb 26, 2001
Posts: 4115
|
|
Akhilesh Trivedi wrote:Any references?
Any search engines? SearchFirst - JUnit 3 testsuite examples should turn up something
|
 |
 |
I agree. Here's the link: jrebel
|
|
subject: @Test equivalent on Junit 3?
|
|
|