harmony-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Alexey Varlamov" <alexey.v.varla...@gmail.com>
Subject Re: [general] JUnit consistency, practices
Date Thu, 30 Nov 2006 03:40:55 GMT
2006/11/29, Alexei Zakharov <alexei.zakharov@gmail.com>:
> Hi,
>
> > * Empty setUp/teardown methods
>
> +1
>
> > * 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.
>
> Well, suite() method is very useful when you are trying to find the
> reason of the individual test method failure. It is simpler to debug
> (add debug logs for example) to a single code path rather than to run
> through 60 tests methods before you reach the desired break point. If
> you have the suite() method all you need is just to add the following
> line:
> suite.addTest(new MyTest("testReallyHotIssue"));

Just FYI: junit4 provides cmd-line support for running single test
method. So the equivalent to the above is:
$ java -cp junit-4.0.jar junit.textui.TestRunner -m MyTest.testReallyHotIssue

> So I would suggest to leave suites as it is for now.
>
> > * main method launching text runner
>
> I'm neutral here. We (probably) can always run
>  java junit.textui.TestRunner MyClass
> instead of
> java MyClass.
>
> Thanks,
>
> 2006/11/29, Nathan Beyer <nbeyer@gmail.com>:
> > 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?
>
>
> --
> Alexei Zakharov,
> Intel Enterprise Solutions Software Division
>

Mime
View raw message