Return-Path: Delivered-To: apmail-harmony-dev-archive@www.apache.org Received: (qmail 72319 invoked from network); 29 Nov 2006 14:41:18 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 29 Nov 2006 14:41:18 -0000 Received: (qmail 21186 invoked by uid 500); 29 Nov 2006 14:41:05 -0000 Delivered-To: apmail-harmony-dev-archive@harmony.apache.org Received: (qmail 21145 invoked by uid 500); 29 Nov 2006 14:41:05 -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 21093 invoked by uid 99); 29 Nov 2006 14:41:05 -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 06:41:04 -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 alexei.fedotov@gmail.com designates 64.233.162.227 as permitted sender) Received: from [64.233.162.227] (HELO nz-out-0102.google.com) (64.233.162.227) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 29 Nov 2006 06:40:53 -0800 Received: by nz-out-0102.google.com with SMTP id j2so1037120nzf for ; Wed, 29 Nov 2006 06:40:32 -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=IttF+8nWsb/vBttS+zKKHPNjdoDteq6SRypPps20arXrFVVcfnRO6mpme6LwylalKhGT61dyB+r8gyqor2I9bZOMvpgKy4d7SSO41xvaYTEY9/O1hsUDivEMGPMlN94/cJEprcxguWll/ChW1CYbaDr5WdvnKuBSEEWk2CSAu7s= Received: by 10.78.39.16 with SMTP id m16mr2228421hum.1164811231041; Wed, 29 Nov 2006 06:40:31 -0800 (PST) Received: by 10.78.133.6 with HTTP; Wed, 29 Nov 2006 06:40:30 -0800 (PST) Message-ID: Date: Wed, 29 Nov 2006 17:40:30 +0300 From: "Alexei Fedotov" To: dev@harmony.apache.org Subject: Re: [general] JUnit consistency, practices In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <3b3f27c60611281926s7d2816dam6d9c351150832632@mail.gmail.com> X-Virus-Checked: Checked by ClamAV on apache.org This class name cannot fit into my mind either. I cut&paste this mantra from different posts of Alexey Zakharov or use bash history. :-) On 11/29/06, 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 > > > > > > > > > > -- Thank you, Alexei