Article:
  Unit Test Your Struts Application
Subject:   Problem with StrutsUT
Date:   2004-10-26 23:41:56
From:   AshishDave
i am getting this error while working with strtusUT...can neone help me


junit.framework.AssertionFailedError: Unexpected exception: com.meterware.httpunit.NotHTMLException: The content type of the response is 'text/plain': it must be 'text/html' in order to be recognized as HTML



pls...help me..
Thnaks in Advanced....

Full Threads Newest First

Showing messages 1 through 1 of 1.

  • Problem with StrutsUT
    2004-10-27 00:15:07  lujian213 [View]

    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.