cxf-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Daniel Kulp <daniel.k...@iona.com>
Subject Re: Move to JUnit 4?
Date Thu, 08 Mar 2007 16:56:25 GMT

Since there are no objections, I'm going to go ahead and commit this. 

Things I've done:
1) Converted all of "common" to use junit 4
2) Converted all the subclasses of AbstractClientServerTest to use junit 4
3) Converted all the subclasses of CXFAbstractTest to use junit 4
4) Converted all the system tests to use junit 4
5) Converted all the jms tests to use junit 4
6) Converted some of the ws tests to junit 4.

In all cases, if I saw tests that were renamed (like xtestFoo()), I named 
it back and added a @Ignore annotation.   If I saw tests commented out, I 
tried to uncomment it.  If it compiled, I added a @Ignore annotation.   If 
it didn't compile, I left it commented out.   Anyway, while the tests run, 
you should see some "skipped" tests.   If they are in an area you are 
working on, please investigate why and see if they can be re-enabled.

Also if you are updating/adding tests someplace, please try and update them 
to junit 4 form.   It's mostly just change the superclass to 
org.junit.Assert, add @Before/@After annotations to setUp/tearDown, and 
@Test annotations to all the tests.

If you have some static setup that you want run before/after the entire set 
of tests, add @BeforeClass/@AfterClass annotations to static methods.  
(Example: create a single bus to use for all the tests instead of a bus 
per test.   Would make the tests run faster if there aren't side effects 
in the bus.)


Dan



On Friday 02 March 2007 12:15, Daniel Kulp wrote:
> With the move to Surefire 2.3, we can finally use JUnit 4 if we want to.
> I've done a small amount of investigation to see what would be needed.
> MOST of our unit tests will run unmodified with JUnit 4 and would not
> need to be updated.    The tests that don't run are the ones that
> require a pre-class setup (use a "suite" method).    Those would need to
> be updated. They are pretty simple to update.   The "suite" method is
> changed to be something like:
>
> @BeforeClass
> public static void startservers() {
> ....
> }
> @AfterClass
> public static void stopservers() {
> .....
> }
> and all the test methods need a @Test annotation.
>
>
> The tests that would need modification include:
> 1) JMS tests (startup broker)
> 2) One of the WS Policy tests (just simple setup/teardown)
> 3) A BUNCH of the System tests.
>
> A couple hours of work would do it.   However, what are peoples thoughts
> on moving to JUnit 4?
>
>
> The main thing I like about it is to disable a test, you can add an
> @Ignore annotation.    This then shows up when you run "mvn test" as a
> skipped test.   It's much easier to find disabled tests so you know
> where they are to fix them later.
>
> Thoughts?

-- 
J. Daniel Kulp
Principal Engineer
IONA
P: 781-902-8727    C: 508-380-7194
daniel.kulp@iona.com
http://www.dankulp.com/blog

Mime
View raw message