[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
RE: [stellation-res] Work merging Unit tests
|
> >-----Original Message-----
> >From: stellation-res-admin@xxxxxxxxxxxxxxx
> >[mailto:stellation-res-admin@xxxxxxxxxxxxxxx]On Behalf Of Mark C.
> >Chu-Carroll
> >Sent: December 31, 2002 3:29 PM
> >To: Stellation-res
> >Subject: RE: [stellation-res] Work merging Unit tests
> >
> >
> >On Mon, 2002-12-30 at 07:09, DeSmet_Ringo@xxxxxxx wrote:
> >> Mark,
> >>
> >> > What I'd like to do is propose adding a new master test runner, which
> >> > will run all of the suites in the unittest project. To do this, we
> >> > would add a method "static void addTests(TestSuite suite)" to each
> >> > of the unit tests; and the current "suite" method in each of the
> >> > current test suites would be replaced with boilerplate:
> >> >
> >> > public static TestSuite suite() {
> >> > TestSuite result = new TestSuite();
> >> > addTests(result);
> >> > return result;
> >> > }
> >> >
> >> > Then, in the master unit test class, when you add a suite,
> >> > you just add
> >> > one line to its "suite" method, to call the "addTests" method of
> >> > your new test suite class.
> >>
> >> So in the end, you have two methods in each test class, the
> >suite method and
> >> the addTests method, right?
> >>
> >> For quite some time now, I have the habit of only writing a
> >suite method and
> >> adding sub-suites to it in there:
> >>
> >> public static Test suite() {
> >> TestSuite suite = new TestSuite(ThisClass.class);
> >> suite.setName("A descriptive name, something better than the
> >> classname");
> >>
> >> suite.addTest(SubSuiteClass.suite());
> >> // Add other subsuites here.
> >> }
> >>
> >> You only have one method per class where to look. Giving a
> >Class object to
> >> the TestSuite constructor will let it detect all test methods through
> >> reflection. Using the suite method in both master and sub
> >suites gives you
> >> the opportunity to run any suite you like. E.g. if you use the
> >Eclipse JUnit
> >> test runner on a sub suite, it will build the sub suite using the suite
> >> method, not through the addTests method.
> >>
> >> Setting a more readable name is always nice in test runners
> >like the Swing
> >> GUI test runner and the Eclipse JUnit test runner. You will see nice
> >> categories with a clean name...
> >
> >OK. I agree that being able to name suites is useful. I do make heavy
> >use of the individual test names, and there's a lot of value there.
> >
> >But what I'd really like is an easy-to-use way to run multiple suites
> >together, as a comprehensive test. And there's a compromise there: you
> >do lose the ability to name suites; you do lose the ability to
> >automatically generate the suite using introspection; you have to write
> >your own suite methods that work by manually adding tests.
> >
> >I'm far from an expert on JUnit, so there's a fairly good chance that
> >there's a better way of doing what I want without making these
> >compromises. Do you know a better way of using JUnit to merge the suites
> >together into one comprehensive suite, while still retaining the ability
> >to run them individuality?
> >
> > -Mark
> >
I have seen something on this on the Junit mailing list. I will check my
archives when I get to work tomorrow.
Regards
Jonathan
Peersonal Email
jgossage@xxxxxxxx
Business Email
jonathan@xxxxxxxxxxxxxx