Read the doc at http://jakarta.apache.org/cactus/howto_httpunit.html ... :)
Thanks
-Vincent

----- Original Message ----- 
From: "Rakesh Bhalla" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>; "Vincent Massol" <[EMAIL PROTECTED]>
Sent: Friday, September 21, 2001 11:40 AM
Subject: HttpUnit with Cactus ..


> Hello,
>   I need some help in integrating HttpUnit with Cactus. I am sorry if
> this is posted for the wrong group, but if  anybody knows the answer
> for that, I think it is really helpful. 
>   I have a JSP page ( page2.jsp )  which performs some action
> depending on the value present in session ( let's say, the session
> objects were set by another page page1.jsp ) . Now my task on hand is
> to test the functionality of page2.jsp . To set the session
> attributes and check them , I use Cactus. Now how do I integrate
> Cactus with HttpUnit ? 
>    Cactus primarily has three methods in its test case:
> 
> beginXXX, testXXX,  endXXX .
> 
> Let's consider this piece of code.
> 
> page2.jsp:
> 
> <html><body>
> <tr><td>
> <% out.print(  session.getAttribute("name").toString() ); %>
> </td></tr></body></html>
> 
> Now using cactus , my test case class would look something like this.
> 
> public void testOut() {
>   session.setAtribute("name" , "BLUE"  );
>   pageContext.forward("page2.jsp");
> }
> 
> public void endOut() {
>    String s = org.apache.cactus.util.AssertUtils.getText();
>    // 's' contains the entire response string.  
> }
> 
> Now my question is that having got the response string in the above
> case which would look something like:
> 
> <html><body>
> <tr><td>
> BLUE
> </td></tr></body></html>
> 
> I need to parse this HTML and get WebTable, WebLink and WebForms. Now
> is there any way I could get that done ?  I mean there is a method
> called WebResponse::getTables  returns an array of WebTable. I want
> to
> get the tables and links from the string 's' mentioned above. Is
> there
> anyway I could do with HTTPUnit ? 
> 
> =====
> Thanks.
> Rakesh Bhalla.
> 
> __________________________________________________
> Terrorist Attacks on U.S. - How can you help?
> Donate cash, emergency relief information
> http://dailynews.yahoo.com/fc/US/Emergency_Information/
> 

Reply via email to