You are on page 1of 62

Mercury WinRunner 9.

2
(Final Release)

Presented by: Kamran Shaukat Ali Khan www.chromeinstitute.com Last Updated: 20090224

Download latest version of this File !

This file was downloaded from:


chromeinstitute.com/003-mercury-winrunner/

Download latest version of the slides from above URL. Feel free to distribute the file and share knowledge The file is available as Read-Only and does not require password to open. View in Presentation Mode the slides animation is designed purposely to nurture audience understanding Direct your feedback to above URL or to author at Quality Today - Kamran kamran.khan@chromeinstitute.com 2 Khan

Audience

Beginners who have just entered the realms of software testing Methodology:
For

every topic well have:

Overview Exercises Questions & Answers.


3

Mercury WinRunner - Kamran Khan

The Road Ahead !


Introduction to Automated Testing Merits/Demerits of Automated Testing Limitations of A.T 5 Ws of Automated Testing (What, Why, When, Where, Who) Why automate at all? What scope to automate? Other automated testing tools What is WR? How does WR do it? GUI map

What is it? Why do we need it? Checking GUI Objects Whats the spy? GUI map file mode How do I create GUI Maps using WR?

Mercury WinRunner - Kamran Khan

The Road Ahead !


WinRunner Testing Process WinRunner Recording/Playing Modes Rapid Test Scripting How do we write script?

TSL Recording modes Why do I need parameterization? How do i perform parameterization? What are they? Various checkpoints How do i add them?

Checkpoints

GUI and DB Checklist (and DB Objects) Synchronization Points & capturing screen values Maintaining tests TD connection Batch mode Practical !

Mercury WinRunner - Kamran Khan

Introduction to Automated Testing

Software systems are critical to the survival of today's businesses. Inadequate performance and poor quality of these systems can jeopardize the very existence of an organization. Testing on all environments and complex integrated infrastructure under increasing numbers of business users is now integral constituent of testing and software development thereof. Manual testing is time-consuming and tedious, requiring a heavy investment in human resources. Worst of all, time constraints often make it impossible to manually test every feature thoroughly before the software is released. This leaves you with doubts of serious bugs latent. Automated testing answers these problems. It dramatically speeds up the testing process. You can create test scripts that check all aspects of your application, and then run these tests on each new build.
6

Mercury WinRunner - Kamran Khan

Merits of Automated Testing


Fast: Automated Testing Tool runs tests significantly faster than human users. Reliable: Tests perform precisely the same operations each time they are run, thereby eliminating human error. Repeatable: You can test how the software reacts under repeated execution of the same operations. Programmable: You can program sophisticated tests that bring out hidden information from the application. Reusability: You can reuse the Automated Test scripts, user defined functions etc.

Mercury WinRunner - Kamran Khan

Demerits of Automated Testing


Usability Testing: Automated tools cannot rate the usability of an application. Cost: Automated tools are quite expensive Programming knowledge required: To customize test scripts according to test requirement. Test maintenance is costly: Even though a minor change occurs in the GUI, the test script has to be rerecorded or replaced by a new test script.

Mercury WinRunner - Kamran Khan

Automated Testing Limitations

Automated testing can only identify regression testing problem. For large scale test automation, ample number of tool licenses and human resources are required (time/resources constraint) Automated testing can help manual testing but cant replace it. Why?
Heuristics

intelligence Business domain


Mercury WinRunner - Kamran Khan 9

Which Test Cases to automate?

Test cases need to be run for every build of the application

Sanity Testing) Data Driven Testing req. precision & accuracy

Tests that use multiple data values for the same actions

Critical Application functionality Business functionality which wont be changed in short time period

under maintenance

Mercury WinRunner - Kamran Khan

10

Which Test Cases not to automate?

One Time testing

Non Repeatable ASAP testing Heuristics Performance & Stress testing Covered in Automated Performance Testing tools

Ad-hoc Testing

Usability Testing

Load testing

Mercury WinRunner - Kamran Khan

11

A.T approach at NetSol

Modular

Automated test scripts are developed module wise or business process wise on AUT Manual testing team provide test cases that are used as an input for automated test scripts

Scenario based:

