1 Reply Latest reply on Jun 4, 2013 5:22 AM by borges

    Junit3 -> Junit4 Migration

    Yong Hao Gao Master

      We are endeavoring to migrating hornetq tests from junit 3 to junit 4.
      We already have a basic script that can replace junit 3 APIs with junit4 ones automatically.




      And this doesn't take care of Junit 3's suite() method, which is used in several places in the tests.
      For this we probably need human intervention. I found a good article that covers this:




      Another problem is the compilation and running tests with maven.


      Not sure what else are needed to get the migration done. We'll see how it goes.



        • 1. Re: Junit3 -> Junit4 Migration
          borges Novice

          For your information, all our tests were migrated to JUnit4.


          The biggest practical advantages are:


          - tests that do not apply to a run (say, AIO tests when without AIO support) are correctly reported as ignored (before this they would just be invisible).

          - we will solve for good the problem of temporary test files being left behind in /tmp.

          - we will be able to have a hard time-out on individual tests without spawning a new VM for each test.

          - a number of problematic asserts that will always fail in JUnit4 (to force you to fix them) were fixed.


          The bulk of the work was done using a shell script, anyone interested can find it at <https://github.com/FranciscoBorges/junit3ToJunit4>.