Return-Path: Delivered-To: apmail-harmony-dev-archive@www.apache.org Received: (qmail 9684 invoked from network); 29 Nov 2006 16:05:15 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 29 Nov 2006 16:05:15 -0000 Received: (qmail 43342 invoked by uid 500); 29 Nov 2006 16:05:18 -0000 Delivered-To: apmail-harmony-dev-archive@harmony.apache.org Received: (qmail 43307 invoked by uid 500); 29 Nov 2006 16:05:18 -0000 Mailing-List: contact dev-help@harmony.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@harmony.apache.org Delivered-To: mailing list dev@harmony.apache.org Received: (qmail 43298 invoked by uid 99); 29 Nov 2006 16:05:17 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 29 Nov 2006 08:05:17 -0800 X-ASF-Spam-Status: No, hits=1.4 required=10.0 tests=SPF_NEUTRAL X-Spam-Check-By: apache.org Received-SPF: neutral (herse.apache.org: 202.81.18.152 is neither permitted nor denied by domain of paulex.yang@gmail.com) Received: from [202.81.18.152] (HELO ausmtp04.au.ibm.com) (202.81.18.152) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 29 Nov 2006 08:05:03 -0800 Received: from sd0208e0.au.ibm.com (d23rh904.au.ibm.com [202.81.18.202]) by ausmtp04.au.ibm.com (8.13.8/8.13.5) with ESMTP id kATGGKdw235126 for ; Thu, 30 Nov 2006 03:16:22 +1100 Received: from d23av02.au.ibm.com (d23av02.au.ibm.com [9.190.250.243]) by sd0208e0.au.ibm.com (8.13.6/8.13.6/NCO v8.1.1) with ESMTP id kATG7wk6118782 for ; Thu, 30 Nov 2006 03:08:03 +1100 Received: from d23av02.au.ibm.com (loopback [127.0.0.1]) by d23av02.au.ibm.com (8.12.11.20060308/8.13.3) with ESMTP id kATG4Un9024194 for ; Thu, 30 Nov 2006 03:04:30 +1100 Received: from d23m0011.cn.ibm.com (d23m0011.cn.ibm.com [9.181.32.74]) by d23av02.au.ibm.com (8.12.11.20060308/8.12.11) with ESMTP id kATG4PIs024117 for ; Thu, 30 Nov 2006 03:04:29 +1100 Received: from [127.0.0.1] ([9.20.183.176]) by d23m0011.cn.ibm.com (Lotus Domino Release 6.5.5HF882) with ESMTP id 2006113000025043-10581 ; Thu, 30 Nov 2006 00:02:50 +0800 Message-ID: <456DAF90.6090504@gmail.com> Date: Wed, 29 Nov 2006 16:04:32 +0000 From: Paulex Yang User-Agent: Thunderbird 1.5.0.8 (Windows/20061025) MIME-Version: 1.0 To: dev@harmony.apache.org Subject: Re: [general] JUnit consistency, practices References: <3b3f27c60611281926s7d2816dam6d9c351150832632@mail.gmail.com> <200611291524.kATFOXh8018265@d06av02.portsmouth.uk.ibm.com> In-Reply-To: <200611291524.kATFOXh8018265@d06av02.portsmouth.uk.ibm.com> X-MIMETrack: Itemize by SMTP Server on D23M0011/23/M/IBM(Release 6.5.5HF882 | September 26, 2006) at 30/11/2006 00:02:51, Serialize by Router on D23M0011/23/M/IBM(Release 6.5.5HF882 | September 26, 2006) at 30/11/2006 00:02:57, Serialize complete at 30/11/2006 00:02:57 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=ISO-8859-1; format=flowed X-Virus-Checked: Checked by ClamAV on apache.org Mark Hindess wrote: > On 29 November 2006 at 20:34, "Ivan Popov" wrote: > >> Alexei, >> >> I agree that it is still possible to run JUnit tests from command line >> even without having main() in the code. But I think it is easier to >> run test by convenient way >> >> $ java -cp junit.jar TestClass >> >> rather than in a more complex manner >> >> $ java -cp junit.jar junit.textui.TestRunner TestClass >> >> Actually, I constantly forget the right spelling of the full class >> name for TestRunner class and have to look into JUnit doc to specify >> proper name for such a command line. >> >> Also, it would be inconvenient if >> someone runs test from an IDE that does not support JUnit environment, >> but launches test as a usual Java application. >> >> I don't insist on adding main() to each JUnit testcase, but I see no >> reason for removing this functionality from those test where it >> already exists. >> > > Whatever we do, main() should either be in all tests or none. Having it > in only a subset is *much* too confusing. > > I don't care if we have main() in testcases or not. (I personally will > never use it and don't find remembering[0] the junit test runner class.) > +1 to keep a consistent style. > Regards, > Mark. > > [0] I remember it by writing it in a shell script because I have a > terrible memory. > Thanks. > Ivan > > On 11/29/06, Alexei Fedotov wrote: > >>> 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 >>> lightweight. >>> >>> -- >>> Thank you, >>> Alexei >>> >>> On 11/29/06, Ivan Popov 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 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 >>>>> >>>>> > > > > -- Paulex Yang China Software Development Lab IBM