• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Excluding methods from a test case

 
Shameer Kunjumohamed
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, can anybody tell me how can I exclude some methods in a TestCase ? My understanding is that, All the other methods in a TestCase except setup, tearDown and suite will be called as tests by the framework.

Thanks in advance.
 
Ernest Friedman-Hill
author and iconoclast
Marshal
Pie
Posts: 24211
35
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you're letting JUnit collect the tests from a class, it will only collect those with no arguments with a name like testXXX (for any value of XXX).
 
Shameer Kunjumohamed
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you Freind
 
Ilja Preuss
author
Sheriff
Posts: 14112
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Ernest Friedman-Hill:
If you're letting JUnit collect the tests from a class, it will only collect those with no arguments with a name like testXXX (for any value of XXX).


I think they also need to have "void" as return type.
 
Lasse Koskela
author
Sheriff
Posts: 11962
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
And they must be public.
 
Lasse Koskela
author
Sheriff
Posts: 11962
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I had to check...

SimpleTestCollector and ClassPathTestCollector apply the following rule to determine whether to execute the given class as a JUnit TestCase:

while the LoadingTestCollector also looks at the access modifiers and interface before attempting to execute the class:
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic