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.
* 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:
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/
Are there any objections or comments?
Best regards,
Konstantin Kolinko
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]