[MAGNOLIA-260] (patch) add support for httpunit tests Created: 06/Jan/05  Updated: 23/Jan/13  Resolved: 23/Jan/05

Status: Closed
Project: Magnolia
Component/s: build
Affects Version/s: 2.0 Final
Fix Version/s: 2.01

Type: Improvement Priority: Major
Reporter: Fabrizio Giustina Assignee: Fabrizio Giustina
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Attachments: Zip Archive patch.zip    
Template:
Acceptance criteria:
Empty
Task DoD:
[ ]* Doc/release notes changes? Comment present?
[ ]* Downstream builds green?
[ ]* Solution information and context easily available?
[ ]* Tests
[ ]* FixVersion filled and not yet released
[ ]  Architecture Decision Record (ADR)

 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



 Comments   
Comment by Fabrizio Giustina [ 06/Jan/05 ]

new and modified files, sorry :/

Comment by Fabrizio Giustina [ 23/Jan/05 ]

committed to svn. Test run by maven still fails for classloader issues, work fine in outside maven

Generated at Mon Feb 12 03:15:40 CET 2024 using Jira 9.4.2#940002-sha1:46d1a51de284217efdcb32434eab47a99af2938b.