Hi guys,
I've updated all testcases on master to use JUnit 4 style
(except for drools-eclipse and the non-active parts of drools-grid).
The main reason is so we now let hudson report how many testcases
are ignored (annoted with @Ignore instead of disabled).
Some notes:
- Don't disable testcases by prefixing them with FIXME_ or
disabled_ or by commenting out @Test
- Instead, add the @Ignore annotation
- This way hudson gives us a report on how many testcases
have been ignored.
- Don't use try-catch to test if an exception is thrown. Use
@Test(expected = MyException.class)
- I haven't migrated this in all testcases, as I couldn't
automate that.
- Please fix it in any code you come across.
- To use assertions like assertEquals(a,b), just add this
import:
- import static org.junit.Assert.*;
- Don't import anything from junit.framework.*.
- Import only from org.junit.*
- Configure your Eclipse/Intellij to not propose those imports
to keep mistakes to a minimum.
- TestSuites have been removed.
- Use your Eclipse/IntelliJ to single out tests, packages of
tests or modules.
- They bring extra maintenance (and seem to be seen as legacy
since junit 4?)
- Testcases that print out their own name, no longer print out
their own name
- The junit runner prints out the name already
- Otherwise it looks like it's run twice (while it's not)
I hope this push (many files were changed) doesn't cause to many
merge conflicts.
If it does: just take your revision and upgrade your file to junit 4
manually.
Learn more:
- Junit 4 in 60 seconds:
http://www.cavdar.net/2008/07/21/junit-4-in-60-seconds/
--
With kind regards,
Geoffrey De Smet