Once test scripts are developed, manual testing team performs the peer review of automated test scripts Manual testing team executes the automated test scripts on new build of the application

Mercury WinRunner - Kamran Khan

12

Automation cannot be done just for the sake of automation. Not everything can be automated similarly, not everything should be automated. Proper analysis is required before affirming automation for a module
critical areas under maintenance areas cost / benefit analysis

Change requests by client & specific scenarios should not be automated rather complete functionality should be automated Test cases serve as input to automated scripts these must be developed before automation commencement. Performance of automated testing should be reviewed on periodic and event driven bases to identify particular benefits it is giving.

Mercury WinRunner - Kamran Khan

13

Automated Testing Tools

Regression Testing:
Mercury WinRunner HP Quick Test Professional XRunner for Linux

Load Testing:

HP LoadRunner IBM Rational performance tester JMeter Webload Silk performer

Bugs Repository:
Test Director / Quality Center BugNet, BugZilla, BugTracker (Open Source)

Mercury WinRunner - Kamran Khan

14

Commonly used terms


WR Win runner AUT Application under test GUI Graphical User Interface TSL Test Script Language RTS Rapid Test Scripts FRT Functional Regression Testing MCS Menu-items Checklist Script TD/QC Test Director / Quality Center
Mercury WinRunner - Kamran Khan 15

RTS

Walkthroughs whole application Learns every object on every window Used to check application crash / exception Can be executed on different releases Depends on business process Depends on test cases to be automated Verifies business logic / db / data Reduces manual test case execution time Walkthroughs all of the menu items Used to check differences in menu items between different releases Is cross executed on two releases Multiple test scripts execution in just one click Used for RTS and FTS execution No monitoring required Combined results

FTS

MCS

BTS

Mercury WinRunner - Kamran Khan

16

Work done by SQA-AT

RTS

MCS

CMS

CMS

TLT SNG NissanAu MAU FIAT DCLT DCFST CNH AMF Alamthal

NissanAu DCLT CNH

WFS

WFS

YMFA 2 companies TMFCN TLT 2 companies NissanAu MBFJ 2 companies FIATChina DCST DCSK DCLT DCAFC BMWChina

NissanAu

Mercury WinRunner - Kamran Khan

17

Work done by SQA-AT

FTS

CMS

WFS

SNG

YMFA

Balloon BPIS CTA CTC CTM Business Partner ARM Receipts DD CTA ETM AMS FPP BPIS CTA ETM FPP CTA CTA

Payment Advice Final Settlement Receipt Voucher DAS Settlement Acknowledgement Distributor Interface Loan Approval Payment Advice Receipt Voucher DAS Settlement Acknowledgement Distributor Interface Loan Approval Payment Advice Receipt Voucher Final Settlement

MBFJ1 (MBFJ)

NissanAu

MBFJ2 (PJ)

Fiat

DCLT

CNH

DCLT

Mercury WinRunner - Kamran Khan

18

What is WR?

WinRunner is automation tool, specifically a regression test tool. Used to automate the execution of test cases through scripts in TSL WinRunner is an integrated, functional testing tool for the entire enterprise; by capturing, verifying and replaying user interactions automatically. WinRunner dramatically speeds up the testing process. You can create test scripts that check all aspects of your application, and then run these tests on each new build. As WinRunner runs tests, it simulates a human user by moving the mouse cursor over the application, clicking Graphical User Interface (GUI) objects, and entering keyboard inputbut WinRunner does this faster than any human user. Capable of testing navigation (RTS), Business Logic & Database verification (FRT), MCS, Batch (BTS), Integration with LR and TD

Mercury WinRunner - Kamran Khan

19

Why automate at all?

Few reasons
Running

test manually is boring! Running test manually again and again is frustrating! Running test manually is prone to making mistakes. Write once, run as many times as needed! I have more time now (Time saving!)

Mercury WinRunner - Kamran Khan

20

How does WR do it ?

Record objects (GUI Map) Create scripts/tests Debug scripts/tests Run the scripts/tests Displays/Analyze results

Attention: Please Remind me to show the WR tool as the presentation proceeds

Mercury WinRunner - Kamran Khan

21

GUI Map what is it?

