Академический Документы
Профессиональный Документы
Культура Документы
In this Framework the Test case logic resides in Test Scripts. The Test Data is separated and kept
outside the Test Scripts. The script is just a “Driver” or delivery mechanism for the Data.
In this framework test input and output values are read from external data files (ODBC sources, CVS
files, Excel files, DAO objects, ADO objects, and such) and are loaded into variables in captured or
manually coded scripts.
Test Scripts themselves are prepared either using Linear Scripting or Test Library Framework.
Advantages
Utilizing a modular design, and using files or records to both input and verify data, reduces
redundancy and duplication of effort in creating automated test scripts.
A Variety of Test Scenarios can be executed by just varying the Test Data in the External Data
File.
If functionality changes, only the specific "Business Function" script needs to be updated.
Disadvantages
More time is needed to plan and prepare both Test Scripts and Test Data.
Requires proficiency in the Scripting language used by the tool (technical personnel).
Multiple data-files are required for each Test Case. There may be any number of data-inputs
and verifications required, depending on how many different screens are accessed. This
usually requires data-files to be kept in separate directories by Test Case.
1
STC Technologies Pvt. Ltd.
Tester must not only maintain the Detail Test Plan with specific data, but must also re-enter
this data in the various required data-files.
Parameterization
Parameterization in QTP is a process of replacing all the constants within the test script into variables
(parameters) so that we can reuse the same script with different sets of data.
Test/action parameters -Test parameters enable you to use values passed from your test. Action
parameters enable you to pass values from other actions in your test.
Data Table parameters - Enable you to create a data-driven test (or action) that runs several times
using the data you supply. In each repetition, or iteration, QuickTest uses a different value from the
Data Table.
Environment variable Parameters - The Environment variables can have Quick Test generated
values or values supplied from external files. We can add environment variables from Test->Settings-
>Environment tab. Choose User-defined from the variable type. Click New to create your own
internal variables or Click Export to retrieve values from external sources.
Random number Parameters -It enables us to use random numbers as values in the test. We can
specify the range from which the random number is generated. By default, the random number
range is between 0 and 100.
2
STC Technologies Pvt. Ltd.
Data Table
Parameterization is used to test an application with different data from a single action (or multiple
actions) through multiple iterations.
This data-pool can be QTP’s Data Table, an Excel Spreadsheet or any database
Syntax
Example
Steps
Enter the Agent Name and Password →Click OK→ Close the flight reservation window→select
configure icon in keyword view →select parameter→set the column name for the data table as user
name and for password close the application enter the values in global data table
And check for the iteration as specified for the values mentioned in data table
3
STC Technologies Pvt. Ltd.
Random Numbers
It enables us to use random numbers as values in the test. We can specify the range from which the
random number is generated. By default, the random number range is between 0 to 100.
Step 1 – Open a new Test -> click on the “Record” button -> Open the “Notepad” to record ->type
some number in the notepad ->close the notepad -> stop recording ->now go to keyword view ->
click on the “configure value” button ->
4
STC Technologies Pvt. Ltd.
5
STC Technologies Pvt. Ltd.
Step 2 – Now select the “Parameter” and in that select “Random Number”
6
STC Technologies Pvt. Ltd.
Environmental Variable
The Environmental Variables can have Quick Test generated values or values supplied from external
files.
Environmental Variables are dynamic in nature, and it can be dynamic in changed. There are number
of environmental variables that can be referenced by programs and can be useful in finding
information.
Built-in-variables
User Defined Variables
Built-in Variables - These variables will be by default available in every test and can be directly used
in any test with help of following syntax.
7
STC Technologies Pvt. Ltd.
Example
msgbox var
User-Defined Variables - The variables which are created by the user and can be invoked in test
script.
8
STC Technologies Pvt. Ltd.
Step Generator
The Step Generator enables to add steps by selecting from a range of context-sensitive options
and entering the required values.
In the Step Generator dialog box we can define steps that use
Test Object methods and properties .(Test Only)
Utility Object methods and properties.(Links,URL)
Calls to library functions (Test only), VB Script functions and internal script functions.
Steps
Before we open the Step Generator define a new step, first select where in the test a new step
should be inserted.
After we open the Step Generator, first select the category for the Step Generator (Test Object,
Utility Object or Functions).
9
STC Technologies Pvt. Ltd.
We can then select the appropriate method or function and define the arguments and return values,
parameterizing them if required.
The Step Generator then inserts a step with the correct syntax into your test; we can continue to
add further steps at the same location without closing the Step Generator.
10
STC Technologies Pvt. Ltd.
You can open the Step Generator from the Keyword view or Expert view while recording or
editing the test; we can also open the Step Generator from the Active Screen while editing.
11
STC Technologies Pvt. Ltd.
Virtual Objects
Example
Let us say we are automating a scenario in Microsoft Word. I activated MS word application and I
click on any icon in the ribbon. For example, on the Ribbon, Insert tab is clicked and then the user
clicks the "Picture" button. A button is recognized as WinObject; hence, importance of virtual
objects is pronounced.
170,104
12
STC Technologies Pvt. Ltd.
Step 2 − Map the
Object against the
Class Type and click
“Next”
Step 3 − Click “Mark Object” Button. A cross hair cursor would appear and mark the object that you
would like to map and click “Next”
13
STC Technologies Pvt. Ltd.
Step 4 − Select the parent of the Virtual object and click “Next”
Step 5 − Name the collection in which you would like to store the virtual object and click “Finish”
14
STC Technologies Pvt. Ltd.
Virtual Object Manager
Virtual Object Manager manages the collections of Virtual objects. Testers can add or Delete the
Virtual Objects from the Virtual Object manager.
Navigation to Virtual object Manager – “Tools”---> “Virtual Object Manager” as shown below –
15
STC Technologies Pvt. Ltd.
Window ("Microsoft Word").WinObject ("Ribbon").VirtualButton ("button").Click
Limitations
QTP does not support virtual objects for analog or low-level recording.
Though we map an object to a particular class (button or List), all the methods of the native
objects are not supported by Virtual objects.
The test execution will fail if the screen resolution changes as the co-ordinates change.
Application Window should be of same screen size so that Virtual objects are captured
correctly.
Descriptive Programming
“An object name is simply used to map an object in script with its description in object repository”
It uses this name to track the object in object repository. For a parent you cannot have two child
objects with the same name. Hence, QTP uniquely maps the object in the repository
It then uses the stored description in the Object Repository and replaces the name with the
description. It then uses this statement to identify the object in the application under test
But what if instead of QTP replacing the object description, you as a tester directly specify the object
descriptions in your script. This is nothing but “Descriptive Programming”
Static
Dynamic
Static Method
16
STC Technologies Pvt. Ltd.
Syntax
EXAMPLE
Dialog ("text: =Login").WinEdit ("attached text: =Agent Name :") .Set "malini"
Window("text:=Flight Reservation").Close
17
STC Technologies Pvt. Ltd.
Dynamic Method
In case your script uses the descriptive programming object candidate multiple times, it will be very
tiresome to specify all the property value pairs for each statement. In such cases you can make use
of Description Class provided by QTP
Syntax
MyDescription("property").Value = "property-value";
Example -
Set a=description.Create
a("text").value="Login"
Set b=description.Create
Set c=description.Create
c("attached text").value="Password:"
Set d=description.Create
d ("text").value="OK"
Set e=description.Create
18
STC Technologies Pvt. Ltd.
e ("text").value="Flight Reservation"
Dialog (a).Activate
Window (e).close
Executing a group of Tests or series of test at a time is known as Batch Testing or Batch Execution.
For performing Batch Testing, QTP is providing a separate Tool called Test Batch Runner. It is used to
perform Regression Testing and test batches are saved with .mts extension
Navigation
Start ---> All Programs ---> QTP---> Tools --->Test Batch runner
19
STC Technologies Pvt. Ltd.
Go to Batch ---> Add(add test that has to be added to batch)
20
STC Technologies Pvt. Ltd.
Go to “Batch” ---> Click on “Run” to execute the test script
21
STC Technologies Pvt. Ltd.