You are on page 1of 32

Spying on GUI Objects

AIM:
To check the properties of the GUI objects using GUI spy in winrunner

Procedure:
1. Open any Visual basic application

2. Start WinRunner Programs > WinRunner > WinRunner

3. Open, choose File > New.

4. Open GUI Spy Choose Tools > GUI Spy

5. GUI Spy window open

6. Position the GUI Spy on the desktop so that both the application window and
the GUI Spy are clearly visible

7. In the GUI Spy, click the Spy button. Move the pointer over objects in the
visual basic application window.

8. Each object will flashes as we move the pointer over it, and the GUI Spy
displays its properties.

9. Place the pointer over the OK button and press

10. Left Ctrl + F3. This freezes the OK button’s description in the GUI Spy

11. Examine the properties of the OK button

12. Like wise check the properties of all the objects in the visual basic application

13. Save the test choose File>save


Result:
The give test condition is implemented and the output is verified successfully
RapidTest Script Wizard

Aim:

To create rapid test script using rapid test script wizard

Procedure:
1. Open any Windows application
2. Start WinRunner choose Programs > WinRunner >WinRunner on the Start
menu
3. Open a new test choose File > New
4. Start the RapidTest Script wizard Choose Insert > RapidTest Script Wizard
5. Click Next in the wizard’s Welcome
6. Click the hand button and then click anywhere in the Windows application
7. The application’s window name appears in the wizard’s Window.Click Next
8. Clear all the check boxes in the wizard Click Next
9. Accept the default navigation controls (... and > >) And Click Next
10. Set the learning flow to “Express.” Click the Learn button
11. The Rapidscript Generator checks the application and starts to generate script
12. Save the script and GUI map file Click Next
13. RapidTest Script wizard will be closed now
14. Now open GUI Map editor Choose Tools>Gui Map Editor
15. Gui Map Editor Displayes all the object and the properties of the objects in
windows application which is checked.
16. Close GUI Map Editor
17. Save the test choose file>save
Result:

The give test condition is implemented and the output is verified successfully
Recording the Test

Aim:
To record the operations which are performed on an application and to run the test
again using winrunner

Procedure:

1. Start winrunner Choose Programs > WinRunner > WinRunner from start
menu

2. Open a new test Choose File > New

3. Open any windows application

4. Start recording in Context Sensitive mode choose Test> Record-Context


Sensitive or press F2

5. Winrunner starts to record the operations being performed

6. Go to the windows application and start to perform the operations

7. Stop the recording choose Test > Stop Recording or press Ctrl_L+F3 to stop-
the recording

8. Save the test choose File>Save to save the test

9. Run the test choose Test> Run from top or press Ctrl_L+F5 to start the test

10. Give name for the test result Dialogue box

11. The Test result is shown in the Test Results window

12. Exit Winrunner


Generated Test Script:

# Form1
set_window ("Form1", 6);
edit_set ("Text1", "arun");
obj_type ("Text1","<kTab>");
button_press ("Login");

# Project2_0
set_window ("Project2_0", 0);
button_press ("OK");

# Form1
set_window ("Form1", 8);
edit_set ("Text1", "praba");
button_press ("Login");

# Project2_0
set_window ("Project2_0", 0);
button_press ("OK");

# Form1
set_window ("Form1", 5);
edit_set ("Text1", "dina");
button_press ("Login");

# Project2_0
set_window ("Project2_0", 1);
button_press ("OK");

# Form1
set_window ("Form1", 2);
edit_set ("Text1", "ram");
button_press ("Login");

# Project2_0
set_window ("Project2_0", 1);
button_press ("OK");

# Form1
set_window ("Form1", 3);
edit_set ("Text1", "raju");
button_press ("Login");

# Project2_0
set_window ("Project2_0", 1);
button_press ("OK");
Result:
The give test condition is implemented and the output is verified successfully
Checking Text

Aim:
To check the text in an application using winrunner

Procedure:
1. Start Winrunner choose Programs > WinRunner > WinRunner From the
start menu

2. Run the Sample application

3. Start recording in Context Sensitive mode choose Test> Record-Context


Sensitive or press F2

4. Winrunner starts to record the operations being performed

5. Input the values and do the operations

6. Stop the recording choose Test > Stop Recording or press Ctrl_L+F3 to stop-
the recording

7. insert function for objects from the application choose


Insert>Functions>For Objects/Windows or press F8

8. Choose the particular object from the application by clicking on it

9. Function generator window pops up click on paste

10. the function will be placed in test script

11. Create the function for the required object using Function generator

12. write the script to validate the objects

13. Run the test choose Test> Run from top or press Ctrl_L+F5 to start the test

14. the test will be performed and result is displayed in the test results window

15. Exit Winrunner


Test Script:

set_window ("Form1", 4);


edit_set ("Text1", "12");
edit_set ("Text2", "45");
button_press ("Login");

Validation part:
edit_get_text("Text1",t1);
edit_get_text("Text2",t2);
edit_get_text("Text3",res);
if(t1+t2 == res)
tl_step("Test",0,"True");
else
tl_step("test",1,"false");
Result:

The give test condition is implemented and the output is verified successfully.
Checking Bitmaps

Aim:
To check the bitmap images in a project and to verify that both the image are same

Procedure:
1. Start winrunner. Choose Programs > WinRunner > WinRunner from start
menu

2. Open a new test. Choose File > New

