ONJava.com -- The Independent Source for Enterprise Java
oreilly.comSafari Books Online.Conferences.

advertisement

AddThis Social Bookmark Button
Article:
  Unit Test Your Struts Application
Subject:   Problem with StrutsUT
Date:   2004-10-27 00:15:07
From:   lujian213
Response to: Problem with StrutsUT

Check the following items, maybe you can fix the problem.


1. Check your result html/jsp to see whether the contentType attribute is set to "text/html" or "text/plain". HttpUnit only accepts "text/html". Maybe you need to change the html/jsp.


2. If your struts action result is not a html, check the endXXX(WebResponse) method in your testcase. Use endXXX(org.apache.cactus.WebResponse) instead of endXXX(com.meterware.httpunit.WebResponse). This will avoid the test case to parse the result as a html format. Then you can use WebResponse.getText() to do comparation. Refer to Cactus document to get detail information.


If you still have problem, please provide related code, test case and related resource. I can check it for you.