• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

How to categorize my tests?

 
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi friends,
I decided to categorize my tests into 4 not necessarily disjoint sets:

1. unit tests : Quicky unit tests
2. slow tests: unit tests that does not run enough fast for continuous builds
3. acceptance tests
4. all tests: Including all categories I mentioned before.

Now what is the best way to define these categorization in your opinion? some options may be:
1. different folders for each one
2. differentiation in names (e.g. MyClassSlowTest or MyClassAcceptanceTest ....)
3. using annotations in source to specify each category (e.g. @slow says to ant that this is not a needed tests in run-fast-unit-tests target...)
4. using a properties/config file (Oh I should remember to edit this each time I add a test, sough)
5. a combination of some of the above ways!!!

Now please share your valuable opinions with me. Your notes are so appreciated
 
author
Posts: 11962
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Are you using JUnit for all of these tests? Which version?
 
Ashkan Roshanayi
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
Yes I use junit 3.8.1 (b/c last time I watched ant 1.6.5 does not support junit 4 yet) + EasyMock 2.2 for most of our logic testing.
There are other people to test performance (junitperf) and scalibilty and usability with proper tools.
Any idea? Thanks
 
Lasse Koskela
author
Posts: 11962
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You could write an abstract base class for your test classes to extend from, which would extend junit.framework.TestCase and override the appropriate runXXX method to skip executing tests if the class implements a certain "marker interface".

The problem then becomes that you are not able to run e.g. only fast tests from the comfort of your IDE. The only way I can think of right now for implementing the categorization in both build scripts and the IDE is 1) different source trees or 2) a set of dynamic test suite classes (i.e. scan through all .class files, try to load the class with Class#forName, and figure out whether it implements some specific interface).
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic