aspose file tools
The moose likes Testing and the fly likes Question on JWebUnit: test Link parameter Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Engineering » Testing
Reply Bookmark "Question on JWebUnit: test Link parameter" Watch "Question on JWebUnit: test Link parameter" New topic
Author

Question on JWebUnit: test Link parameter

Melinda Savoy
Ranch Hand

Joined: Jun 21, 2005
Posts: 375

I am using JWebUnit and was wondering if there is a way to test the following:

First I want to test that the parameters ("num" and "type") are populated
Second I want to test and compare their actual value.

In my JSP page here is what I am working with:

<td align="right"><a href='./ViewRequisitionServlet?num=<%= reqs[i].getReqNumber()%>
&type=<%=reqs[i].getType() %>' name='<%= "LINK" + reqs[i].getReqNumber() %>' id='<%= "linkname" %>'>
<%= reqs[i].getReqNumber() %></a></td>

Any help or direction would be appreciated.

Thanks.
Lasse Koskela
author
Sheriff

Joined: Jan 23, 2002
Posts: 11962
    
    5
You could ask jWebUnit for a HttpUnitDialog, ask the HttpUnitDialog for the WebResponse, and ask the WebResponse for the WebLink with ID "linkname", and then ask the WebLink for the value of the parameters you're interested in.


Author of Test Driven (2007) and Effective Unit Testing (2013) [Blog] [HowToAskQuestionsOnJavaRanch]
Melinda Savoy
Ranch Hand

Joined: Jun 21, 2005
Posts: 375

Lasse,

Thanks for the reply. I'll try it.

Regards.
Melinda Savoy
Ranch Hand

Joined: Jun 21, 2005
Posts: 375

Lasse,

That got it. Thanks for your help.
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: Question on JWebUnit: test Link parameter
 
Similar Threads
Newbie Question---Help?
Error with jsp and JavaBeans
Need Help with binding click events to table rows
Struts and javascript
Tomcat 5.5.26 Sessions getting replicated but not working via browser