Return-Path: Delivered-To: apmail-harmony-dev-archive@www.apache.org Received: (qmail 13052 invoked from network); 19 Dec 2006 18:16:23 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 19 Dec 2006 18:16:23 -0000 Received: (qmail 74529 invoked by uid 500); 19 Dec 2006 18:16:28 -0000 Delivered-To: apmail-harmony-dev-archive@harmony.apache.org Received: (qmail 74429 invoked by uid 500); 19 Dec 2006 18:16:27 -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 74420 invoked by uid 99); 19 Dec 2006 18:16:27 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 19 Dec 2006 10:16:27 -0800 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (herse.apache.org: domain of ivan.g.popov@gmail.com designates 66.249.92.170 as permitted sender) Received: from [66.249.92.170] (HELO ug-out-1314.google.com) (66.249.92.170) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 19 Dec 2006 10:16:17 -0800 Received: by ug-out-1314.google.com with SMTP id z36so1527795uge for ; Tue, 19 Dec 2006 10:15:55 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=iLG7PGWkAayOWik26RQMIkoFXTb2snXJGV3aYiB2dVmWdrBMIHtXYX8YF/IYleZ3l/iyPQ/gmASH+1QmUq8i3k5R+xAJQYSbsKpAR+0PGzien48+UZx4C6mNYXHcxZvgUQ7kmFjTigOUteQNtlq1NZVoQE6IgDrmg6sI6p0TJpQ= Received: by 10.82.105.13 with SMTP id d13mr1220435buc.1166552155271; Tue, 19 Dec 2006 10:15:55 -0800 (PST) Received: by 10.82.167.14 with HTTP; Tue, 19 Dec 2006 10:15:55 -0800 (PST) Message-ID: Date: Wed, 20 Dec 2006 00:15:55 +0600 From: "Ivan Popov" To: dev@harmony.apache.org Subject: Re: [general] JUnit consistency, practices In-Reply-To: <458807A7.2040705@pobox.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <32CD23D8C6B1454C9120C1525D521D67857230@nnsmsx411.ccr.corp.intel.com> <457EE0E4.8040208@googlemail.com> <458807A7.2040705@pobox.com> X-Virus-Checked: Checked by ClamAV on apache.org +1 On 12/19/06, Geir Magnusson Jr. wrote: > My POV is that people don't have to create them, but if someone put one > in because for whatever reason, they found it useful, leave it alone if > it's not getting in the way > > geir > > Alexei Fedotov wrote: > > Folks, > > Have we decided anything consistent about having main() method in > > JUnit tests? I've just created one test. Should I add a main() method? > > > > Any decision is better than no decision. > > > > > > On 12/12/06, Oliver Deakin wrote: > >> That's great, thanks Sveta. Yes, I think this is definitely something to > >> add to the main > >> website eventually - a full set of instructions (expanding the current > >> links to mail > >> archives into their complete command lines etc.) would be really useful > >> for any > >> first time Harmony developer (and some of us longer lived ones ;) ) > >> > >> Regards, > >> Oliver > >> > >> Konovalova, Svetlana wrote: > >> > I've just created the "Running the Classlib Tests" page [1], so that > >> you > >> > could share your experience there :) > >> > > >> > In the future we could add this stuff to the web-site, let's say, to > >> the > >> > testing page [2], where certain package-specific conventions are > >> > proposed, but nothing is said about JUnit tests. > >> > What do you think? > >> > > >> > [1] http://wiki.apache.org/harmony/RunningTheClasslibTests > >> > [2] http://harmony.apache.org/subcomponents/classlibrary/testing.html > >> > > >> > Best regards, > >> > Sveta > >> > > >> > -----Original Message----- > >> > From: Geir Magnusson Jr. [mailto:geir@pobox.com] > >> > Sent: Wednesday, December 06, 2006 4:32 PM > >> > To: dev@harmony.apache.org > >> > Subject: Re: [general] JUnit consistency, practices > >> > > >> > +1 > >> > > >> > Konovalova, Svetlana wrote: > >> > > >> >> IMHO we can start collecting info about running the classlib tests. > >> >> I suggest to create a new wiki page, let's say, "Running The Classlib > >> >> Tests" and add a link to it front the wiki front page > components > > >> >> class library. > >> >> ASA we get the clear picture of this issue and verify all the ways to > >> >> run tests, we'll be able to post this info on the web-site. > >> >> Want do you think? > >> >> I'd be glad to help. > >> >> > >> >> Best regards, > >> >> Sveta > >> >> > >> >> -----Original Message----- > >> >> From: Alexei Zakharov [mailto:alexei.zakharov@gmail.com] > >> >> Sent: Tuesday, December 05, 2006 5:25 PM > >> >> To: dev@harmony.apache.org > >> >> Subject: Re: [general] JUnit consistency, practices > >> >> > >> >> +1 for having the doc. But personally I don't know the way how to run > >> >> tests from the particular test class (not to speak of individual test > >> >> methods) using the current build system. So I don't really know what > >> >> exactly should be copy/pasted. Or you was talking about by-hand test > >> >> invocation cmd mentioned above? > >> >> > >> >> Thanks, > >> >> > >> >> 2006/12/5, Tony Wu : > >> >> > >> >>> Agree! When I tried harmony on some applications, I found it is very > >> >>> hard to run the test of application mainly because there is no > >> >>> instruction for that at all. So I think it is also not very easy for > >> >>> user who have interest to run tests of harmony. And a good > >> >>> > >> > instruction > >> > > >> >>> may be good for having many user's help to run harmony tests on > >> >>> various platforms. > >> >>> > >> >>> On 12/4/06, Oliver Deakin wrote: > >> >>> > >> >>>> Perhaps some kind of "How To Run The Classlib Tests" section on > >> >>>> the website would be useful? (Assuming there isn't already one with > >> >>>> this information in) Then none of us would have to remember - it > >> >>>> would be right there to copy/paste :) > >> >>>> > >> >>>> Regards, > >> >>>> Oliver > >> >>>> > >> >>>> > >> >>>> 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. > >> >>>>> > >> >>>>> 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 > >> >>>>>>>> > >> >>>>>>>> > >> >>>> -- > >> >>>> Oliver Deakin > >> >>>> IBM United Kingdom Limited > >> >>>> > >> >>>> > >> >>>> > >> >>> -- > >> >>> Tony Wu > >> >>> China Software Development Lab, IBM > >> >>> > >> >>> > >> >> > >> > > >> > > >> > >> -- > >> Oliver Deakin > >> IBM United Kingdom Limited > >> > >> > > > > >