Return-Path: X-Original-To: apmail-tomcat-dev-archive@www.apache.org Delivered-To: apmail-tomcat-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 349486CFE for ; Mon, 25 Jul 2011 17:38:49 +0000 (UTC) Received: (qmail 26102 invoked by uid 500); 25 Jul 2011 17:38:48 -0000 Delivered-To: apmail-tomcat-dev-archive@tomcat.apache.org Received: (qmail 26031 invoked by uid 500); 25 Jul 2011 17:38:47 -0000 Mailing-List: contact dev-help@tomcat.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "Tomcat Developers List" Delivered-To: mailing list dev@tomcat.apache.org Received: (qmail 26022 invoked by uid 99); 25 Jul 2011 17:38:47 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 25 Jul 2011 17:38:47 +0000 X-ASF-Spam-Status: No, hits=1.5 required=5.0 tests=HTML_MESSAGE,RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of christoph@pater.name designates 209.85.161.173 as permitted sender) Received: from [209.85.161.173] (HELO mail-gx0-f173.google.com) (209.85.161.173) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 25 Jul 2011 17:38:42 +0000 Received: by gxk26 with SMTP id 26so3375897gxk.18 for ; Mon, 25 Jul 2011 10:38:21 -0700 (PDT) MIME-Version: 1.0 Received: by 10.68.36.138 with SMTP id q10mr487473pbj.348.1311615500717; Mon, 25 Jul 2011 10:38:20 -0700 (PDT) Received: by 10.68.59.231 with HTTP; Mon, 25 Jul 2011 10:38:20 -0700 (PDT) X-Originating-IP: [80.134.81.24] In-Reply-To: References: Date: Mon, 25 Jul 2011 19:38:20 +0200 Message-ID: Subject: Re: PROPOSAL: Update Tomcat 7 tests to JUnit 4 From: Christoph Pater To: Tomcat Developers List Content-Type: multipart/alternative; boundary=bcaec520eb0f008dbc04a8e84827 --bcaec520eb0f008dbc04a8e84827 Content-Type: text/plain; charset=ISO-8859-1 Ok I will start to look at org.apache.catalina.tribes.* tests 2011/7/25 Konstantin Kolinko > 2011/7/22 Konstantin Kolinko : > > Hi! > > > > I propose to update Tomcat 7 tests to use JUnit 4. > > > > One feature that I would like to use from there is to write failing > > tests before fixing the code and annotate them with @Ignore so that > > they are skipped until the annotation is removed. > > > > > > * First step is to use these values in build.properties: > > > > junit.home=${base.path}/junit4.8.2 > > junit.lib=${junit.home} > > junit.jar=${junit.lib}/junit-4.8.2.jar > > junit.loc= > http://cloud.github.com/downloads/KentBeck/junit/junit4.8.2.zip > > > > With this, all our tests are running successfully as they are now. > > Done. > > > > > * Next step is to convert existing tests to use JUnit 4 annotations. > > My plan is the following: > > (...) > > > > Three tips for Eclipse IDE users: > ========================== > > 1. To switch project to use JUnit 4: > > > > In Project properties -> Java Build Path -> Libraries > > There is "JUnit 3" library there. > > Press "Edit..." button. In drop-down list select "JUnit 4". > > > > It results in the following change in .classpath file: > > old value: > > path="org.eclipse.jdt.junit.JUNIT_CONTAINER/3"/> > > new value: > > path="org.eclipse.jdt.junit.JUNIT_CONTAINER/4"/> > > > > Eclipse IDE 3.7 Indigo comes with junit 4.8.2 bundled in it. > > > > > > 2. To enable content assist for methods included through static import: > > > > In Workspace settings -> Java > Editor > Content Assist > Favorites > > Add types one by one by clicking "New Type..." button. > > E.g. I usually add the following: > > > > org.junit.Assert > > org.junit.matchers.JUnitMatchers > > org.hamcrest.CoreMatchers > > org.hamcrest.Matchers > > > > The last tip is thanks to > > http://www.ralfebert.de/blog/eclipseide/static_methods/ > > > > 3. Checkstyle is configured so that static imports are before non-static > imports of the same group. That is "above" setting in > http://checkstyle.sourceforge.net/property_types.html#importOrder > > E.g., > > import java.util.Map; > import java.util.Set; > > import static org.junit.Assert.assertEquals; > import static org.junit.Assert.assertFalse; > import static org.junit.Assert.assertTrue; > > import org.junit.Test; > > > Default configuration for "Organize imports" command (Ctrl+Shift+O) > in Eclipse IDE is to place all static imports before others (that would > be "top" in checkstyle). > > To change it to match our checkstyle settings, in Workspace Preferences > go to Java > Code Style > Organize Imports, press "New Static..." button, > enter "org", OK. Then move new "S org" import group above the "org" one. > > Note, that the full list of groups in our checkstyle configuration > res/checkstyle/checkstyle.xml is: > > > > > 2011/7/23 Christoph Pater : > > I like that idea. > > I'm new to tomcat sources but maybe I can volunteer here? > > Chris, you are welcome. > > > BTW, > the classes in org.apache.catalina.tribes.* are near the end of > my priorities list for this task. Some of them (e.g. > tribes.test.transport.*) > do not use JUnit at all, but have main() methods that do some testing. > They are excluded from batchtest configuration in our build.xml. > > > Best regards, > Konstantin Kolinko > > --------------------------------------------------------------------- > To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org > For additional commands, e-mail: dev-help@tomcat.apache.org > > --bcaec520eb0f008dbc04a8e84827--