Professional Documents
Culture Documents
2
(Final Release)
Presented by: Kamran Shaukat Ali Khan www.chromeinstitute.com Last Updated: 20090224
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
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?
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 !
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
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.
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.
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
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
10
Non Repeatable ASAP testing Heuristics Performance & Stress testing Covered in Automated Performance Testing tools
Ad-hoc Testing
Usability Testing
Load testing
11
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
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.
13
Regression Testing:
Mercury WinRunner HP Quick Test Professional XRunner for Linux
Load Testing:
Bugs Repository:
Test Director / Quality Center BugNet, BugZilla, BugTracker (Open Source)
14
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
16
RTS
MCS
CMS
CMS
TLT SNG NissanAu MAU FIAT DCLT DCFST CNH AMF Alamthal
WFS
WFS
YMFA 2 companies TMFCN TLT 2 companies NissanAu MBFJ 2 companies FIATChina DCST DCSK DCLT DCAFC BMWChina
NissanAu
17
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
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
19
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!)
20
How does WR do it ?
Record objects (GUI Map) Create scripts/tests Debug scripts/tests Run the scripts/tests Displays/Analyze results
21
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
22
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.
23
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
24
25
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
26
27
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.
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.
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.
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
31
32
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
33
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
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:
37
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
38
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
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.
40
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
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.
41
42
43
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
# 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
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
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.
47
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.
48
Record
Replay
Verify
Debug Update
To updated expected values Enhance script by adding functions Adding checkpoints and putting custom messages on report
49
Checkpoints
WR has menu-items for the same. They are single click away while recording scripts.
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
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.
51
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.
52
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.
53
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
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
Create Bitmap Checkpoint For Screen Are Create Bitmap Checkpoint For Object/Windwow
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:
56
Maintaining Tests
Debugging tools
Step by step Breakpoints Watch list Add objects and write custom code Modify existing objects definition
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.
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.
60
Q&A
61
62