Quick Test Professional Session-1

 What is Automation Testing ? Benefits

Quick Test testing process consists of 7 main phases

     

Preparing to record  Test Environment  Test Conditions Recording a session on the application Enhancing the test Debugging the test Run Test Analyzing the test results Reporting defects

Documents used to test the application
A collection of steps organized into one or more actions, which are used to verify that the application performs as expected.

Business Components
A collection of steps representing a single task in the application. Business components are combined into specific scenarios to build business process tests in Mercury Quality Center with Business Process Testing.

Creating Tests and Enhancing
 Add steps to your test, in either or both of the following ways • Record a session on your application or site. • Build an object repository and use these objects to add steps manually in the Keyword View or Expert View. Insert checkpoints to compare the value of an element captured in the test when you recorded it, with the value of the same element captured during the test run. Broaden the scope of the test or component by replacing fixed values with parameters. Use the many functional testing features included in QTP to enhance the test or component and/or add programming statements to achieve more complex testing goals.

  

Running test
Run the test or component to check your site or application QTP connects to the Web site or application and performs each operation in the test, checking any text strings, objects, or tables specified. Run the test or component to debug it. Control your run session to help you identify and eliminate defects in your test or component. You can use the Step Into, Step Over, and Step Out commands to run your test or component step by step.

Analyzing Tests and Reporting Defects

View the results in the Results window Report defects detected during a run session If Quality Center is installed, you can report the defects discovered to a database. Can instruct QTP to automatically report each failed step in the test or component, or can report them manually from the Test Results window

Quality Center

Quality Center
You can create a project of manual and automated tests and components, build test cycles, run tests and components, and report and track defects. You can also create reports and graphs to help you review the progress of test planning, runs, and defect tracking before a software release.

QTP Layered Architecture
Logical name Layer1

Physical Description Layer2



QTP High-level features
         Object Spy Object Repository Object Identification Key Word View Expert View Active Screen Technology Data Tables (Global, Local) Recovery Various Add ins

Object Spy
• • It is used to view object properties and Methods Displays • Object hierarchy tree • Run-time object properties & methods Test object properties &methods

Object Repository
Interface between QTP Script and the Application Contains Logical Name and physical Description

Locate object in repository

Find data-dependant


  

Parameterize property’s Value

Object Repository
 Object Repository acts as a translator between QTP script and the Operating System. QTP stores information it learns about a window or an object in object repository When QTP runs a test, it uses the object repository to locate objects. QTP reads an object’s description in the repository and then looks for an object with the same properties in the application under test.

 

How QTP Stores Objects

Generates Script

Adds objects using object identification settings

Object Repository


Object Repository

 Types of Object Repositories
• Per Action Object Repository • Shared Object Repository

Per Action vs Shared Object Repository

Per Action Object Repository
  Separate action repository for each action. If an object description changes, you need to modify the object in every action repository using that object. No need for any Object Repository administrator. Preferred method if application won’t change during renovation Default Object Repository. Preferable for novice QTP users.

Shared Object Repository
  Can use the same shared object repository file for multiple tests. If an object description changes, you only have to modify in the shared Object Repository – all tests will playback properly. Requires Shared object repository creation and maintenance. Crucial if application may change during renovation Most commonly used across Automation projects.

   

  

Object Repository Per Action







Shared Object Repository


Object Identification

How are the objects recognized?
 While recording, for each test object class, QTP learns a list of mandatory properties to uniquely identify the object.  If not sufficient, QTP adds assistive properties until it has compiled a unique description.  If no assistive properties are available or if not sufficient, QTP adds a special an Ordinal identifier type as index, location and creation time of the objects are used to create a unique identification.

Smart Object Identification

 A sophisticated object recognition mechanism allows tests to automatically recover when object properties are not found during execution.  Quick Test now evaluates application object properties upon test playback, and can make decisions based on logical property matches, even if the recorded object properties are not present.  Can map an unidentified or custom class to a standard Windows class.

Smart Object Identification
Base filter properties
The most fundamental properties of a particular test object class

Optional filter properties
Other properties that can help identify objects of a particular class as they are unlikely to change on a regular basis.

Keyword View, Expert View
Keyword View
The Keyword View enables to create and view the steps of your test or component in a keyword-driven, modular, table format . The Documentation column of the Keyword View also displays a description of each step in easy-to-understand sentences.

Expert View
In the Expert View, QTP displays each operation performed on the application in the form of a script, comprised of VBScript statements.

Active Screen, Data Table, Debug Viewer pane
Active Screen Provides a snapshot of your application as it appeared when you performed a certain step during the recording session. Data Table Assists in parameterizing the test or component. For a test, the Data Table contains the Global tab and a tab for each action. For a component, the Data Table contains single tab. Debug Viewer pane Assists in debugging the test or component. The Debug Viewer pane contains the Watch Expressions, Variables, and Command tabs