What is it?
AUT is made of UI controls as lists, button controls, edit controls etc. GUI Map Files contains the Physical Description of GUI objects GUI Map files are managed ,edited and modifies in GUI Map Editor GUI Map is a flat file that stores object description and serves as an interpreter between WinRunner and AUT

Why do we need it?


WR needs a mechanism to identify the screen objects of AUT. WR identify screen objects using GUI Map. WR records objects using physical description; uses only those that uniquely identifies the object (an not others as height etc Why?)

Mercury WinRunner - Kamran Khan

22

GUI Map Spy

Whats the spy?


Spy is a utility to confirm that WR is recording the objects right. A tool used to look for the object description. Using the GUI Spy, you can view the properties of any GUI object on your desktop. You use the Spy pointer to point to an object, and the GUI Spy displays the properties and their values in the GUI Spy dialog box. How do I use SPY? Launch it from the WR.

Choose Tools > GUI Spy to open the GUI Spy dialog box.

Mercury WinRunner - Kamran Khan

23

GUI Map Insight

GUI map file mode


WR

has two modes to record the GUI Map file GUI Map file

Global GUI Map file GUI Map file per test This mode enables you to create a GUI map file for your entire application, or for each window in your application. Multiple tests can reference a common GUI map file Recommended for advanced users. (There are other reasons too)

Global

Mercury WinRunner - Kamran Khan

24

How WinRunner Creates GUI Map

Mercury WinRunner - Kamran Khan

25

GUI Map usage

GUI Map file per test

This mode enables WR to automatically create a GUI map file for each test you create. You do not need to worry about creating, saving, and loading GUI map files Recommended for beginners. (There are other reasons too) By using Rapid Test Script Wizard By recording the script directly, this records the objects as they are encountered in AUT GUI Map Editor Learn button

How do I create GUI Maps using WR?


Object Definition Add/ Delete/ Modify objects

Mercury WinRunner - Kamran Khan

26

WinRunner Testing Process

Testing with WinRunner involves six main stages:

Mercury WinRunner - Kamran Khan

27

WinRunner Testing Process

