Friday, 22 April 2011

Checkpoints in QTP

A checkpoint is a verification point that compares a current value for a specified property with the expected value for that property.

TYPES OF CHECKPOINTS

  1. Standard Checkpoint
  2. Bitmap checkpoint
  3. Text checkpoint
  4. Text Area checkpoint
  5. Database checkpoint
  6. XML Checkpoint
 TYPES AND THEIR USE

1. STANDARD CHECKPOINT : Checks the property value of the object in an application or  Webpage. It checks buttons,Radiobuttons,Comboboxes etc.

2. BITMAP CHECKPOINT : Checks the value of an image in the application.

3. TEXT CHECKPOINT : Checks whether the text string is displayed in the appropriate place in your application or on a Web page.

4. DATABASE CHECKPOINT : Checks the contents of a database accessed by the application.

5. XML CHECKPOINT : Checks the data content of XML documents in the application.



WHEN TO USE CHECKPOINTS 


  1. Before creating checkpoints on web objects we have to select web-test option in ADD-IN Manager.
  2. If the objects developed in HTML we can use Standard Check point.
  3. If the Objects developed in XML we can use XML Check point.
HOW TO ADD CHECKPOINTS








 














Synchronization in QTP

WHAT IS SYNCHRONIZATION ?
    Synchronization refers to adding a step in the script that instructs Quick Test to wait for a particular object before proceeding to the next step during playback.
   
When do you need SYNCHRONIZATION ?
       When you observe that the application takes a longer time to process information sent or respond to a client request, add a synchronization step while recording. For example:
    - A progress bar to reach 100%.
    - A button to become enabled.
    - A window or pop-up message to open.

HOW TO ADD SYNCHRONIZATION

  1. Synchronization can be added ONLY during recording.
  2. Identify the object to be synchronized.
  3. Navigate to the window where the object is located.
  4. Locate the step in the test that corresponds to the object.
  5. Start recording and add the synchronization point. 
TWO WAYS TO SET SYNCHRONIZATION

1. Global synchronization value for all Objects.  
Instructs Quick Test to wait for all the objects for a specific amount of time.

 2. Synchronization of a specific Object.
 Instructs Quick Test to wait for a specific object only.


GLOBAL SYNCHRONIZATION VALUE FOR ALL OBJECTS

















Menu -> Test-> Settings-> Run

For every object in the test, Quick Test can wait a maximum number of milliseconds specified in the settings.

SYNCHRONIZATION OF SPECIFIC OBJECT




























Menu -> Insert -> Step -> Synchronization Point
Quick Test shall pause the test until the object property achieves the value specified here (or until the specific timeout amount is exceeded).
Quick Test uses one of the object’s properties as the waiting criteria. E.g. ‘Text’ property for window, ‘Label’ property for buttons etc.

   


Object Spy & Object Identification

  • Object Spy can be used to view the properties and values of an object in any open application.
  • Click the pointing hand to select the object in the application. 
  • The object’s properties (Test object properties and Run-Time object properties) and methods can be identified. The object’s hierarchy tree is also displayed.
  • To perform other events such as mouse clicks or window focus hold the CTRL key.





















OBJECT IDENTIFICATION









Tuesday, 19 April 2011

How Quick Test works with Objects?

What are Object Properties?
A set of characteristics that defines an object’s appearance, values, state and identity in an application.
QTP captures these object properties during recording.

Logical Name – Logical name is a value QuickTest usually takes from one of the object properties (like TEXT) to refer to the object in the recorded script.

Object Repository


What is Object Repository?

Object Repository is a location within the test structure where QuickTest stores object information captured during recording.

The Object Repository can be used to:
  • Rename logical names for readability.
  • Add a new object in the repository.
  • Configure the object properties used to identify an object.

Screenshot of Object Repository



















  • The Object Repository can be Per Action or Shared.
  • The shared repository can be used by multiple actions of the same test or by actions from different tests. Test object properties are prone to frequent updation.
  • Per Action object repository is used by one or very few tests.Test object properties are modified less frequently.



Viewing the Test Results


Test results can be stored in their own location (for documentation) or in a temporary location that is overwritten each time the test is run (debugging).   


Running a Session

  1. The Run option can be used to run the test from start to end.
  2. The Run from Step option in the Test menu is used to run the test from a selected step to the end of the current action, if running from the Expert View, or to the end of the test , if running from the Keyword View. Thus it enables us to check a specific part of the application or to confirm that a certain part of the test runs correctly.
  3. The Update Run option in the Test menu is used to update the Active screens, Checkpoints and the test object descriptions.

Verify Successful Playback

Use the ‘Run’ button to begin playback from the top of the test.
Select the location of the test results- either a new results folder or a temporary folder.




Saving Quick Test Professional

