Re: Unable to view the Web Application I am testingusing httpunit

[email protected]
Newsgroups gmane.comp.web.httpunit.devel
Message-ID <OFA3269EBE.1773DA57-ON85257386.0049E868-85257386.004A24D5@MCKINSEY.COM>
You can print the response by using respObj.getText().  Moreover if you run
the test in an IDE like eclipse, in debug mode you will be able to see the
details inside each object which is part of conversation.

-Riju VK


                                                                           
             malathi gopalan                                               
             <malathigo@yahoo.                                             
             com>                                                       To 
             Sent by:                  Discussion of use and development   
             httpunit-develop-         of HttpUnit                         
             [email protected]         <[email protected] 
             rceforge.net              .net>                               
                                                                        cc 
                                                                           
             10/30/2007 04:21                                      Subject 
             PM                        Re: [Httpunit-develop] Unable to    
                                       view the Web Application I am       
                                       testingusing httpunit               
             Please respond to                                             
             Discussion of use                                             
              and development                                              
                of HttpUnit                                                
             <httpunit-develop                                             
             @lists.sourceforg                                             
                  e.net>                                                   
                                                                           
                                                                           




Thanks Band for the response.
I don't want to write the response to a page, but I
would like to view the GUI for the web application
that I am testing.

Thanks
Malathi

--- "Band, Tyler" <[email protected]> wrote:

> This is what I use to 'write' a page out - since
> this is a load test - I
> needed to uniquely identify the page so I included a
> random system time
> and the logon name. This only writes the page out if
> there is an error.
> Enjoy
>
>
>
>    private void writeErrorPage(WebResponse response)
> throws Exception {
>            if (response != null) {
>                if (pageTitle == null)
>                        pageTitle = response.getTitle();
>                long time = System.currentTimeMillis() / 1000;
>                String mFilePath = mState.getMThreadID() + "_["
>                            + mState.getUserName() + "]_" + pageTitle +
> "_"
>                            + String.valueOf(time) + ".html";
>                String content = response.getText();
>                FileOutputStream out = new
> FileOutputStream(mFilePath);
>                PrintWriter writer = new PrintWriter(out);
>                writer.print(content);
>                writer.close();
>                pageTitle = null;
>            }
>     }
>
> Tyler Band
> Marriott Vacation Club
> Orlando, FL
>
> -----Original Message-----
> From: [email protected]
>
[mailto:[email protected]]
> On Behalf Of
> malathi gopalan
> Sent: Tuesday, October 30, 2007 3:21 PM
> To: [email protected]
> Subject: [Httpunit-develop] Unable to view the Web
> Application I am
> testingusing httpunit
>
> Hi,
>
> I am using HttpUnit1.6 and jdk 1.5_02.
> I am trying to test a Web Application using httpunit
> and I am able to have the web conversation with the
> application and getting the appropiate values for my
>
> tests, Everything is happening in the background, I
> would like to view what is happening in the
> application  for example the login page, view the
> form
> submit, clicking on a link etc.
>
> I appreciate if anyone can help me.
>
> Thanks
>
> Below is the code that I used for HttpUnit.
>
> public class sampleHttpUnitTest extends TestCase
> {
>     public void testConnection() throws  Exception
>     {
>
>         String url = "www.bmc.com"
>         WebConversation wc = new WebConversation();
>
>         WebRequest request = new
>         GetMethodWebRequest(url);
>
>         WebResponse response =
>         wc.getResponse(request);
>
>         assertEquals("The Web page returned the
> wrong
>         respons code ",200,
> response.getResponseCode());
>
>         System.out.println("Title : " +
>         response.getTitle());
>
>         WebLink [] webLinkList =
> response.getLinks();
>
>         String[] elementNameList =
>         response.getElementNames();
>
>         for(WebLink weblink : webLinkList )
>         {
>             System.out.println(" WebLink Text is " +
>             weblink.getText());
>
>         }
>
>         for(String elementName : elementNameList )
>         {
>             System.out.println(" ElementName is " +
>             elementName);
>         }
>
>         WebForm [] webFormList =
> response.getForms();
>
>         for(WebForm webForm : webFormList)
>         {
>             System.out.println("name : "+
> webForm.getName() + " Text : " + webForm.getText() +
>                     "Id : " + webForm.getID());
>
>             SubmitButton[] submitButtonList  =
> webForm.getSubmitButtons();
>
>             for(SubmitButton button :
> submitButtonList)
>             {
>                 System.out.println(" Submit Button
> name : " + button.getName());
>                 //webForm.submit(button);
>
>             }
>
>             webForm.setParameter("j_username",
> "admin");
>             webForm.setParameter("j_password",
> "quality1");
>
>             response = webForm.submit();
>
>             System.out.println("Title in response
> page
> is : " + response.getTitle());
>
>             WebLink [] responseWebLinkList =
> response.getLinks();
>
>             String[] responseElementNameList =
> response.getElementNames();
>
>             for(WebLink weblink :
> responseWebLinkList
> )
>             {
>                 System.out.println(" Response
> WebLink
> Text is " + weblink.getText());
>
>             }
>
>             for(int i=0;
> i<responseWebLinkList.length;
> i++)
>             {
>
>
if(responseWebLinkList[i].getText().equals("continue"))
>                 {
>                     WebResponse responseEvent =
> responseWebLinkList[i].click();
>
>                     for(WebLink weblink :
> responseEvent.getLinks())
>                     {
>                         System.out.println("WebLinks
> in  Events page is " + weblink.getText());
>                     }
>
>                 }
>
>             }
>
>         }
>
>     }
> }
>
>
>
>
>
>
>
>
>
>
>
> __________________________________________________
> Do You Yahoo!?
> Tired of spam?  Yahoo! Mail has the best spam
> protection around
> http://mail.yahoo.com
>
>
------------------------------------------------------------------------
> -
> This SF.net email is sponsored by: Splunk Inc.
> Still grepping through log files to find problems?
> Stop.
> Now Search log events and configuration files using
> AJAX
=== message truncated ===


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around
http://mail.yahoo.com

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
Httpunit-develop mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/httpunit-develop




+=========================================================+
This message may contain confidential and/or privileged
information.  If you are not the addressee or authorized to
receive this for the addressee, you must not use, copy,
disclose or take any action based on this message or any
information herein.  If you have received this message in
error, please advise the sender immediately by reply e-mail
and delete this message.  Thank you for your cooperation.
+=========================================================+


-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.