1. What are the Features & Benefits of Quick Test Pro (QTP)?
- Key word driven testing
- Suitable for both client server and web based application
- VB script as the script language
- Better error handling mechanism
- Excellent data driven testing features
2. How to handle the exceptions using recovery scenario manager in QTP?
During test run, unexpected events and/or error may interrupt the test run or give invalid test result. This event and/or error does not permit automated test to navigate the screen, module or features that need to be tested. This unexpected event or error is called exception. QTP has feature to handle these type of exception during test run is called Recovery Scenario.
During test run, unexpected events and/or error may interrupt the test run or give invalid test result. This event and/or error does not permit automated test to navigate the screen, module or features that need to be tested. This unexpected event or error is called exception. QTP has feature to handle these type of exception during test run is called Recovery Scenario.
Component:
- Trigger Events: Specify the exception that may occur.
It has four components:
i. Popup Window: If a popup window appears in an open test run
ii. Object State: If a mismatch between expected and actual state of an object during test run
iii. Test Run Error: If a test step fail during test run
iv. Application Crash: If open application fails during test run
- Recovery Steps: Instruct QTP how to handle the exception
i. Keyboard or Mouse operation
ii. Close the application
iii. Function Call
iv. Restart Microsoft window
- Post Recovery Test Run: Instruct QTP how to proceed after recovering from exception
i. Repeat current steps and continue
ii. Proceed to next step
iii. Proceed to next action or component iteration
iv. Proceed to next test run
v. Restart the current test run
vi. Stop the test run
Note:
- Recovery Scenario Wizard open
Resources > Recovery Source Manager > New
- Attaching Recovering Scenario to Test Script
File > Settings > Recovery > Add Scenario
- Extension of Recovery Scenario: .QRS
- Turn OFF Recovery Scenario
Recovery.SetScenarioStatus 1, FALSE
- Turn ON Recovery Scenario
Recovery.SetScenarioStatus 1, TRUE
- Activation of already Define recovery
Recovery.Activate
3. What is the use of Text output value in QTP?
Output value enable to view the value that application takes during the test run. When parameterization is used, the value changes for each iteration. With the help of Output value, we can capture the value that application takes during run time and their output to data table.
4. How to use the Object spy?
Using Object Spy we can view the property of any object in open application. We use object spy pointer to point an object. Object spy display the hierarchy of selected object and Properties and its values in property tab of object spy.
There are two ways to Spy the objects in QTP
i. Through file toolbar
i. Through file toolbar
Tool > Object Spy
ii. Through Object repository Dialog
Tool > Object Repository > Object Spy
5. File Extension
| Name | Extension |
| Shared Repository | tsr |
| Per Action Repository | mtr |
| Code file | mts |
| Function Library | qfl |
| Recovery Scenario | qrs |
| VB Script | vbs |
| Batch file | mtb |
| Database | mdb |
| | |
| | |
6. Explain the concept of object repository & how QTP recognizes objects?
Whenever QTP records any action on any object of an application, it adds some description on how to recognize that object into repository of object, called Object Repository. QTP can not take action on an object until unless it description is available in Object Repository.
Type of Object Repository:
i. Shared Object Repository:
In this mode only one repository is required for multiple test script. This mode enables:
- Easily maintain test when an object change in our application
- Manage all the objects for suit at one central location
- When we modify the test object properties, logical name, parameterization setting etc in shared repository of an open application, QuickTest applies these change to all the test script.
ii. Per Action Object Repository:
- In this mode QuickTest automatically creates an object repository for each action.
- Modifying the Test object properties, logical name, Parameterization setting etc does not affect the other repository.
Types of properties using in Object Identification:
- Mandatory Properties are properties that QTP always learns for a particular test object class.
- Assistive Properties are properties that QTP learns only if the mandatory properties are not sufficient to create a unique description. If several assistive properties are defined for an object class, then QTP learns one assistive property at a time and stops as soon as it creates a unique description for the object. If QTP does learn assistive properties, those properties are added to the test object description.
- Ordinal Identifier: If the combination of all defined mandatory and assistive properties is not sufficient to create a unique test object description, QTP also learns the value for the selected ordinal identifier.
7. What are the properties you would use for identifying a browser & page when using descriptive programming?
"name" would be another property apart from "title" that we can use.
OR
We can also use the property "micClass".
ex: Browser("micClass:=browser").page("micClass:=page")....
"name" would be another property apart from "title" that we can use.
OR
We can also use the property "micClass".
ex: Browser("micClass:=browser").page("micClass:=page")....
8. What is a Regular Expression?
Regular Expression enables QTP to identify Object and Test Strings with varying values. Basically Regular Expression is a string that specify complex search phrase. By using special character such as period (.), caret (^), asterisk (*) and brackets ([]), we can define the condition of search.
Regular Expression enables QTP to identify Object and Test Strings with varying values. Basically Regular Expression is a string that specify complex search phrase. By using special character such as period (.), caret (^), asterisk (*) and brackets ([]), we can define the condition of search.
We can use regular expression when:
- Defining property values of an object
- Parameterize a step
- Creating checkpoint with varying values
Regular Expression Syntax
- Using the Backslash Character (\)
- Matching Any Single Character (.)
- Matching Any Single Character in a List ([xy])
- Matching Any Single Character Not in a List ([^xy])
- Matching Any Single Character within a Range ([x-y])
- Matching Zero or More Specific Characters (*)
- Matching One or More Specific Characters (+)
- Matching Zero or One Specific Character (?)
- Grouping Regular Expressions (())
- Matching One of Several Regular Expressions (|)
- Matching the Beginning of a Line (^)
- Matching the End of a Line ($)
- Matching Any Alphanumeric Character Including the Underscore (\w)
- Matching Any Non-Alphanumeric Character (\W)
- Combining Regular Expression Operators
Notes:
- We can use regular expressions only for values of type string
- When any special character in a regular expression is preceded by a backslash (\), QTP searches for the literal character
- We can combine regular expression operators in a single expression to achieve the exact search criteria we need.
- We can combine the ‘.’ and ‘*’ characters in order to find zero or more occurrences of any character (except \n). e.g. start.* matches start, started, starting, starter etc
- We can use a combination of brackets and an asterisk to limit the search to a combination of non-numeric characters. For example: [a-z A-Z]*
- To match any number between 0 and 1200, we need to match numbers with 1 digit, 2 digits, 3 digits, or 4 digits between 1000 & 1200. The regular expression that matches any number between 0 and 1200: ([0-9]?[0-9]?[0-9]|1[01][0-9][0-9]|1200)
· Regular Expression for Time ("1[012]|[1-9]):[0-5][0-9](am|pm")
9. What are the various ways to insert a Action in a test in QTP?
There are three ways to insert a Action in a test:
There are three ways to insert a Action in a test:
a. Insert Call to New Action
Creates a new action and adds a call to the same. Provide the name "Cancel Ticket" in the "Name" field and click on OK button.
Adds below line to the code:
RunAction "Cancel Ticket", oneIteration
b. Insert Call to Existing Action
Creates a new action and adds a call to the same. Provide the name "Cancel Ticket" in the "Name" field and click on OK button.
Adds below line to the code:
RunAction "Cancel Ticket", oneIteration
b. Insert Call to Existing Action
When we plan a suite of tests, we may realize that each test requires some identical activities, such as login. For example, instead of recording the login process three times in three separate tests and enhancing each of them with checkpoints & parameterization separately, we can create an action that logs into a application in one test and then enhances. Once the enhancement is done, we can insert the existing action into other tests.
We can insert an existing action by inserting a copy of the action into our test, or by inserting a call to the original action.
Note: In case the action in present in some other test case then a read only copy of action is inserted
c. Insert Call to Copy Action
When we insert a copy of an action into a test, the action is copied along with checkpoints, parameterization, corresponding action tab in the Data Table and Object Repository. So, before running the test, we need to confirm that the object repository contains all the objects that are in the copied action. Otherwise, the test may fail.
Note:
- Inserts call to an existing re-usable action and creates an editable copy of that action
- Actions cannot be deleted from a Test from Expert view. To delete a action one must go to the keyword view and delete the action
- An action call cannot be inserted directly by writing code in Expert View; it has to be added through the GUI first.
- The changes made in the script, will not effect the original script(Action)
Note: Syntax of Call Action
RunAction ActionName, [IterationMode, IterationRange, Parameters]
10. How many types of Actions are there in QTP?
There are three kinds of actions:
Non-reusable action— an action that can be called only once in a test with which it is stored (local Test).
Reusable action—an action that can be called multiple times by the test with which it is stored (the local test) as well as by other tests.
External action—a reusable action stored with another test. External actions are read-only in the calling test, but you can choose to use a local, editable copy of the Data Table information for the external action.
Note: Converting non-reusable action into reusable action
Menu Edit >> Action >> Action PropertiesThe general tab of action properties has a check box for Reusable action
No comments:
Post a Comment