Expert View,Active Screen, Data Tables

Keyword and Expert View Relation

• Test Objects hierarchy can be seen in both the Keyword View and the Expert View

Recovery Scenario

Unexpected events, errors, popup window, message, link and application crashes during a test run can disrupt the test and distort test results. This is a problem particularly when running tests unattended—the test is suspended until you perform the action needed to recover.


In QTP the Recovery Scenario Manager provides a wizard that guides you through the process of defining a recovery scenario—a definition of an unexpected event and the operation's necessary to recover the test run.
 Select the trigger event type that will trigger the recovery  Select the recovery operation  Select the post-recovery test run operation  Provide a name and description for the recovery scenario

Add ins
Default Add ins ActiveX Multimedia Visual Basic Web Available Add ins Java .Net etc..

Enhancing Tests
1. Parameterizing Tests 2. Creating Output Values 3. Creating Checkpoints 4. Regular Expressions 5. Dividing Tests into Multiple Actions 6. Inserting Transactions. 7. Synchronization point. 8. Calling External Libraries.

To check how the application performs the same operations with multiple sets of data.       QTP supports Data Driven Testing Can use the Data Driver Wizard to parameterize the tests. Stores data file with extension .XL Two types of sheets within the data table “Global” and “Action” Parameterization allows us to pick different values at run time. Reduces Time and Effort. Parameterization can also be done for checkpoints

Output values

An Output value is a step in which one or more values are captured at a specific point in the test. Can create an output value for a check point to update its expected value.  Can capture status bar messages  Can capture object properties and text  Can store the values in a variable or table

Check points
A checkpoint is a step in the test that compares the actual values of a specified object property to an expected value of the same property.
         Standard Checkpoint Database Checkpoint Table Checkpoint Bitmap Checkpoint Image Checkpoint XML Checkpoint Accessibility Checkpoint Page checkpoint Text / Text Area Checkpoint

Regular Expressions
  Enable QTP to identify objects and text strings with varying values. A regular expression is a string that specifies a complex search phrase using special characters ‘.’, ‘*’, ‘^’, []. Can be used for object properties, methods of an argument, when parameterizing, when creating checkpoints.

Dividing Tests into Multiple Actions
   Actions can divide a test into several distinct business Processes. Each action signifies a logical independent test. To divide a test into actions you can  Insert a New Action  Split an existing action into two Actions  Insert a copy of an existing Action  Insert a call to an existing Action In this way several actions can be integrated to each other within the test or across different tests logically, which enables to design more modular and efficient tests.

Inserting Transactions
  A transaction represents the process in the application that we are interested in measuring. Transaction Response Time is used to measure the response time of any transaction  Can be done for a single transaction  Can be done for multiple transactions Results are logged in Test results log for every iteration Response time measured from start to end of one iteration (within login and logoff)

 

Synchronization point

A synchronization point handles anticipated timing problems by synchronizing the test to ensure that QTP waits till the application achieves a certain status.

Why Synchronize?

 Without synchronization point
rip t T Sc AU

With synchronization point
rip t Sc AU T

Run script Inputs data to AUT Attempts next step Script fails

Run script Accepts input Sends data to database server Waits for server; cannot continue Inputs data to AUT

Accepts input Sends data to database server



Client affirms transaction is complete

Calling External Libraries
Library file is a VB script file containing code in VB Script format. Library files in QTP are used to declare functions that are needed to be used across actions.
There are two ways to load a Library file in the test. Specify the Library file in the settings of the script. For declaring Global Variable, Functions, classes etc… Loading the library file at run-time. We can load it at run-time by using the execute file function. For loading libraries depending upon conditions at run-time

Recording Modes
 Normal recording  Records the objects in your application and the operations performed on them. This mode is the default and takes full advantage of Quick Test’s test object model. Analog Recording  Record the exact mouse and keyboard operations you perform in relation to either the screen or the application window. Low-Level Recording

Record on any object in your application, whether or not Quick Test recognizes

specific object or the specific operation.


Record and Playback
Advantages  Useful in determining how the QTP interacts with the application under test.  Provides initial ideas on how to develop test scripts.  Useful while ‘Playing around’ with the tool Disadvantages  Test scripts contain hard-coded values.  This is not a viable cost-effective test automation approach for long term.

 After running a test, we can view a report of major events that occurred during the test run.  The Test Results window contains a description of the steps performed during the test run.  If the test contains Data Table parameters, and the test settings it shows on Test Results window.  Results are grouped by the actions in the test.