The test can be saved into a Windows file system (as given below screenshot).
If TestDirector is available and connected with QTP, the test can be saved there.
QTP creates an entire structure of files and directories to support a single QuickTest script for each saved test.




Different Recording Modes for running QTP

There are 3 Recording modes as given below:

Normal: Normal Mode recognizes the objects in the application irrespective of their location in the screen.

Analog: Analog Mode records the exact keyboard and mouse operations with respect to the screen coordinates or the application window.

Low level: Low Level Mode records any object irrespective of support from QTP.
                  Recognizes all run time objects as windows objects. It is used when an object is not identified by
                  Quick test.

Basic Test for Running QTP Scripts


There are basically 3 steps for Running QTP Scripts:

  1. Record user actions
  2. Save the test
  3. Verify successful playback
Record User Actions



Start recording on the Mercury Tours Web site.
Choose Test > Record or click the Record button.
The Record and Run Settings dialog box


In the Windows Applications tab, confirm that Record and run on these applications (opened on session start) is selected, and that there are no applications listed.

This setting prevents you from inadvertently recording operations performed on various Windows applications (such as e-mail) during a recording session.

Click OK.

















Expert View of QTP Tool


Keyword View of QTP tool


Add In Manager of QTP


WHY QTP?


Ease of use:

1.QTP allows even novice testers to be productive in minutes. You can create a test script by simply pressing a Record button and using an application to perform a typical business process.

2. Using the Active Screen facility, several types of checkpoints for any object to verify that components behave as expected can be created simply by clicking on that object in the Active Screen.

3. Data Table, an integrated spreadsheet with the full functionality of Excel, is used to manipulate data sets and create multiple test iterations, without programming, to expand test case coverage.

4. QuickTest Professional supports functional testing of all popular environments, including Windows, Web, .Net, Visual Basic, ActiveX, Java, SAP, Siebel, Oracle, PeopleSoft, terminal emulators, and Web services .

QTP Introduction

Mercury Quick Test Professional 8.2 provides the industry’s best solution for functional test and regression test automation - addressing every major software application and environment.

Importance of Automation Testing

Software Testing plays a very important role in Software Development Life Cycle.
Like Manual Testing , Automation testing has its own importance.
  • "To Error is Human" is the fact which drives the need for automation testing. Because, manual testers may not execute the test cases correctly. There will be lot of possibilities for making mistakes. They may give wrong input data due to typo, or they may not notice the actual behavior of the system correctly, or they may not report the test result correctly, or they may miss to execute some test cases, or they may forget to run some preconditions, or they may change the sequence of test case execution in case sequence is important.
  •  
  • Another important factor is, Automation test scripts will be used as a way of storing domain/project/task Knowledge gained by the Test Engineers. Say for example, if a Tester works in project for one year, he might have spent more time for learning the domain, purpose of the project, modules in the project, flow of all functionalities. He will be familiar with known issues and challenges.
    If this Tester leaves from the project, the knowledge gained by him also will leave.
    It is very difficult for the newly joining Tester to understand everything from the Test Case document.

    If automation test scripts are already available then the new Tester can just start the testing by running the automation scripts, without gaining much knowledge about the project.

    He can understand the flow/data by seeing the execution of the automation test scripts. But anyway, he should gain project/domain knowledge to enhance/update the automation scripts further.
    So we can say that test automation is a way of storing knowledge.
  • Automation tool such as QTP (Quick Test Professional) has feature for storing screenshot of each and every page navigated during the execution. So it can be used as a proof for completion of testing, and also we can refer the screenshots of previous executions if there is any need to refer them.
  • Test report can be automatically written to a customized report page which will ensure accuracy of the report and also it can improve look & feel of the report.
  • The very important advantage of automation testing over manual testing is, execution speed. Test execution can be completed quickly and also we can execution the scripts in night time also without human involvement. So ultimately total time needed for testing can be reduced which will significantly help for timely project completion.
  • There may be requirement of doing some testing at specific time. It can be easily achieved by putting execution of those automation test scripts in a task scheduler/crone job. The tool such as QTP supports automation object model to achieve this.
  • The functional test automation scripts will be useful for doing performance testing also. Because many performance test tools will support reusing/calling of these test scripts.
  • Some type of testing involves comparing large amount of data between previous version and current version as part of regression testing. Practically it may not possible for doing it manually. This problem can be easily solved by simple shell script or any other scripts such as vbs, wsh.
  • As the automation test tools support Data Driven Testing, Test execution can be done repeatedly with many different data sets.
There are lot of automation test tools available for doing Functional, Regression and Performance Testing. Test complete, SilkTest,SilkPerformer, QARun, QALoad, TestPartner, WinRunner, LoadRunner, QTP, Rational Robot and openSTA are some of them. QTP  is most widely used now as it supports vbscript and it can be used for testing many different applications just by adding required add-ins.