See More
Commercial Alternatives:

Open Source Alternatives:

See also:

HttpUnit

Be the first to create a list of standard features for "Testing".

Forum


Validating Radio Buttons Using HttpUnit

Hi,
I am trying to write a test case to simulate a radio option using HttpUnit.

My form looks like this:









Existing Mobile Number
Select a number



New Mobile Number
Number




...



and my test case looks like this;

WebForm[] forms = response.getForms();
WebForm form = forms[0];

String number = phoneNumber.getArea()+phoneNumber.getThree()+phoneNumber.getFour();
System.out.println("PHONE NUMBER TO SET: " + number);
String radioGroupName = "phoneList";

String[] options = form.getOptions(radioGroupName); //this returns the labels of the radio button
String[] optionsValues = form.getOptionValues(radioGroupName); //this returns true and false as per HttpUnit API

for (int i = 0; i < options.length; i++) {
if (options[i].equals("Existing Mobile Number")) {
System.out.println("Existing");
//do something
} else {
System.out.println("New");
//do something
}
}

For some reason, form.getOptions(radioGroupName) returns empty string. How do I decide which radio option is selected?

Any advise is highly appreciated.

Thanks.
Sandy
[...]
Date: October 31, 2008 at 18:08 Author: sandy_ajit
Last post: October 31, 2008 at 18:08 Replies: 0
Please Suggest
Can we do data validation using HTTP unit. If yes please could ne one explain with an example.

Thanks in Advance
[...]
Date: October 3, 2008 at 01:45 Author: Golu
Last post: October 3, 2008 at 01:45 Replies: 0
Exception getting while setting parameter for drop down box in aspx
hi,
am getting Exception when i set parameter for the drop down box using httpunit
please any one will help me out in this.
[...]
Date: June 25, 2008 at 06:59 Author: laru
Last post: June 25, 2008 at 06:59 Replies: 0
httpunit
while submitting forms using httpunit its updating twice in the database. please help me
[...]
Date: May 31, 2008 at 06:23 Author: laru
Last post: May 31, 2008 at 06:23 Replies: 0
Getting javax.net.ssl.SSLHandshakeException
Hi.As i'm setting the action of a form through getScriptableObject().setAction which is a https link,i'm getting an exception telling java.lang.RuntimeException: Error loading included script: javax.net.ssl.SSLHandshakeException: Remote host closed connection during handshake.Can anyone help me out.Is there a solution for this.Thanks in advance.Regards Mathew
[...]
Date: May 30, 2008 at 01:02 Author: matvar
Last post: May 30, 2008 at 01:02 Replies: 0
How to Hit the website
Hi I want to hit hte website through the program .Is there any way to do that..?
[...]
Date: February 21, 2008 at 03:24 Author: karthick
Last post: February 21, 2008 at 03:24 Replies: 0

Start a new discussion
Resources:  Vendor/Foundation |  Licenses |  Linux Distributions |  Programming Languages |  Programming Interfaces (API) |  Graphical Interfaces (GUI) |  Available Languages