- I have a feeling I'm about to bring up a much discussed topic,
however, I wasn't able to find any related topics by searching this
mailing list. My apologies in advance if this has been hashed out before.
While generally thinking that its not a great idea, I occasionally
come into a situation where I genuinely need to partition my tests
into more than one group or partition or suite. The latest example is
with a client who has many unit style tests as well as a number of
tests which require specific network connectivity only available from
a subset of machines (the outgoing requests must come from a specific
ip address). We call these the "online tests".
We want to be able to group our tests into two groups, "unit tests"
and "online tests". In some case we want to run only "unit tests" or
only "online tests", and in other cases we want to run both (or all).
I understand that this functionality is available using JUnit 4's
@RunWith(Suite.class) and @SuiteClasses(TestClass1.class, ...).
However, manually adding test classes to a suite is clunky because the
list of test classes becomes huge. It's also error prone; it's easy
for developers to write a test but forget to add it to @SuiteClass.
Lastly, test runners will run test in suites multiple times when told
to "run all tests". That's hardly the desired behavior.
What I really would like to see is the concept of suite (or group in
TestNG terms) be promoted to a first class citizen. Honestly, I think
I would prefer it to be at the test class level (unlike TestNG which
is at the test method level), since the mechanism should be used for
high-level organization IMHO.
Is there any chance something like this might make its way into JUnit?
What can I do to help?
- I have some related request, see