Create the GUI Map The first stage is to create the GUI map so WinRunner can recognize the GUI objects in your application being tested. Use the Rapid Test Script wizard to review the user interface of your application and systematically add descriptions of every GUI object to the GUI map. Alternatively, you can add descriptions of individual objects to the GUI map by clicking objects while recording a test. Create Tests Next, you create test scripts by recording, programming, or a combination of both. While recording tests, insert checkpoints where you want to check the response of the application being tested. You can insert checkpoints that check GUI objects, bitmaps, and databases. During this process, WinRunner captures data and saves it as expected resultsthe expected response of the application being tested. Debug Tests You run tests in Debug mode to make sure they run smoothly. You can set breakpoints, monitor `variables, and control how tests are run to identify and isolate defects. Test results are saved in the debug folder, which you can discard once you finished debugging the test.

Mercury WinRunner - Kamran Khan

28

Run Tests
You run tests in Verify mode to test your application. Each time WinRunner encounters a checkpoint in the test script, it compares the current data of the application being tested to the expected data captured earlier. If any mismatches are found, WinRunner captures them as actual results.

View Results
You determine the success or failure of the tests. Following each test run, WinRunner displays the results in a report. The report details all the major events that occurred during the run, such as checkpoints, error messages, system messages, or user messages. If mismatches are detected at checkpoints during the test run, you can view the expected results and the actual results from the Test Results window. In cases of bitmap mismatches, you can also view a bitmap that displays only the difference between the expected and actual results.

Report Defects
If a test run fails due to a defect in the application being tested, you can report information about the defect directly from the Test Results window. This information is sent via e-mail to the quality assurance manager, who tracks the defect until it is fixed.

Mercury WinRunner - Kamran Khan

29

Getting Started

To start WinRunner: Click Start > Programs > WinRunner > WinRunner. After several seconds, the WinRunner window opens. Note that the WinRunner Record/Run Engine icon appears in the status area of the Windows taskbar. This engine establishes and maintains the connection between WinRunner and the application being tested.

Mercury WinRunner - Kamran Khan

30

You create and run WinRunner tests in the test window. It contains the following key elements:

Test window title bar, with the name of the open test Test script, with statements generated by recording and/or programming in TSL, Mercury Interactives Test Script Language Execution arrow, which indicates the line of the test script being executed (to move the marker to any line in the script, click the mouse in the left window margin next to the line) Insertion point, which indicates where you can insert or edit text

Mercury WinRunner - Kamran Khan

31

The buttons appear by default on the User toolbar:

Mercury WinRunner - Kamran Khan

32

WinRunner Recording Modes

The recording process enables anyone to create and automate tests, so that even users with limited technical background can produce tests. WinRunner includes two modes for Recording tests:
Context

Sensitive Mode Analog Mode

Mercury WinRunner - Kamran Khan

33

CONTEXT SENSITIVE MODE


Context Sensitive mode records your actions on the application being tested in terms of the GUI objects you select (such as windows, lists, and buttons), while ignoring the physical location of the object on the screen. Every time you perform an operation on the application being tested, a TSL statement describing the object selected and the action performed is generated in the test script.

Mercury WinRunner - Kamran Khan

34

ANALOG MODE

Analog mode records mouse clicks, keyboard input, and the exact x- and ycoordinates traveled by the mouse. When the test is run, WinRunner retraces the mouse tracks. Use Analog mode when exact mouse coordinates are important to your test, such as when testing a drawing application.
Mercury WinRunner - Kamran Khan 35

If you are testing an application that contains both GUI objects and bitmap areas, you can switch between modes as you record.
Mercury WinRunner - Kamran Khan 36

Rapid Test Scripting Wizard

The RapidTest Script wizard performs two important tasks:

It systematically opens the windows in your application and learns the description of every GUI object. The wizard stores this information in a GUI map file. It automatically generates tests based on the information it learned as it navigated through the application. GUI Regression Test Bitmap Regression Test User Interface Test Test Template

RTS Types:

Mercury WinRunner - Kamran Khan

37

User Interface Test

The User Interface test determines whether the application complies with the Microsoft user interface standards. It checks that:

GUI objects do not overlap GUI objects are aligned in windows Text labels on GUI objects begin with capital letters Text labels on GUI objects are clearly visible OK and Cancel buttons appear in every window A system menu is available in every window

Mercury WinRunner - Kamran Khan

38

Starting RTS Wizard:


To start the RapidTest Script wizard, either: Click RapidTest Script Wizard in the WinRunner Welcome screen when you start WinRunner Choose Insert > RapidTest Script Wizard at any time.

Click Next in the wizards Welcome screen to advance to the next screen Point to the application you want to test.

Click the button and then click anywhere in the application. The applications window name appears in the wizards Window Name box. Click Next. The wizard can automatically generate tests. Confirm that the User Interface Test check box is selected and that the GUI Regression Test check box is cleared. The User Interface test will check that the application complies with Microsoft user interface standards. Click Next. Accept the default Navigation Controls if you do not need to define additional controls. Click Next
39

Select the User Interface test.

Accept the default navigation controls

Mercury WinRunner - Kamran Khan

Learning flow

The learning flow determines how WinRunner walks through your application. Two modes are available: Express and Comprehensive. Comprehensive mode lets you customize how the wizard learns GUI object descriptions. First-time WinRunner users should use Express mode. Click the Learn button. The wizard begins walking through the application, pulling down menus, opening windows, and learning object descriptions. This process takes a few minutes. The wizard saves the GUI information in a GUI map file. The wizard also creates a startup script. This script runs automatically each time you start WinRunner. It contains a command that loads the GUI map file so that WinRunner will be ready to test your application.

Save the GUI information and a startup script

Save the User Interface test. Click OK in the Congratulations screen

Mercury WinRunner - Kamran Khan

40

WinRunner Play Back Modes

WinRunner provides three modes for running tests. You select a mode from the toolbar.

Use Verify mode when running a test to check the behavior of your application, and when you want to save the test results. Use Debug mode when you want to check that the test script runs smoothly without errors in syntax. Use Update mode when you want to create new expected results for a GUI checkpoint or bitmap checkpoint. Check that WinRunner and the application are still open on your desktop There are two options for running the User Interface Test

Running WinRunner test

Run from Top (it runs the complete test) Run from arrow (it starts running the test after the cursor/arrow location)

Check Run > Run from Top/Run from Arrow or press the button located on Standard Toolbar run the test. Define the name of the directory in which WinRunner will store the results of the test. Accept the default name e.g., res1. Click OK in the Run Test dialog box. WinRunner immediately begins running the UI test. Watch how WinRunner opens each window in the application.

Choose a Test Run name

Run the UI test

Mercury WinRunner - Kamran Khan

41

Mercury WinRunner - Kamran Khan

42

Mercury WinRunner - Kamran Khan

43

How do we write script?

TSL
Acronym

for Test Script Language Similar to Basic Easy to use and comprehend Each statement of the script is a function call Like any other function, it needs error handling You can record or write TSL code manually
Mercury WinRunner - Kamran Khan 44

TSL Script Sample


# launch the new browser instance web_browser_invoke(IE,"http://10.236.133.27:90 80/oms/ActionServlet? userId=U1&handleId=MolsonLogin"); wait(10); seconds = get_time(); new_time = time_str(seconds); report_msg("Test run on : "&new_time);
45

Mercury WinRunner - Kamran Khan

How do we write script?

Recording modes
Context

Sensitive

Operations recorded in terms of GUI objects. WR identifies each object you click (button etc) and each operation you perform (button click etc). E.g. button_press(Ok); WR records exact co-ordinates moved by mouse and keyboard inputs. E.g. move_locator_track (1); mtype ( <kLeft+> );
46

Analog

Mercury WinRunner - Kamran Khan

How do we write script?

Recording modes
Which

one do I use? Normally we use Context Sensitive Mode but if the application requires some special actions as signature of user on a sign-pad then user Analog mode.

Mercury WinRunner - Kamran Khan

47

How do we write script?

Why do I need parameterization?


There

might be a test case that needs to be run for different data sets E.g. A login script that is recorded for a AUT may need to be run again with different role login id and password.

Mercury WinRunner - Kamran Khan

48

How do we write script?


Record

Replay

How do i perform parameterization?


Manually write the TSL code (err..), or Use Data Driver Wizard

Verify

To check AUT To debug test

Debug Update
To updated expected values Enhance script by adding functions Adding checkpoints and putting custom messages on report

Mercury WinRunner - Kamran Khan

49

Checkpoints

What are they?


To verify the test actual results we use check points They compare the actual results with expected results Set the test case status to pass or fail based on checkpoint A script is useless without checkpoint

How do i add them?

WR has menu-items for the same. They are single click away while recording scripts.

Color coded test results


Passed Failed

Mercury WinRunner - Kamran Khan

50

Checkpoints

Various checkpoints
- By adding GUI checkpoints to your test scripts, you can compare the behavior of GUI objects in different versions of your application.

GUI Checkpoints

GUI Checkpoint for Single property GUI Checkpoint for Object/Window GUI Checkpoint for Multiple Objects

Create->GUI Checkpoint->For Single Property Create->GUI Checkpoint ->For Object/Window Create->GUI Checkpoint->For Multiple Objects

- To check the status of GUI objects. e.g. check if a button is enabled/disabled.

Bitmap Checkpoints
-

To check for bitmaps and graphics. Not recommended to have them in script.

Database Checkpoints
- To check if a transaction stores proper data in database.

Mercury WinRunner - Kamran Khan

51

Checking a Single Property Value in WR

You can check a single property of a GUI object. For example, you can check whether a button is enabled or disabled or whether an item in a list is selected. Choose Create > GUI Checkpoint > For Single Property. If you are recording in Analog mode, press the CHECK GUI FOR SINGLE PROPERTY soft key in order to avoid extraneous mouse movements. Click an object. The Check Property dialog box opens and shows the default function for the selected object. WinRunner automatically assigns argument values to the function. You can modify the arguments for the property check. To modify assigned argument values, choose a value from the Attribute list. The expected value is updated in the Expected text box. Click Paste to paste the statement into your test script.The function is pasted into the script at the insertion point. The Check Property dialog box closes.

Mercury WinRunner - Kamran Khan

52

GUI checkpoint using Default Checks


You can create a GUI checkpoint that performs a default check on the property recommended by WinRunner. For example, if you create a GUI checkpoint that checks a push button, the default check verifies that the push button is enabled. To create a GUI checkpoint using default checks: Choose Create > GUI Checkpoint > For Object/Window, or click the GUI Checkpoint for Object/Window button on the User toolbar. If you are recording in Analog mode, press the CHECK GUI FOR OBJECT/WINDOW softkey in order to avoid extraneous mouse movements. Note that you can press the CHECK GUI FOR OBJECT/WINDOW softkey in Context Sensitive mode as well. The WinRunner window is minimized, the mouse pointer becomes a pointing hand, and a help window opens on the screen. Click an object. WinRunner captures the current value of the property of the GUI object being checked and stores it in the tests expected results folder. The WinRunner window is restored and a GUI checkpoint is inserted in the test script as an obj_check_gui statement.

Mercury WinRunner - Kamran Khan

53

GUI Checkpoint by Specifying the Properties to Check

You can specify which properties to check for an object. For example, if you create a checkpoint that checks a push button, you can choose to verify that it is in focus, instead of enabled. To create a GUI checkpoint by specifying which properties to check: Choose Create > GUI Checkpoint > For Object/Window, or click theGUI Checkpoint for Object/Window button on the User toolbar. If you are recording in Analog mode, press the CHECK GUI FOR OBJECT/WINDOW softkey in order to avoid extraneous mouse movements. Note that you can press the CHECK GUI FOR OBJECT/WINDOW softkey in Context Sensitive mode as well. The WinRunner window is minimized, the mouse pointer becomes a pointing hand, and a help window opens on the screen. Double-click the object or window. The Check GUI dialog box opens

Mercury WinRunner - Kamran Khan

54

Checking Bitmaps:

By adding Bitmap checkpoints to your test scripts, you can compare the Bitmap in different versions of your application. Win Runner Provides Two Types of Bitmap Checkpoints

Bitmap checkpoint of Screen Area Bitmap Checkpoint for Object/window

GUI Checkpoint can be inserted in WinRunners Test Script as:


Create Bitmap Checkpoint For Screen Are Create Bitmap Checkpoint For Object/Windwow

Mercury WinRunner - Kamran Khan

55

Synchronization Points
There are three kinds of synchronization points: Object/window synchronization points When you want WinRunner to wait for an object or a window to appear, you create an object/window synchronization point. Property value synchronization points When you want WinRunner to wait for an object or a window to have a specified property, you create a property value synchronization point. Bitmap synchronization points. When you want WinRunner to wait for a visual cue to be displayed, you create a bitmap synchronization point. In a bitmap synchronization point, WinRunner waits for the bitmap of an object, a window, or an area of the screen to appear. Caputuring text from AUT Screen By Using WinRunner User can capture the text displayed on the screen. By Capturing the text from screen area. Use:

Create->get text ->From Screen Area Create->Get Text->From Object/Window

Mercury WinRunner - Kamran Khan

56

Maintaining Tests

Debugging tools

Step by step Breakpoints Watch list Add objects and write custom code Modify existing objects definition

GUI Map Editor


Function Generator Documentation


Supported Environments Documentation and Other Resources

Mercury WinRunner - Kamran Khan

57

TD connection
What is TD? WR can connect to TD. TD can launch WR and hence execute scheduled tests. User menu-item Tools->TD Connection. TD can save results of test if WR is launched from TD.

Mercury WinRunner - Kamran Khan 58

Batch mode

Batch mode runs scripts in batch mode. WR breaks the test/script execution when a mismatch or error is detected. Batch mode causes WR to suppress this message. Excellent option for overnight runs (unattended execution) !
Mercury WinRunner - Kamran Khan 59

Practical !

Install WR, if not installed already! Use Rapid Test script Wizard to record the GUI Map for the application flight2a.exe located in dir WR-installdir\Mercury Interactive\WinRunner\samples\flight\app. Password is mercury, login can be any. Record a login script for flight2a.exe and parameterize the script for the various login names Use WR to record a script to visit yahoo page, perform a search, add a object checkpoint and check results.

Mercury WinRunner - Kamran Khan

60

Q&A

Mercury WinRunner - Kamran Khan

61

Mercury WinRunner - Kamran Khan

62

You might also like