tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Konstantin Kolinko <>
Subject PROPOSAL: Update Tomcat 7 tests to JUnit 4
Date Fri, 22 Jul 2011 13:57:24 GMT

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


With this, all our tests are running successfully as they are now.

* Next step is to convert existing tests to use JUnit 4 annotations.
My plan is the following:

1. Convert test classes that are direct descendants of TestCase.

2. Create a copy of TomcatBaseTest class that does not extend TestCase.
Let's name it TomcatBaseTestJUnit4.

3. Convert descendants of TomcatBaseTest to use TomcatBaseTestJUnit4.

4. Rename TomcatBaseTestJUnit4 -> TomcatBaseTest.

Two 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:


The last tip is thanks to

Are there any objections or comments?

Best regards,
Konstantin Kolinko

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message