KabInfo.Net - Full Testing Tutorials - All Free
At KabInfo.Net you will find all the Manual and Automation Testing tutorials,
from basic Testing Definition and Testing Types,Testing Methodologies to
advanced Automation Tools like, WinRunner, LoadRunner and a Test Management
Tool like TestDirector.
KabInfo.Net - The Largest Enterprise Application Testers site on the Net |
|
|
9. Write a test with for loop, switch, case statements
Sol:
For (i=0;I<3;i++)
{
# Flight Reservation
win_activate (“Flight Reservation”);
set_window (“Flight Reservation”, 2);
edit_set (“Date of Flight:”,”12/12/12”);
list_select_item (“Fly From:”,”Denver”); # Item Number 0;
list_select_item (“Fly To:”,”London”); # Item Number 1;
obj_mouse_click (“FLIGHT”, 58, 29, LEFT);
# Flight Table
set_window (“Flights Table”, 2);
list_select_item (“Flight”,”20262 DEN 10:12 AM LON 05:23PM AA $112.20”);
# Item Number 1;
button_press (“OK”);
# Flight Reservation
set_window (“Flight Reservation”, 11);
edit_set (“Name:”,”dakshina”);
switch (i)
{
case 0:
button_set (“First”, ON);
break;
case 1:
button_set (“Business”, ON);
break;
}
button_press (“Flight Reservation”);
wait(6);
# Flight Reservation
win_activate (“Flight Reservation”);
set_window (“Flight Reservation”, 2);
menu_select_item (“File;New Order”);
}
NOTE:
The switch statement provides the mechanism for a multi-way decision.
The syntax of this structure is switch (expression)
{
case case_expr1:
statement(s)
case case_expr2:
statement(s)
case case_exprn:
statement(s)
[ default: statement(s) ]
}
the switch statement consecutively evaluates each of the enumerated
case expressions (case_expr1, case_expr2,……….case_exprn),until one
is found that equals the initial expression. If no case expression
is equal to the specified expression, then the optional default
statements are executed.
NOTE: that the first time a case expression is found to be equal to
the specified initial expression, no further case expressions are
evaluated. However, all subsequent statements enumerated by these
cases are executed, unless you use a break statement within a case
to end the loop. For example:
Switch (a) {
Case “xyz’:
b = a & “tw”;
break;
case “uv”:
pause (“hello”);
x = a;
break;
default:
x = a;
}
NOTE: that while the initial expression can be regular expression,
case expressions can only be constants or variables. |
Where to Start
What does a Software Test Engineer have to know? What will the future bring?
KabInfo.Net will try to answer this, and help you become a professional
Software Test Engineer, well prepared for the future.
Before you study the tutorials,
Read this
introduction.
Because time is valuable, we deliver quick and easy learning. At KabInfo.Net,
you can study everything you need to learn, in an accessible and handy format.
"No One Is Great, And Every One Is GREAT"
K.A.Babu (2004)
Testing Joke
Tester : "I Delivered a 100% Bug Free Product!"
|
KabInfo.Net - Testing School is for self training only. We do not warrant the
correctness of the content. The risk of using it remains entirely with the user.
While using this site, you agree to have read and accepted our
terms of use and
privacy policy.
Copyright 2004
. All Rights Reserved.
Logo Courtesy - Venkat Battu
|
|