harmony-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Alexei Fedotov" <alexei.fedo...@gmail.com>
Subject Re: [general] JUnit consistency, practices
Date Wed, 29 Nov 2006 14:11:24 GMT
Ivan, Stepan,

I personally set +1 for removing main() method. Any script or command
line can be trivially modified to launch JUnit tests without main()
method: one should just add junit.textui.TestRunner class before a
test class name.

$ java -cp junit.jar junit.textui.TestRunner TestClass

I'm writing this trivial thing here because during our work on class
library test enabling it was FAQ N1 for all C/C++ developers.

Note, any JUnit test won't work without junit.jar anyway. If you have
junit.jar, you have a standard test runner, which is also quite

Thank you,

On 11/29/06, Ivan Popov <ivan.g.popov@gmail.com> wrote:
> -1 for removing main().
> I often run individual tests from command line or using scripts and
> it's easier to launch them as a usual Java application. Also, this
> facilitates creating separate bundle with test to attach to a bug
> report or send to other people, who can just run it from command line
> or use script with the all required options already specified, instead
> of setting IDE for this test.
> Thanks.
> Ivan
> On 11/29/06, Nathan Beyer <nbeyer@gmail.com> wrote:
> > There is a large amount of inconsistency across the tests and I'd like
> > to lobby for cleaning them up as much as possible. I'm of the opinion
> > that test code should be clean, simple and transparent. Here are some
> > of the more noticeable items that I'd like to cleanup.
> >
> > * Empty setUp/teardown methods - There are a number of tests that
> > override setUp and/or teardown methods, but are either empty or just
> > call the super implementation.
> >
> > * Singleton suite methods - There are some tests that contain a static
> > "suite" method that creates a TestSuite and adds one test (the test
> > class it's declared in). Are there any practical uses for these
> > methods? TestSuites are for grouping together tests to treat them as
> > one unit. Since these suites are just one test, it doesn't seem to
> > provide much value.
> >
> > * main method launching text runner - There are some tests that
> > contain "main" methods which run the enclosing test via a JUnit text
> > runner. Most IDEs have built-in support for JUnit and can launch any
> > test arbitrarily and Ant can do the same thing. Does anyone launch
> > tests via these methods?
> >
> > My proposal would be to clean up these inconsistencies by eliminating
> > them, but what does everyone else think?
> >
> > -Nathan
> >

View raw message