Uploaded image for project: 'Magnolia'
  1. Magnolia
  2. MAGNOLIA-260

(patch) add support for httpunit tests

    XMLWordPrintable

Details

    • Improvement
    • Resolution: Fixed
    • Major
    • 2.01
    • 2.0 Final
    • build
    • None

    Description

      while trying to refactor some magnolia custom tags or gui control, I've set up a basic infrastructure to run httpunit tests in magnolia.
      I suppose they could really be useful to developers, if actually they need to run the control in a web application to see generated html.

      I am attaching a zip containing new files and the modified project.xml and project.properties.
      sorry for the package but the eclipse svn plugin sucks... I am still unable to create good patches

      What do you get?
      Project.xml is updated with httpunit and related dependencies. These ones include the tomcat compiler, so that jsp files can be compiled and run without a container.

      You can see a HttpUnitTestCase class which is the base class to use for creating new tests and a sample testcase, composed of 2 files:
      ButtonTest.java : run the test and makes assertions on the result
      button.jsp : a sample jsp page containing a GUI control (please note that this test could have been done also without a jsp since it's a simple gui class and not a custom tag. This framework is expecially useful to test custom tags but I added only this test since tlds are always missing in the svn repository)

      You can run the sample test using maven on in your favorite ide. Just run "maven eclipse" or "Maven idea" to update your classpath with httpunit dependecies and run ButtonTest as a junit test. You should see the output from the html page and then the test failing with an assertion (yes, the html generated by those buttons is ugly)

      Now you can easily see the output from you custom tags and having automated tests.
      Go on writing tests and enjoy

      PS. this stuff is the same that drives tests in the displaytag project http://displaytag.sourceforge.net

      Checklists

        Acceptance criteria

        Attachments

          Activity

            People

              fgiust Fabrizio Giustina
              fgiust Fabrizio Giustina
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Checklists

                  Task DoD