3. Start recording in Context Sensitive mode. Choose Test> Record-Context


Sensitive or press F2

4. Winrunner starts to record the operations being performed

5. Press F2 to pause the recording

6. insert the bitmap check point. Choose Insert > Bitmap Check point >For
Object/Windows or press Ctrl_L+F2

7. Now click on the first bitmap object

8. Again Press F2 to pause the recording

9. insert the bitmap check point. Choose Insert > Bitmap Check point >For
Object/Windows or press Ctrl_L+F2

10. Now click on the second bitmap object

11. Now we can view the bitmaps in the testresults window. Choose Tools>Test
Results or press ALT_R+F8.

12. Double click on the bitmap image to view the image

13. Run the test choose Test> Run from top or press Ctrl_L+F5 to start the test

14. the test will be performed and result is displayed in the test results window
15. To know the Difference between two bitmap images double click on the first
bitmap image

16. the difference will be show between the bit map images

17. Exit Winrunner


Test Script:
# Analog Recording
move_locator_track (35);
mtype ("<T156><kLeft>-<T125><kLeft>+");
move_locator_track (36);
mtype ("<T125><kLeft>-<T47><kLeft>+");
set_window("Form1", 0);
obj_check_bitmap("Picture1", "Img14", 1);
move_locator_track (37);
move_locator_track (38);
mtype ("<T141><kLeft>-<T94><kLeft>+");
move_locator_track (39);
obj_check_bitmap("Picture1", "Img15", 9);
Result:

The give test condition is implemented and the output is verified successfully
Batch Mode Testing

Aim:
To test multiple application multiple times with the help of batch mode testing

Procedure:
1. Open the first application
2. Start winrunner. Choose Programs > WinRunner > WinRunner from
start menu
3. Open a new test. Choose File > New

4. Start recording in Context Sensitive mode. Choose Test> Record-Context


Sensitive or press F2
5. Winrunner starts to record the test conditions
6. Save the test choose File>Save to save the test
7. Note the location where the test is saved
8. Open the second application
9. Open a new test. Choose File > New
10. Start recording in Context Sensitive mode. Choose Test> Record-Context
Sensitive or press F2
11. save the test choose File>Save to save the test
12. Note the location where the test is saved
13. Open a new test. Choose File > New
14. Write the script for performing batch test
15. Run the test choose Test> Run from top or press Ctrl_L+F5 to start the
test
16. Now the results for all the test will be displayed in test results window
17. Exit winrunner
Test Script:
for(i=0;i<3;i++)
{
call"F:\\software testing\\test1"();
call"F:\\software testing\\test2"();
}
Result:
The give test condition is implemented and the output is verified successfully
Synchronizing Tests

Aim:
To test synchronize tests for the application

Procedure:
1. Start WinRunner and open a new testchoose Programs > WinRunner
>WinRunner on the Start menu
2. Start the Flight Reservation application and log in.Choose Programs >
WinRunner > Sample Applications > Flight 1A on the Start menu

3. Start recording in Context Sensitive mode.Choose Create > Record—


Context Sensitive or click the Record button on thetoolbar

4. Create a new order.Choose File > New Order in the Flight Reservation
application

5. Insert the order into the database.Click the Insert Order button

6. Delete the order.Click the Delete Order button and click Yes in the message
window to confirmthe deletion.

7. Stop recording.Choose Create > Stop Recording or click the Stop button

8. Save the test. Choose File > Save

9. Open the General Options dialog box.Choose Settings > General Options

10. Change the value to 1000 milliseconds (1 second).In the Timeout for
Checkpoints and CS statements box, change the value to“1000”

11. Make sure that the lesson4 test window is active in WinRunner

12. Run the test Choose Run > Run from Top

13. Create > Synchronization Point > For Object/Window Bitmap or click the
Synchronization Point for Object/Window Bitmap

14. Exit Winrunner


Test script with error:
# Flight Reservation
set_window ("Flight Reservation", 2);
menu_select_item ("File;New Order");
list_select_item ("cbxDepartures", "Los Angeles"); # Item
Number 1;
list_select_item ("cbxDestinations", "San Francisco"); # Item
Number 2;
button_press ("Flights...");

# Flights Table
set_window ("Flights Table", 1);
button_press ("OK");

# Flight Reservation
set_window ("Flight Reservation", 1);
button_set ("First", ON);
edit_set ("txtCustomerName", "arun");
button_press ("Insert Order");
set_window ("Flight Reservation", 3);
button_press ("Delete Order");

# Flight Reservation Message


set_window ("Flight Reservation Message", 1);
button_press ("Yes");

Test script with error rectified:


# Flight Reservation
set_window ("Flight Reservation", 2);
menu_select_item ("File;New Order");
list_select_item ("cbxDepartures", "Los Angeles"); # Item
Number 1;
list_select_item ("cbxDestinations", "San Francisco"); # Item
Number 2;
button_press ("Flights...");

# Flights Table
set_window ("Flights Table", 1);
button_press ("OK");

# Flight Reservation
set_window ("Flight Reservation", 1);
button_set ("First", ON);
edit_set ("txtCustomerName", "arun");
button_press ("Insert Order");
obj_wait_bitmap("Insert Done...", "Img2", 1);
set_window ("Flight Reservation", 3);
button_press ("Delete Order");

# Flight Reservation Message


set_window ("Flight Reservation Message", 1);
button_press ("Yes");
Result:

The give test condition is implemented and the output is verified successfully