tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christoph Pater <christ...@pater.name>
Subject Re: PROPOSAL: Update Tomcat 7 tests to JUnit 4
Date Mon, 25 Jul 2011 17:38:20 GMT
Ok I will start to look at org.apache.catalina.tribes.* tests

2011/7/25 Konstantin Kolinko <knst.kolinko@gmail.com>

> 2011/7/22 Konstantin Kolinko <knst.kolinko@gmail.com>:
> > 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:
> >        <classpathentry kind="con"
> path="org.eclipse.jdt.junit.JUNIT_CONTAINER/3"/>
> > new value:
> >        <classpathentry kind="con"
> 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:
>
> <property name="groups" value="java,javax,async,jsp2,junit,org,util"/>
>
>
> 2011/7/23 Christoph Pater <christoph@pater.name>:
> > 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
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message