Return-Path: Delivered-To: apmail-incubator-harmony-dev-archive@www.apache.org Received: (qmail 76113 invoked from network); 26 Oct 2006 06:50:42 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 26 Oct 2006 06:50:41 -0000 Received: (qmail 95618 invoked by uid 500); 25 Oct 2006 14:39:23 -0000 Delivered-To: apmail-incubator-harmony-dev-archive@incubator.apache.org Received: (qmail 95585 invoked by uid 500); 25 Oct 2006 14:39:23 -0000 Mailing-List: contact harmony-dev-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: harmony-dev@incubator.apache.org Delivered-To: mailing list harmony-dev@incubator.apache.org Received: (qmail 95575 invoked by uid 99); 25 Oct 2006 14:39:23 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 25 Oct 2006 07:39:23 -0700 X-ASF-Spam-Status: No, hits=0.5 required=10.0 tests=DNS_FROM_RFC_ABUSE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (herse.apache.org: domain of dkishenko@gmail.com designates 64.233.182.189 as permitted sender) Received: from [64.233.182.189] (HELO nf-out-0910.google.com) (64.233.182.189) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 25 Oct 2006 07:39:09 -0700 Received: by nf-out-0910.google.com with SMTP id m18so616264nfc for ; Wed, 25 Oct 2006 07:38:48 -0700 (PDT) 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=nt1Ptv4dfuTnuEFqeafkkgs7lbp8noCaF6Vn04e4bsu5cMUNdAziCVWd4YFbu4f0dcxz3qLrUHB3xWSDT4VOWiX3UTSCDiq+L83xlKfN0bkAD+u2a+5jNcHLLIc/S9fB9CSnaBvRCLs+Xc324LCGaKAn2nk/sbPolSLhII911qI= Received: by 10.82.120.14 with SMTP id s14mr151362buc; Wed, 25 Oct 2006 07:38:47 -0700 (PDT) Received: by 10.82.139.14 with HTTP; Wed, 25 Oct 2006 07:38:47 -0700 (PDT) Message-ID: <834b3bd50610250738u674eae7rb4fb7a9d77ec068d@mail.gmail.com> Date: Wed, 25 Oct 2006 18:38:47 +0400 From: "Denis Kishenko" To: harmony-dev@incubator.apache.org, geir@pobox.com Subject: Re: [classlib][tests] Junit best practice In-Reply-To: <453F5A18.8080609@pobox.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <200610251127.k9PBRfrd026692@d06av02.portsmouth.uk.ibm.com> <453F4D54.8010507@pobox.com> <200610251212.k9PCCltl018125@d06av02.portsmouth.uk.ibm.com> <453F5A18.8080609@pobox.com> X-Virus-Checked: Checked by ClamAV on apache.org Mark, I have just tried your tool. It's really helpful, thanks a lot! It's so pitty that script doesn't fix issues by itself =) 2006/10/25, Geir Magnusson Jr. : > > > Mark Hindess wrote: > > On 25 October 2006 at 7:41, "Geir Magnusson Jr." wrote: > >> Cool - but why not just put into SVN somewhere? > > > > Okay. classlib/trunk/support/tools/bin perhaps? > > Sure. Whatever you feel is best. I have no strong opinion. We do have > junit tests in DRLVM too, but we can "reach over" and use from there for > now. > > geir > > > > > -Mark. > > > >> either in enhanced/tools or classlib/trunk somewhere where it can be > >> invoked as an option by people from ant (so that we can wire it into the > >> CI system...) > >> > >> geir > >> > >> > >> Mark Hindess wrote: > >>> Earlier in the year we discussed junit best practice. For example, > >>> making sure assertEquals calls have the expected and actual arguments in > >>> the correct order to avoid getting confusing failure messages. > >>> > >>> Robert posted a script a week or so ago, to look for some of junit > >>> issues but it didn't handle asserts that spanned multiple lines so, > >>> unfortunately, it was missing the majority of them. I had a script that > >>> I'd thrown together one evening that would handle multi-line asserts but > >>> annoyingly (because it read the whole file at once) couldn't report the > >>> line number of the potential issue as Robert's script did. > >>> > >>> Inspired by Robert's post, I looked at my script again. I've now fixed > >>> it to report line numbers, added a little bit of documentation and > >>> attached it to a JIRA: > >>> > >>> https://issues.apache.org/jira/browse/HARMONY-1960 > >>> > >>> It finds quite a lot of potential problems (I've appended a summary of > >>> the findings below). (There will be a few false positives but hopefully > >>> not too many.) It would be nice to fix these issues - I fixed several > >>> hundred while testing the script - but more importantly we should make > >>> sure we avoid adding any new issues. > >>> > >>> Improvements to the script would be most welcome. > >>> > >>> Regards, > >>> Mark. > >>> > >>> Types of issue identified > >>> > >>> 4949 should possibly use assertEquals > >>> 815 actual may be a constant > >>> 437 consider using separate asserts for each '&&' component > >>> 330 exception may be left to junit > >>> 135 actual *may* be a constant > >>> 48 should be fail (always false) > >>> 40 should be fail (always true) > >>> 20 expected is null - should use assertNull > >>> 12 consider using separate asserts for each '||' component > >>> 8 expected is false - should use assertFalse > >>> 7 expected is true - should use assertTrue > >>> 1 should use assertNotNull > >>> > >>> > >>> Number of Issues by module > >>> > >>> 1907 luni > >>> 1440 swing > >>> 699 math > >>> 611 security > >>> 335 text > >>> 322 awt > >>> 222 sound > >>> 186 nio > >>> 178 jndi > >>> 123 archive > >>> 118 auth > >>> 117 crypto > >>> 116 logging > >>> 91 nio_char > >>> 87 print > >>> 74 regex > >>> 68 concurrent > >>> 45 beans > >>> 41 x-net > >>> 21 sql > >>> 1 rmi > >>> > >>> > >>> > >>> > > > > > > > -- Denis M. Kishenko Intel Middleware Products Division