Uploaded image for project: 'Cactus'
  1. Cactus
  2. CACTUS-252

JUnit 4.x integration

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 1.7.2
    • None
    • Framework
    • None
    • Windows XP
      JUnit 4.4
      Cactus 1.7.2

    Description

      I found workaround that it's possible to "integrate" JUnit 4.4 with Cactus 1.7.2.
      Here is the example how do I do:
      public class CactusTestRunner extends ServletTestCase
      {
      public static Test suite()

      { ServletTestSuite suite = new ServletTestSuite("ahojO"); suite.addTest (new JUnit4TestAdapter (xxx.class)); }

      }
      – creates JUnit 3.8 compatible tests from JUnit 4.4 classes....

      I have to do change in the Cactus method: JUnitVersionHelper.getTestCaseName() to enable to write TestCase names to the output file
      else if (theTest.getClass().getSimpleName().equals ("JUnit4TestCaseFacade"))
      {
      try

      { Class cl = Class.forName (theTest.getClass().getName ()); Method me = cl.getMethod ("getDescription"); Object desc = me.invoke (theTest); Class clDesc = Class.forName (desc.getClass().getName()); Method meDesc = clDesc.getMethod ("getDisplayName"); name = (String) meDesc.invoke (desc); }

      catch (Throwable e)

      { name = "unknown"; }

      }

      The bad is that you have to have both JUnit 3.8 and JUnit 4.4 archive in testing application. There could be problems with class loader but haven't got any. So I believe that Cactus developers could use my workaround to fastly increase of JUnit dependency to JUnit 4.x.

      Attachments

        Activity

          People

            paranoiabla Petar Tahchiev
            jkr Jakub Kurlenda
            Votes:
            5 Vote for this issue
            Watchers:
            6 Start watching this issue

            Dates

              Created:
              Updated: