Automation Tool QTP

30
Automation Tool - QTP

Transcript of Automation Tool QTP

Page 1: Automation Tool  QTP

Automation Tool - QTP

Page 2: Automation Tool  QTP

QTP stands for Quick Test Professional, a product of Hewlett Packard (HP). This tool helps testers to perform an automated functional testing seamlessly without monitoring once script development is complete. HP QTP uses Visual Basic Scripting (VBScript) for automating the applications ..Quick Test is a graphical interface record-playback automation-testing tool. It is able to work with any web or windows application.

Page 3: Automation Tool  QTP

QTP Testing ProcessCreating test plan

Recording a session on application

Enhancing the test by inserting checkpoints, parameterization statements, or inserting logical statements in the test

Running a session of the test

Analyzing the test results from test fusion report

Reporting defects if any by connecting with quality center.

Page 4: Automation Tool  QTP

Object RepositoryWhen we record a test, QuickTest adds each object on which we perform operations to a file called local object repository so it can identify objects during run-time.

We can also add objects to the local object repository while editing our test. Test objects can be stored in two types of object repositories—a shared object repository and a local object repository.

Page 5: Automation Tool  QTP

Types of Object RepositoryThere are two types of object repository:

Shared Object Repository Local Object Repository

A shared object repository stores test objects in a file that can be accessed by multiple tests.

A local object repository stores test objects in a file that is associated with one specific action, so that only that action can access the stored objects.

Page 6: Automation Tool  QTP

Managing Shared Object Repository

Shared Object Repository can be created two ways:

After creating the recording go to Object Repository window from Resource > Object Repository. Then File > Export Local Objects. Save the file at specific location with .tsr extension

We can Manage Shared Object Repository also from Resource > Object Repository Manager

Page 7: Automation Tool  QTP

Shared Repository can be Accessible to any Test from Resource > Associate Repositories or From Keyword view – Right Click the Action Name, Click Action Properties > Associated Repositories

If user wants some change in Shared Object Repository then user can go to Object Repository > Right click on the component to change > Click on “Copy to Local” and can modify the component. This modified Object Repository will be saved with test but will not affect the Original Shared Object Repository.

If User wants this change to already saved Shared Object Repository, then User can do it from Object Repository Manager by Opening the Shared Object Repository then Enable Editing from File > Enable Editing. Then Tools > Update From Local Repository.

Page 8: Automation Tool  QTP

How QTP Identify Objects?QuickTest uses some properties for every test object to identify that object during run time.Properties values of test object are captured from object while recording. QuickTest uses the values of these properties to identify objects in the application during a run session.These are mandatory properties. If mandatory properties are not enough to uniquely identify an object, QuickTest adds some assistive properties. If several assistive properties are defined for an object class, then QuickTest learns one assistive property at a time and stops as soon as it creates a unique description for the object.

Page 9: Automation Tool  QTP

If QTP is unsuccessful to identify an object uniquely with both mandatory and assistive properties it use smart identification mechanism (Base Filter Properties & Optional Filter Properties). If both the learned description and smart identification fails, QTP uses ordinal identifier (Index, Location, and Creation Time properties).In order to configure the mandatory, assistive, and ordinal identifier properties and to enable and configure the Smart Identification mechanism, you can use Object Identification dialog box (Tools > Object Identification).

Page 10: Automation Tool  QTP

How QTP Identify Objects?

Page 11: Automation Tool  QTP

Output ValueOutput values enable to capture the values that the application generates during run time. When parameterized, the values change for each iteration. Thus by creating output values; we can capture the values for each run and output and store them to the data table. These values can be used later in the different point in application.

Page 12: Automation Tool  QTP

Output values are stored in run time data table; it is located in QTP result window and can be retrieved later.

Types of Output Values:1. Standard output value2.Text output value3. Database output value4. XML output value

Page 13: Automation Tool  QTP

Output Value Types1) Standard output value: We can use standard output values to output the properties values of most objects.We can use Standard Output value under Recording mode from Insert menu >output value> standard output value.2) Text output value:We can use Text output values to output text strings displayed in an application. When creating a text output value we can output a part of the objects text and we can also specify text before and after options.

Page 14: Automation Tool  QTP

We can use Standard Output value under Recording mode from Insert menu >output value> text output value.3) Database output value:We can use Database output values to output the values stored in database table.We can use Standard Output value from Insert menu >output value> database output value.

4) XML output value:We can use XML output values to output the values of XML elements in XML documents.We can use Standard Output value under Recording mode from Insert menu >output value> xml output value.

Page 15: Automation Tool  QTP

ActionsActions break up the test into logical sections/units such as specific activities that we perform in our application.

Page 16: Automation Tool  QTP

Types of ActionsThere are two types of actions: Reusable actions Non-reusable actions

Reusable actionCan be used in other testsCan be used in same test, multiple times

 Non-reusable actionCannot be used in other testsCan be called in the same test, only once.

Page 17: Automation Tool  QTP

Global Sheet and Local SheetGlobal DatasheetUnique for the entire testSheet is named “Global”Any action can access and write data into Global DatasheetGlobal Sheet: All Actions in the test are iterated Local DatasheetEqual to number of actionsSheet is named “Action Name” of “Local Sheet”An action can read and write data into its own local datasheet onlyLocal Sheet: Only corresponding action in test is iterated

Page 18: Automation Tool  QTP

Library FunctionsIf we have repeatable steps in a test or in an action then we can use user-defined functions. User defined functions will make our test look shorter, easier to maintain. Time and resources can also be saved by implementing and using these user-defined reusable functions. User defined functions can be stored in a function library or within an action in the test. If the function is stored in a function library then we have to associate that function library to the test so that the test can call all the functions listed in that library.We can associate the function library to the test from File Settings Resources Tab. 

Page 19: Automation Tool  QTP

Functions in an associated function library can be accessible:From Step Generator, From Operation column in keyword view, or by manually entering the function name in the expert view. We can create new function library by selecting File >> New >> Function Library. Functions in library file can be created manually or by using Function Definition Generators. We can save this file at a specified location with .qlf (by default) or .vbs or .txt extension 

Page 20: Automation Tool  QTP

There are two types of functions:: Private Functions and Public Functions

Private Functions: These can be accessed from within the function library itself and cannot be accessed from outside this function library.

Public Functions: These can be accessed from any function library.

Page 21: Automation Tool  QTP

Object SpyUsing the Object Spy, we can view the properties of test object and their values in an open application.There are two ways to use object spy in QTP 

We can select Object Spy option from Tool Menu in QTP  We can select Object Spy option from Object repository Window by selecting Tools Object Spy 

Page 22: Automation Tool  QTP

Environment VariablesA variable declared and initialized in one action using Dim statement can’t be used in other actions or Test. So, by using environment variables we can use the variables in different actions.

There are two types of environment variables:1. User-defined (internal, & external) Note: we can’t change the value of external environment variables.2. Built-in Note: we can’t change value of these variables.  To set the value of a user-defined environment variable:Environment.value (“VariableName”) = NewValue

Page 23: Automation Tool  QTP

Analog & Low-Level RecordingLow-level recording: It is used in case qtp is unable to recognize some objects and its properties. It is based on mouse clicks and the x, y co-ordinates that is instead of taking that object, will take the x, y co-ordinates of that object.Analog recording: This mode records every moment of mouse as we drag the mouse around the screen or application window.Useful for recording operations that cannot be recorded at the level of an object. E.g., A signature produced by dragging the mouse will be recorded in analog. 

Page 24: Automation Tool  QTP

Analog recording and low-level recording require more disk space than normal recording mode.

By-default recording mode is normal recording. We can switch to either Analog Recording or Low Level Recording in the middle of a recording session for specific steps. After we record the necessary steps using analog recording or low-level recording, we can return to normal recording mode for the remainder of our recording session.

Page 25: Automation Tool  QTP

Difference between Wait & Synchronization Point?Wait: In wait point, though the job is completed less than the specified time, it will wait for the specified time to be elapsed and then only we will have the result summary or move to the next job. Synchronization: once the job has been completed, we immediately gets the result sheet or we move to the next iteration. It won’t wait for the specified time to be elapsed.

Page 26: Automation Tool  QTP

What’s the TransactionWe can measure how long it takes to run a section of our test by defining transactions.Transaction modes are: Start transaction, End transactionWe can also use MercuryTimers() function also like:MercuryTimers("Timer1").StartMercuryTimers("Timer1").Stop()And also we can fetch the time taken to load a particular step in a variable like:Dim aa=MercuryTimers("Timer1")

Page 27: Automation Tool  QTP

Invoke the web application

We can invoke the web/window application with use of systemutil.run("WebPath”) command in the Expert View

 e.g. systemutil.Run "iexplore.exe", www.ning.com

Page 28: Automation Tool  QTP

Test Fusion ReportOnce the tester run the test, a Test-Fusion report displays all aspects of the test run: a high-level results overview, an expandable Tree View of the test specifying exactly where application failures occurred, the test data used, application screen shots for every step that highlight any discrepancies, and detailed explanations of each checkpoint weather pass or failure.

By combining Test-Fusion reports with Quality center, we can share reports across an entire QA and development team.

Page 29: Automation Tool  QTP

Benefits1. Test automation enables one to achieve detailed product testing with significant reduction in test cycle time.2.The efficiency of automated testing incorporated into product lifecycle can generate sustainable time and money savings. 3. Reliability4. Consistency5. Accuracy6. re-usability 7. Better, faster testing8. The up-most advantage of automation testing is that we need not have to do the testing on the same modules again & again. We can plan, record, enhance the script, & run the test script as and when desired.

Page 30: Automation Tool  QTP