Hi i wrote the following script in winrunner to check the boundary range:
1. VB Program contains (text box,Calculate and clear button)
Calculate button Coding:
Dim a As Integer
a = Val(Text1.Text)
If (a > 100) Then
MsgBox ("value exceeds the maximum range")
ElseIf (a < 50) Then
MsgBox ("value is less than the minimum range")
ElseIf (a >= 50 & a <= 100) Then
MsgBox ("value is within the range")
End If
2.In winrunner Tools-> GUI Map Editor -> Learn -> I pointed it to the Boundary Range program and learnt all the GUI properties and saved in some abc.GUI file
3.Tools -> Data Table ->created a new table with the parameter "Numbers" and saved as "table.xls"
Winrunner Script:
path="C:\Program Files\Mercury Interactive\WinRunner\boundary\table.xls";
ddt_open(path,DDT_MODE_READWRITE);
ddt_get_row_count(path,mycount);
#Boundary Range
win_activate("Boundary Range");
for(i=1;i<=mycount;i++)
{
set_window("Boundary Range");
edit_set("ThunderTextBox",ddt_val_by_row("C:\Program Files\Mercury Interactive\WinRunner\boundary\table.xls",i,"Numbers"));
edit_get_text("ThunderTextBox",val);
button_press("Caculate");
if(val<50)
report_msg("val is less tan minimum range");
else if (val>100)
report_msg("val is greater than maximum range");
else if(val>=50 && val <=100)
report_msg("value is within the range");
set_window("Boundary Range_0");
button_press("Clear");
}
tl_step("boundary Testing ",pass,"Successfull")
#win_close("Boundary Range");
ddt_close(path);
The script does not execute correctly, I mean it does not retrieve the values from the table.xls file and check it in the Boundary range program. But In the results page I get pass, successful message.