Unable to view the Web Application I am testing using httpunit

malathi gopalan <[email protected]>
Newsgroups gmane.comp.web.httpunit.devel
Message-ID <[email protected]>
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 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.