How To Make Career In QTP: Download free QTP Framwork
for Technical interviews:
http://no1tutorial.com/
learn step by step technologies:
http://no1tutorial.com/
Framework Implementation in QTP
The Keyword-driven Framework is an application independent framework
that performs all possible actions and verifications on an object.
Hence, the code for the same object can be used across different
applications.
2.1. Test Settings for Keyword-driven Scripting
In the keyword-driven approach the entire script is developed with
keywords. The script is developed in a spreadsheet that is
interpreted by the main driver script, which then uses the function
library to execute the complete script.
The QTP Settings.vbs file can be used to easily perform the test
settings that are needed before proceeding with the Keyword-driven
Scripting. This file associates the Function libraries, recovery
scenarios, Environment Variables and the Object Repository files that
are needed for a script.
The QTP Settings file needs to be customized before usage. Edit the
.vbs file in notepad and make the necessary changes (mentioned below)
in the ‘Input Data’ section of the file.
1. Function Libraries – Specify the path where the Framework
Files, Common Functions and the User Defined Functions are
stored.
2. Recovery Scenario File - Specify the path of the file where the
Recovery scenarios are placed.
3. Recovery Scenarios Name - Specify the names of the Recovery
scenarios that need to be associated to the test script.
4. Environment File - Specify the path of the xml file for the
Global Environment Variables.
5. Object Repository files - Specify the path of the Object
Repository.
Open the test script in QTP for which the settings are needed and
double click on the QTP Settings.vbs file. This file will perform the
preferred settings automatically.
If there are multiple items of libraries, object repositories or global variables file,
they can be specified as an array separated by ‘,’
Set the Flag envi_flag, recover_flag, repos_flag, library_flag to "Yes" if the
corresponding files need to be associated to test, Else set it to "no"
given below is a sample “QTP Settings”.
libraries= array ("C:\WebFramework.vbs","C:\common functions.vbs")
recovery_file= "C:\recover.qrs"
recovery_name=array("Scenario1","Scenario2")
environment_file= "C:\Environment.xml"
repository_name= array ("C:\repository1.tsr","C:\repository2.tsr")
'NOTE: Please set the Flag to "Yes" if the files are to be associated to
test, otherwise set it to "no"
envi_flag="yes"
recover_flag=" yes"
repos_flag=" yes"
library_flag=" yes"
There should be just one Recovery file which holds all the Recovery scenarios. Multiple
Recovery files cannot be used.
There should be no unsaved tests currently open in QTP. The test script for which the test
settings need to be done should be open in QTP.
2.1.1. Run Settings
In the Run tab of the Test Settings dialog,
1. The Run one iteration only radio button will be selected.
2. The Disable Smart Identification during the run session check box
will be checked.
3. The Object Synchronization timeout value will be set as 20
seconds.
2.1.2. Resources Settings
After the run settings are completed, the QTP Settings file
associates the framework with the test script. Here, the path and the
names of the framework files need to be specified in the QTP Settings
file. The framework will be taken from the location specified and
associated with the test as shown below.
Associating Framework File
NOTE: The Common functions file and the User defined functions file should be
associated with the test only if needed by the test script.
2.1.3. Environment Tab Settings
QTP can insert a value from the environment variable list, which is a
list of variables and corresponding values that can be accessed from
the test. Throughout the test run, the value of an environment
variable remains the same, regardless of the number of iterations,
unless the value of the variable is changed programmatically in the
script.
Associating the user-defined Environment Variables file with the test
is also handled by the QTP Settings file. The Environment Variables
file with an .xml file type will be taken from the path specified in
the QTP Settings file and associated with the test.
Loading Environment Variables from xml File
2.2. Managing Object Repository
After the test settings are completed, the QTP Settings file
continues to associate the specified shared object repositories with
the test. The objects from the shared repository will be uploaded and
made available for the tests.
Associate Repositories Dialog
Call to Framework
The call to Keyword_Driver() needs to be specified in the Expert View
as shown below. This will call the Framework file associated with the
test and perform the actions by interpreting the keywords specified
in the data table.
2.4. Usage of Keywords
The keywords should be entered in the global sheet of the data table
of the test according to the syntax. To access the data table, choose
View > Data Table or click on the toolbar button. Below is an
example of Keyword-driven Scripting.
Using the keyword in a Data Table
2.5. Test Results for a Keyword-driven Script
Test execution results can be viewed and analyzed as soon as the run
session ends. To access the test results, choose Automation > Results
or click on the toolbar button. The results window will be
displayed.
Results in QTP
for Technical interviews:
http://no1tutorial.com/
learn step by step technologies:
http://no1tutorial.com/
Framework Implementation in QTP
The Keyword-driven Framework is an application independent framework
that performs all possible actions and verifications on an object.
Hence, the code for the same object can be used across different
applications.
2.1. Test Settings for Keyword-driven Scripting
In the keyword-driven approach the entire script is developed with
keywords. The script is developed in a spreadsheet that is
interpreted by the main driver script, which then uses the function
library to execute the complete script.
The QTP Settings.vbs file can be used to easily perform the test
settings that are needed before proceeding with the Keyword-driven
Scripting. This file associates the Function libraries, recovery
scenarios, Environment Variables and the Object Repository files that
are needed for a script.
The QTP Settings file needs to be customized before usage. Edit the
.vbs file in notepad and make the necessary changes (mentioned below)
in the ‘Input Data’ section of the file.
1. Function Libraries – Specify the path where the Framework
Files, Common Functions and the User Defined Functions are
stored.
2. Recovery Scenario File - Specify the path of the file where the
Recovery scenarios are placed.
3. Recovery Scenarios Name - Specify the names of the Recovery
scenarios that need to be associated to the test script.
4. Environment File - Specify the path of the xml file for the
Global Environment Variables.
5. Object Repository files - Specify the path of the Object
Repository.
Open the test script in QTP for which the settings are needed and
double click on the QTP Settings.vbs file. This file will perform the
preferred settings automatically.
If there are multiple items of libraries, object repositories or global variables file,
they can be specified as an array separated by ‘,’
Set the Flag envi_flag, recover_flag, repos_flag, library_flag to "Yes" if the
corresponding files need to be associated to test, Else set it to "no"
given below is a sample “QTP Settings”.
libraries= array ("C:\WebFramework.vbs","C:\common functions.vbs")
recovery_file= "C:\recover.qrs"
recovery_name=array("Scenario1","Scenario2")
environment_file= "C:\Environment.xml"
repository_name= array ("C:\repository1.tsr","C:\repository2.tsr")
'NOTE: Please set the Flag to "Yes" if the files are to be associated to
test, otherwise set it to "no"
envi_flag="yes"
recover_flag=" yes"
repos_flag=" yes"
library_flag=" yes"
There should be just one Recovery file which holds all the Recovery scenarios. Multiple
Recovery files cannot be used.
There should be no unsaved tests currently open in QTP. The test script for which the test
settings need to be done should be open in QTP.
2.1.1. Run Settings
In the Run tab of the Test Settings dialog,
1. The Run one iteration only radio button will be selected.
2. The Disable Smart Identification during the run session check box
will be checked.
3. The Object Synchronization timeout value will be set as 20
seconds.
2.1.2. Resources Settings
After the run settings are completed, the QTP Settings file
associates the framework with the test script. Here, the path and the
names of the framework files need to be specified in the QTP Settings
file. The framework will be taken from the location specified and
associated with the test as shown below.
Associating Framework File
NOTE: The Common functions file and the User defined functions file should be
associated with the test only if needed by the test script.
2.1.3. Environment Tab Settings
QTP can insert a value from the environment variable list, which is a
list of variables and corresponding values that can be accessed from
the test. Throughout the test run, the value of an environment
variable remains the same, regardless of the number of iterations,
unless the value of the variable is changed programmatically in the
script.
Associating the user-defined Environment Variables file with the test
is also handled by the QTP Settings file. The Environment Variables
file with an .xml file type will be taken from the path specified in
the QTP Settings file and associated with the test.
Loading Environment Variables from xml File
2.2. Managing Object Repository
After the test settings are completed, the QTP Settings file
continues to associate the specified shared object repositories with
the test. The objects from the shared repository will be uploaded and
made available for the tests.
Associate Repositories Dialog
Call to Framework
The call to Keyword_Driver() needs to be specified in the Expert View
as shown below. This will call the Framework file associated with the
test and perform the actions by interpreting the keywords specified
in the data table.
2.4. Usage of Keywords
The keywords should be entered in the global sheet of the data table
of the test according to the syntax. To access the data table, choose
View > Data Table or click on the toolbar button. Below is an
example of Keyword-driven Scripting.
Using the keyword in a Data Table
2.5. Test Results for a Keyword-driven Script
Test execution results can be viewed and analyzed as soon as the run
session ends. To access the test results, choose Automation > Results
or click on the toolbar button. The results window will be
displayed.
Results in QTP