Functional
Test Automation using QTP:
Test automation: It is the use of software to control the execution of tests, the comparison of actual outcomes to predicted outcomes,
the setting up of test preconditions, and other test control and test reporting
functions. Commonly, test automation involves automating a manual process
already in place that uses a formalized testing process.
Automated Testing Advantages,
Disadvantages and Guidelines
§ Detailed test cases, including predictable
"expected results", which have been developed from Business
Functional Specifications and Design documentation
§ A standalone Test
Environment, including a Test Database that is restorable to a known constant,
such that the test cases are able to be repeated each time there are
modifications made to the application.
The following types of testing can be automated
§ Functional - testing that
operations perform as expected.
§ Regression - testing that the
behavior of the system has not changed.
§ Exception or Negative - forcing error
conditions in the system.
§ Stress - determining the
absolute capacities of the application and operational infrastructure.
§ Performance - providing
assurance that the performance of the system will be adequate for both batch
runs and online transactions in relation to business projections and
requirements.
§ Load - determining the
points at which the capacity and performance of the system become degraded to
the situation that hardware or software upgrades would be required.
Benefits of Automated Testing
Reliable: Tests perform precisely the same
operations each time they are run, thereby eliminating human error
Repeatable: You can test how the software
reacts under repeated execution of the same operations.
Programmable: You can program sophisticated tests that bring out hidden information from the application.
Comprehensive: You can build a suite of tests that covers every feature in your application.
Programmable: You can program sophisticated tests that bring out hidden information from the application.
Comprehensive: You can build a suite of tests that covers every feature in your application.
Reusable: You can reuse tests on different
versions of an application, even if the user interface changes.
Better Quality Software: Because you can run more tests in
less time with fewer resources
Fast: Automated Tools run tests
significantly faster than human users.
Cost Reduction: As the number of resources for
regression test are reduced.
Choosing the right tools for the
job and targeting the right areas of the organization to deploy them can only
realize these benefits. The right areas where the automation fit must be
chosen.
The following areas must be automated first
1. Highly redundant tasks or
scenarios
2. Repetitive tasks that are boring or tend to cause human error
3. Well-developed and well-understood use cases or scenarios first
4. Relatively stable areas of the application over volatile ones must be automated.
2. Repetitive tasks that are boring or tend to cause human error
3. Well-developed and well-understood use cases or scenarios first
4. Relatively stable areas of the application over volatile ones must be automated.
Automated testers must follow the following guidelines to get the
benefits of automation:
• Concise: As simple as possible and no
simpler.
• Self-Checking: Test reports its own results;
needs no human interpretation.
• Repeatable: Test can be run many times in a
row without human intervention.
• Robust: Test produces same result now and
forever. Tests are not affected by changes in the external environment.
• Sufficient: Tests verify all the requirements
of the software being tested.
• Necessary: Everything in each test
contributes to the specification of desired behavior.
• Clear: Every statement is easy to
understand.
• Efficient: Tests run in a reasonable amount
of time.
• Specific: Each test failure points to a
specific piece of broken functionality; unit test failures provide "defect
triangulation".
• Independent: Each test can be run by itself or
in a suite with an arbitrary set of other tests in any order.
• Maintainable: Tests should be easy to
understand and modify and extend.
• Traceable: To and from the code it tests and
to and from the requirements.
Disadvantages of Automation Testing
Though the automation testing has
many advantages, it has its own disadvantages too. Some of the disadvantages
are:
• Proficiency is required to write the automation test scripts.
• Debugging the test script is major issue. If any error is present in the test script, sometimes it may lead to deadly consequences.
• Test maintenance is costly in case of playback methods. Even though a minor change occurs in the GUI, the test script has to be rerecorded or replaced by a new test script.
• Maintenance of test data files is difficult, if the test script tests more screens.
Some of the above disadvantages often cause damage to the benefit gained from the automated scripts. Though the automation testing has pros and corns, it is adapted widely all over the world.
• Proficiency is required to write the automation test scripts.
• Debugging the test script is major issue. If any error is present in the test script, sometimes it may lead to deadly consequences.
• Test maintenance is costly in case of playback methods. Even though a minor change occurs in the GUI, the test script has to be rerecorded or replaced by a new test script.
• Maintenance of test data files is difficult, if the test script tests more screens.
Some of the above disadvantages often cause damage to the benefit gained from the automated scripts. Though the automation testing has pros and corns, it is adapted widely all over the world.
Automated vs Manual testing
ADVANTAGES
|
|
Automated Testing
|
Manual Testing
|
•
If you have to run a set of tests repeatedly automation is a huge gain
|
•
If Test Cases have to be run a small number of times it's more likely to
perform manual testing
|
•
Helps performing "compatibility testing" - testing the software on
different configurations
|
•
It allows the tester to perform more ad-hoc (random testing)
|
•
It gives you the ability to run automation scenariosto perform regressions in
a shorter time
|
•
Short term costs are reduced
|
•
It gives you the ability to run regressions on a code that is continously
changing
|
•
The more time tester spends testing a module the grater the odds to find real
user bugs
|
•
Can be run simultaneously on different machines thus decreasing testing time
|
|
•
Long term costs are reduced
|
|
DISADVANTAGES
|
|
Automated Testing
|
Manual Testing
|
•
It's more expensive to automate. Initial investments are bigger than manual
testing
|
•
Manual tests can be very time consuming
|
•
You cannot automate everything, some tests still have to be done manually
|
•
For every release you must rerun the same set of tests which can be tiresome
|
OTHER FACTORS
|
|
•
The performance of yout test tools
|
|
•
The knowledge level of your testing team
|
|
•
The continous growth of software to be tested
|
|
•
Number of necessary regressions
|
Manual and Automation testing Challenges
Software Testing has lot of
challenges both in manual as well as in automation.Generally in manual testing
scenario developers through the build to test team assuming the responsible
test team or tester will pick the build and will come to ask what the build is
about? This is the case in organizations not following so-called ‘processes’.
Tester is the middleman between developing team and the customers, handling the
pressure from both the sides. And I assume most of our readers are smart enough
to handle this pressure. Aren’t you?
This is not the case always.
Some times testers may add complications in testing process due to their
unskilled way of working.In this post
I have added most of the testing challenges created due to testing staff,
developing staff, testing processes and wrong management decisions.
So here we go with the top challenges:
So here we go with the top challenges:
1) Testing the complete
application:
Is it possible? I think impossible. There are millions of test combinations. It’s not possible to test each and every combination both in manual as well as in automation testing. If you try all these combinations you will never ship the product
Is it possible? I think impossible. There are millions of test combinations. It’s not possible to test each and every combination both in manual as well as in automation testing. If you try all these combinations you will never ship the product
2) Misunderstanding of company
processes:
Some times you just don’t pay proper attention what the company-defined processes are and these are for what purposes. There are some myths in testers that they should only go with company processes even these processes are not applicable for their current testing scenario. This results in incomplete and inappropriate application testing.
Some times you just don’t pay proper attention what the company-defined processes are and these are for what purposes. There are some myths in testers that they should only go with company processes even these processes are not applicable for their current testing scenario. This results in incomplete and inappropriate application testing.
3) Relationship with
developers:
Big challenge. Requires very skilled tester to handle this relation positively and even by completing the work in testers way. There are simply hundreds of excuses developers or testers can make when they are not agree with some points. For this tester also requiresgood communication, troubleshooting and analyzing skill.
Big challenge. Requires very skilled tester to handle this relation positively and even by completing the work in testers way. There are simply hundreds of excuses developers or testers can make when they are not agree with some points. For this tester also requiresgood communication, troubleshooting and analyzing skill.
4) Regression testing:
When project goes on expanding the regression testing work simply becomes uncontrolled. Pressure to handle the current functionality changes, previous working functionality checks and bug tracking.
When project goes on expanding the regression testing work simply becomes uncontrolled. Pressure to handle the current functionality changes, previous working functionality checks and bug tracking.
5) Lack of skilled testers:
I will call this as ‘wrong management decision’ while selecting or training testers for their project task in hand. These unskilled fellows may add more chaos than simplifying the testing work. This results into incomplete, insufficient and ad-hoc testing throughout thetesting life cycle.
I will call this as ‘wrong management decision’ while selecting or training testers for their project task in hand. These unskilled fellows may add more chaos than simplifying the testing work. This results into incomplete, insufficient and ad-hoc testing throughout thetesting life cycle.
6) Testing always under time constraint:
Hey tester, we want to ship this product by this weekend, are you ready for completion? When this order comes from boss, tester simply focuses on task completion and not on the test coverage and quality of work. There is huge list of tasks that you need to complete within specified time. This includes writing, executing, automating and reviewing the test cases.
Hey tester, we want to ship this product by this weekend, are you ready for completion? When this order comes from boss, tester simply focuses on task completion and not on the test coverage and quality of work. There is huge list of tasks that you need to complete within specified time. This includes writing, executing, automating and reviewing the test cases.
7) Which tests to execute
first?
If you are facing the challenge stated in point no 6, then how will you take decision which test cases should be executed and with what priority? Which tests are important over others? This requires good experience to work under pressure.
If you are facing the challenge stated in point no 6, then how will you take decision which test cases should be executed and with what priority? Which tests are important over others? This requires good experience to work under pressure.
8 ) Understanding the
requirements:
Some times testers are responsible for communicating with customers for understanding the requirements. What if tester fails to understand the requirements? Will he be able to test the application properly? Definitely No! Testers require good listening and understanding capabilities.
Some times testers are responsible for communicating with customers for understanding the requirements. What if tester fails to understand the requirements? Will he be able to test the application properly? Definitely No! Testers require good listening and understanding capabilities.
9) Automation testing:
Many sub challenges – Should automate the testing work? Till what level automation should be done? Do you have sufficient and skilled resources for automation? Is time permissible for automating the test cases? Decision of automation or manual testing will need to address the pros and cons of each process.
Many sub challenges – Should automate the testing work? Till what level automation should be done? Do you have sufficient and skilled resources for automation? Is time permissible for automating the test cases? Decision of automation or manual testing will need to address the pros and cons of each process.
10) Decision to stop the
testing:
When to stop testing? Very difficult decision. Requires core judgment of testing processes and importance of each process. Also requires ‘on the fly’ decision ability.
When to stop testing? Very difficult decision. Requires core judgment of testing processes and importance of each process. Also requires ‘on the fly’ decision ability.
11) One test team under
multiple projects:
Challenging to keep track of each task. Communication challenges. Many times results in failure of one or both the projects.
Challenging to keep track of each task. Communication challenges. Many times results in failure of one or both the projects.
12) Reuse of Test scripts:
Application development methods are changing rapidly, making it difficult to manage the test tools and test scripts. Test script migration or reuse is very essential but difficult task.
Application development methods are changing rapidly, making it difficult to manage the test tools and test scripts. Test script migration or reuse is very essential but difficult task.
13) Testers focusing on finding
easy bugs:
If organization is rewarding testers based on number of bugs (very bad approach to judge testers performance) then some testers only concentrate on finding easy bugs those don’t require deep understanding and testing. A hard or subtle bug remains unnoticed in such testing approach.
If organization is rewarding testers based on number of bugs (very bad approach to judge testers performance) then some testers only concentrate on finding easy bugs those don’t require deep understanding and testing. A hard or subtle bug remains unnoticed in such testing approach.
14) To cope with attrition:
Increasing salaries and benefits making many employees leave the company at very short career intervals. Managements are facing hard problems to cope with attrition rate. Challenges – New testers require project training from the beginning, complex projects are difficult to understand, delay in shipping date!
Increasing salaries and benefits making many employees leave the company at very short career intervals. Managements are facing hard problems to cope with attrition rate. Challenges – New testers require project training from the beginning, complex projects are difficult to understand, delay in shipping date!
Introduction
to QuickTest Pro:
Overview
of quick test pro
Overview
QTP is a UI automation framework designed mainly for Windows and Web-based applications. It works by identifying the objects in the application UI or a web page and performing the desired operations on them (like mouse clicks or keyboard events); it can also be used to capture object properties like name or handler ID etc. One of the most important topics in QTP is Object Identification.QTP uses a scripting language built on top of VBScript to specify the test procedure, and to manipulate the objects and controls of the application under test.
Though QTP is usually used for “UI Based” Test Case Automation, it can easily handle “Non-UI” based Test Cases. (e.g. API (Certification testing), Database Testing, etc.)
Some of the key features of QTP are:
QTP is a UI automation framework designed mainly for Windows and Web-based applications. It works by identifying the objects in the application UI or a web page and performing the desired operations on them (like mouse clicks or keyboard events); it can also be used to capture object properties like name or handler ID etc. One of the most important topics in QTP is Object Identification.QTP uses a scripting language built on top of VBScript to specify the test procedure, and to manipulate the objects and controls of the application under test.
Though QTP is usually used for “UI Based” Test Case Automation, it can easily handle “Non-UI” based Test Cases. (e.g. API (Certification testing), Database Testing, etc.)
Some of the key features of QTP are:
Plug-ins
Plug-ins are used to make recording more acceptable to a specific application, we use web plug-ins to automate test cases with respect to web applications. QTP has default plug-ins for ActiveX controls, web applications and VB objects. Plug-ins for other objects, such as Microsoft .NETobjects, are also available. Multimedia plug-ins and a plug-in for Windows Mobile are also available. In general, each QTP plug-in is available at an additional cost.
And QTP identifies the windows objects, even if we don’t select any plug-ins at the launching of the application .
Plug-ins are used to make recording more acceptable to a specific application, we use web plug-ins to automate test cases with respect to web applications. QTP has default plug-ins for ActiveX controls, web applications and VB objects. Plug-ins for other objects, such as Microsoft .NETobjects, are also available. Multimedia plug-ins and a plug-in for Windows Mobile are also available. In general, each QTP plug-in is available at an additional cost.
And QTP identifies the windows objects, even if we don’t select any plug-ins at the launching of the application .
License
Models
Three types of licenses are available from HP:
1. Demo License : a 14-day demo license
2. Seat license : permanent seat license that is specific to the computer on which it is installed.
3. Floating (Concurrent): Floating allows a license to be shared between machines at any given point in time. (1 floating license allows QTP to be accessible from an entire lab’s worth of PCs but can only have 1 instance running at any given point in time).
Three types of licenses are available from HP:
1. Demo License : a 14-day demo license
2. Seat license : permanent seat license that is specific to the computer on which it is installed.
3. Floating (Concurrent): Floating allows a license to be shared between machines at any given point in time. (1 floating license allows QTP to be accessible from an entire lab’s worth of PCs but can only have 1 instance running at any given point in time).
Record
and Playback
Initial development of automated tests with QTP is usually done by record-and-playback. A user’s actions are captured via Microsoft’s Component Object Model (COM). These are recorded into Actions, a kind of subroutine, as VBScript commands. All manipulated objects that QTP recognizes are also added to the object repository. Once recorded, the scripts are editable in either Keyword View or Expert View.
After clicking on the playback button all these actions will be played back. During playback, QTP attempts to identify and perform operations on the same objects, again using COM.
Initial development of automated tests with QTP is usually done by record-and-playback. A user’s actions are captured via Microsoft’s Component Object Model (COM). These are recorded into Actions, a kind of subroutine, as VBScript commands. All manipulated objects that QTP recognizes are also added to the object repository. Once recorded, the scripts are editable in either Keyword View or Expert View.
After clicking on the playback button all these actions will be played back. During playback, QTP attempts to identify and perform operations on the same objects, again using COM.
Checkpoints
Checkpoints are a feature used for verifying the application under test. One can add a checkpoint to check if a particular object, text or a bitmap is present in the automation run.
In short, checkpoints are used to verify that during the course of test execution, the actual application behavior or state is consistent with the expected application behavior or state.
Checkpoints are a feature used for verifying the application under test. One can add a checkpoint to check if a particular object, text or a bitmap is present in the automation run.
In short, checkpoints are used to verify that during the course of test execution, the actual application behavior or state is consistent with the expected application behavior or state.
There
are 10
types of checkpoints available
in QTP:
1. Standard Checkpoint — Checks the properties of an object.
2. Table Checkpoint — A Standard Checkpoint that checks the properties of a table.
3. Image Checkpoint — A Standard Checkpoint that checks the properties of an image.
4. Bitmap Checkpoint — Compares an area of the application under test pixel-for-pixel with the screen as seen at record-time.
5. Database Checkpoint — Used to automate back-end testing.
6. Text Checkpoint — Checks that a section of text is found between two other sections of text.
7. Text Area Checkpoint
8. Page Checkpoint — Checks the properties of a web page.
9. Accessibility Checkpoint — Checks the accessibility of an application.
10. XML Checkpoint
The VBScript Reporter.ReportEvent function also produces output very similar to that of a checkpoint, allowing the creation of custom checkpoints.
1. Standard Checkpoint — Checks the properties of an object.
2. Table Checkpoint — A Standard Checkpoint that checks the properties of a table.
3. Image Checkpoint — A Standard Checkpoint that checks the properties of an image.
4. Bitmap Checkpoint — Compares an area of the application under test pixel-for-pixel with the screen as seen at record-time.
5. Database Checkpoint — Used to automate back-end testing.
6. Text Checkpoint — Checks that a section of text is found between two other sections of text.
7. Text Area Checkpoint
8. Page Checkpoint — Checks the properties of a web page.
9. Accessibility Checkpoint — Checks the accessibility of an application.
10. XML Checkpoint
The VBScript Reporter.ReportEvent function also produces output very similar to that of a checkpoint, allowing the creation of custom checkpoints.
Recovery
Recovery is the name for exception handling in QTP, with the goal of enabling the tests to continue to run if an unexpected failure occurs. For instance if an application crash occurs and a message dialog appears, QTP can be instructed to attempt to restart the application and continue with the rest of the test cases from there
Recovery is the name for exception handling in QTP, with the goal of enabling the tests to continue to run if an unexpected failure occurs. For instance if an application crash occurs and a message dialog appears, QTP can be instructed to attempt to restart the application and continue with the rest of the test cases from there
Output
Value
This feature is used to store the run-time values/data that are displayed in the application into the run-time data table, so that we can use these run-time values in the script for further use.
Say we need the value which is dynamically created or processed by application for later use, we can go for output concept. We can follow the following example to understand. If the application produces an id for the person and we need that id, that can be solved using output concept, where we store value ‘id’ of that person in the data table and we can refer to that value later.
This feature is used to store the run-time values/data that are displayed in the application into the run-time data table, so that we can use these run-time values in the script for further use.
Say we need the value which is dynamically created or processed by application for later use, we can go for output concept. We can follow the following example to understand. If the application produces an id for the person and we need that id, that can be solved using output concept, where we store value ‘id’ of that person in the data table and we can refer to that value later.
Data
Table
The data table is a table primarily used to implement data-driven testing. It is implemented as a Microsoft Excel workbook that can be accessed from within QTP. There are two types of Data Tables available in QTP: the Global data sheet and the local data sheets. The Global data sheet is a single sheet which is accessible from every Action in a test. By default, each row of this sheet specifies the values to be used in an iteration of the entire test. The data table can be managed by other third party tools such as Grid Tools Datamaker, which offers features such as Data inheritance; substitution variables and version control.
There is also one local data sheet associated with each Action. As the Global data sheet specifies iterations of an entire test, these sheets are often used to set up iterations of a single Action. The data in these sheets can only be accessed from their associated Action. While it is possible to access a different Action’s local data sheet, it cannot be done from the Object Repository or from inside a checkpoint.
The data table is a table primarily used to implement data-driven testing. It is implemented as a Microsoft Excel workbook that can be accessed from within QTP. There are two types of Data Tables available in QTP: the Global data sheet and the local data sheets. The Global data sheet is a single sheet which is accessible from every Action in a test. By default, each row of this sheet specifies the values to be used in an iteration of the entire test. The data table can be managed by other third party tools such as Grid Tools Datamaker, which offers features such as Data inheritance; substitution variables and version control.
There is also one local data sheet associated with each Action. As the Global data sheet specifies iterations of an entire test, these sheets are often used to set up iterations of a single Action. The data in these sheets can only be accessed from their associated Action. While it is possible to access a different Action’s local data sheet, it cannot be done from the Object Repository or from inside a checkpoint.
Virtual
Objects
Complex objects may not be recognized properly by QTP. The Virtual Object concept was implemented to enable users to add some degree of support for these objects. If an object is not recorded out-of-the-box, an experienced user may be able to define that object as a personal virtual object and build a virtual object repository. Assuming that the required information can be extracted from the object, this allows the users to successfully record and playback against that object. In practice, this is not always possible.
Complex objects may not be recognized properly by QTP. The Virtual Object concept was implemented to enable users to add some degree of support for these objects. If an object is not recorded out-of-the-box, an experienced user may be able to define that object as a personal virtual object and build a virtual object repository. Assuming that the required information can be extracted from the object, this allows the users to successfully record and playback against that object. In practice, this is not always possible.
Transactions
This feature can be used to calculate the time required to run a particular test or particular steps in the tests. Transactions are most often used in automated software performance testing, so they are infrequently used in QTP(Quick test Professional)
This feature can be used to calculate the time required to run a particular test or particular steps in the tests. Transactions are most often used in automated software performance testing, so they are infrequently used in QTP(Quick test Professional)
Results
QTP generates the result file for the test cases at the end of test in the form of XML tree. The result file provides detail regarding PASS and FAILS counts, error messages, and potentially supporting information that allows users to determine the underlying cause of a failure.
QTP generates the result file for the test cases at the end of test in the form of XML tree. The result file provides detail regarding PASS and FAILS counts, error messages, and potentially supporting information that allows users to determine the underlying cause of a failure.
User
Interface
QuickTest provides two main views of a script: Keyword View and Expert View. They are selected from tabs at the bottom of the QuickTest Professional window.
QuickTest provides two main views of a script: Keyword View and Expert View. They are selected from tabs at the bottom of the QuickTest Professional window.
Keyword
View
Keyword View is QTP’s default test procedure interface. It displays the automation steps of a test procedure as a descriptive tree of Actions and functions. The tree contains columns listing the Action or function name, any parameters, and comments. This mode is most useful for the beginners in operating with the tool. This view allows the user to select the objects either from the application or from the Object Repository and the user can select the methods to be performed on those objects. The script is automatically generated. Users can also set check points from keyword view.
Keyword View is QTP’s default test procedure interface. It displays the automation steps of a test procedure as a descriptive tree of Actions and functions. The tree contains columns listing the Action or function name, any parameters, and comments. This mode is most useful for the beginners in operating with the tool. This view allows the user to select the objects either from the application or from the Object Repository and the user can select the methods to be performed on those objects. The script is automatically generated. Users can also set check points from keyword view.
Expert
View
In Expert View, QTP allows display and editing of the a test’s source code. All test actions can be edited here except for the root Global action. Expert View acts as an IDE for the test. It includes most standard IDE features, such as breakpoints. This view is most suitable for the advanced users, enabling them to customize the test, such as by writing user-defined functions.
In Expert View, QTP allows display and editing of the a test’s source code. All test actions can be edited here except for the root Global action. Expert View acts as an IDE for the test. It includes most standard IDE features, such as breakpoints. This view is most suitable for the advanced users, enabling them to customize the test, such as by writing user-defined functions.
Languages
Supports VB Script. Supports classes but not supports polymorphism and inheritance
Supports VB Script. Supports classes but not supports polymorphism and inheritance
starting
quicktest:
Loading QTP Add-in When Starting From QC
You can create a Template
test with the addins u need and save it to QC .And then you can associate that
Template Test script with ur script,so next time QTP will load with the addins
u need .
-----------
Creating a New Template Test
You create a template test by first creating a blank test in QuickTest with the required test settings. Then, in the Test Plan module of your Quality Center project, you browse to your QuickTest test and save it as a Template Test.
Note: When you save the test in QuickTest, you should apply a descriptive name that clearly indicates its purpose. For example, if the template test is to used to associate the ActiveX and Web Add-ins with a new test, you could call it ActiveX_Web_Addins_Template.
Tip: In the Quality Center test plan tree (Test Plan module), you may want to create a special folder for your template tests. This will enable other users to quickly locate the relevant template test when they create new QuickTest tests in Quality Center.
To create a template test:
In QuickTest:
Open QuickTest with the required add-ins loaded. For more information on loading QuickTest add-ins, see Loading QuickTest Add-ins.
Define the required settings in the Test Settings dialog box (File > Settings). For more information, see Using the Test Settings Dialog Box.
If you want to include comments or steps in all tests based on this template test, add them.
Click the Save button or choose File > Save to save the test. The Save Test to Quality Center dialog box opens. Save the test to your Quality Center project using a descriptive name that clearly indicates its purpose. For more information, see Saving Tests to a Quality Center Project.
In Quality Center:
Open the project in Quality Center, click the Test Plan button on the sidebar to open the Test Plan module, and browse to the test you saved in step 4.
Right-click the test and choose Mark as Template Test. The test is converted to a template test.
Repeat steps 1 to 6 to create additional template tests, as needed.
--------------------
You can refer QTP help file for more info .
-----------
Creating a New Template Test
You create a template test by first creating a blank test in QuickTest with the required test settings. Then, in the Test Plan module of your Quality Center project, you browse to your QuickTest test and save it as a Template Test.
Note: When you save the test in QuickTest, you should apply a descriptive name that clearly indicates its purpose. For example, if the template test is to used to associate the ActiveX and Web Add-ins with a new test, you could call it ActiveX_Web_Addins_Template.
Tip: In the Quality Center test plan tree (Test Plan module), you may want to create a special folder for your template tests. This will enable other users to quickly locate the relevant template test when they create new QuickTest tests in Quality Center.
To create a template test:
In QuickTest:
Open QuickTest with the required add-ins loaded. For more information on loading QuickTest add-ins, see Loading QuickTest Add-ins.
Define the required settings in the Test Settings dialog box (File > Settings). For more information, see Using the Test Settings Dialog Box.
If you want to include comments or steps in all tests based on this template test, add them.
Click the Save button or choose File > Save to save the test. The Save Test to Quality Center dialog box opens. Save the test to your Quality Center project using a descriptive name that clearly indicates its purpose. For more information, see Saving Tests to a Quality Center Project.
In Quality Center:
Open the project in Quality Center, click the Test Plan button on the sidebar to open the Test Plan module, and browse to the test you saved in step 4.
Right-click the test and choose Mark as Template Test. The test is converted to a template test.
Repeat steps 1 to 6 to create additional template tests, as needed.
--------------------
You can refer QTP help file for more info .
What's QuickTest Professional (QTP Window?
Before you begin creating tests, you should familiarize
yourself with the main QuickTest window.
The QuickTest window contains the following key elements:
. Title bar—Displays the name of the currently open test.
. Menu bar—Displays menus of QuickTest commands.
. File toolbar—Contains buttons to assist you in managing your test.
. Testing toolbar—Contains buttons to assist you in the testing process.
. Debug toolbar—Contains buttons to assist you in debugging tests.
. Test pane—Contains the Keyword View and Expert View tabs.
. Active Screen—Provides a snapshot of your application as it appeared when you performed a certain step during the recording session.
. Data Table—Assists you in parameterizing your test.
. Debug Viewer pane—Assists you in debugging your test. The Debug Viewer pane contains the Watch Expressions, Variables, and Command tabs. (The Debug Viewer pane is not displayed when you open QuickTest for the first time. You can display the Debug Viewer by choosing View < Debug Viewer.)
. Status bar—Displays the status of the QuickTest application.
The QuickTest window contains the following key elements:
. Title bar—Displays the name of the currently open test.
. Menu bar—Displays menus of QuickTest commands.
. File toolbar—Contains buttons to assist you in managing your test.
. Testing toolbar—Contains buttons to assist you in the testing process.
. Debug toolbar—Contains buttons to assist you in debugging tests.
. Test pane—Contains the Keyword View and Expert View tabs.
. Active Screen—Provides a snapshot of your application as it appeared when you performed a certain step during the recording session.
. Data Table—Assists you in parameterizing your test.
. Debug Viewer pane—Assists you in debugging your test. The Debug Viewer pane contains the Watch Expressions, Variables, and Command tabs. (The Debug Viewer pane is not displayed when you open QuickTest for the first time. You can display the Debug Viewer by choosing View < Debug Viewer.)
. Status bar—Displays the status of the QuickTest application.
QTP Commands
QTP Commands are available in 3 ways.
1.Menu options
2.Tool Bar options
3.Short cut keys (for Some important operations only)
File menu: Through file menu user can create, save tests, open existing
tests, export tests in zip format.
Command
|
|
New
> Test
|
|
New
> Business Component
|
|
New
> Scripted Component
|
|
New
> Application Area
|
|
New
> Function Library
|
|
Open
> Test
|
|
Open
> Business/Scripted Component
|
|
Open
> Application Area
|
|
Open
> Function Library
|
|
Close
|
|
Close
All Function Libraries
|
|
Quality Center Connection
|
|
Quality Center Version
Control
|
|
Save
|
|
Save
As
|
|
Save
Test with Resources
|
|
Save
All
|
|
Enable
Editing
|
|
Export
Test to Zip File
|
|
Import
Test from Zip File
|
|
Convert
to Scripted Component
|
|
Print
|
|
Print
Preview
|
|
Settings
|
|
Process
Guidance Management
|
|
Associate
Library '<Function Library Name>' with '<Document Name>'
|
|
Recent
Files
|
|
Exit
|
Edit Menu: It provides editing options and renaming, deleting and
splitting actions.
Command
|
|
Undo
|
|
Redo
|
|
Cut
|
|
Copy
|
|
Paste
|
|
Delete
|
|
Copy
Documentation to Clipboard
|
|
Action
> Split Action
|
|
Action
> Rename Action
|
|
Action
> Delete Action
|
|
Action
> Action Properties
|
|
Action
> Action Call Properties
|
|
Step
Properties > Comment Properties
|
|
Step
Properties > Object Properties
|
|
Step
Properties > Checkpoint Properties
|
|
Step
Properties > Output Value Properties
|
|
Step
Properties > Report Properties
|
|
Find
|
|
Replace
|
|
Go
To
|
|
Bookmarks
|
|
Advanced
> Comment Block
|
|
Advanced
> Uncomment Block
|
|
Advanced
> Indent
|
|
Advanced
> Outdent
|
|
Advanced
> Go to Function Definition
|
|
Advanced
> Complete Word
|
|
Advanced
> Argument Info
|
|
Advanced
> Apply "With" to Script
|
|
Advanced
> Remove "With" Statements
|
|
Optional
Step
|
View menu: Through this menu we can launch and close, active screen, Data Table, Debug viewer, information, missing resources etc.
Insert Menu: Through this menu user can inserting check points, out put
values, synchronizing points.
In this menu step generator available, using this user can
generate recordable and non-recordable scripts.
Through insert menu user can insert VB Script conditional and
loop statements and transaction points (Start and End).
Through insert menu user can create new actions, call existing
actions and copy existing actions.
Automation Menu:
This menu provides Record, Run options and Run setting options
Through this menu we can start normal recording, analog
recording and Low level recording.
Through this menu we can stop recoding, running and also we run
tests.
Command
|
|
Record
|
|
Run
|
|
Stop
|
|
Run Current Action
|
|
Run from Step
|
|
Maintenance Run Mode
|
|
Update Run Mode
|
|
Analog Recording
|
|
Low Level Recording
|
|
Record and Run Settings
|
|
Process Guidance List
|
|
Results
|
Resources Menu:
This menu provides object repository and recovery scenarios options.
Through this menu we can create /modify/delete objects
information and we can associate repositories.
Through this menu we can create, modify and delete recovery
scenarios.
Command
|
|
Object
Repository
|
|
Object
Repository Manager
|
|
Associate
Repositories
|
|
Map
Repository Parameters
|
|
Recovery
Scenario Manager
|
|
Associated
Function Libraries
|
Debug Menu:
This menu provides debug commands for step by step execution.
Through this menu we can insert/remove/break points.
Tools Menu:
This menu provides Tools settings option, view options and
object identification configuration.
Through this menu we can set tool options as well as test pane
view options.
In this menu object spy option available, through this we can
get object’s information.(Properties and values)
In this menu Virtual object option available; through this
option we can create virtual objects.
Command
|
|
Options
|
|
View Options
|
|
Check Syntax
|
|
Object Identification
|
|
Object Spy
|
|
Web Event Recording Configuration
|
|
Data Driver
|
|
Change Active Screen
|
|
Virtual Objects > New Virtual Object
|
|
Virtual Objects > Virtual Object Manager
|
|
Customize
|
Window Menu:
This menu provides QTP tool window style settings.
Help Menu:
This menu provides QTP help as well as VB Script help.
Through this menu we can contact technical support people and we
can send feedback.
Through this menu we can check for updates and download or
install directly.
QTP 11: Complete List of New Features
XPath and CSS based object
identification
Identify objects not only using
normal object identification but withXPath and CSS identifier properties.
A much awaited and a killer feature
Good Looking and Enhanced Results
Viewer
The
new improved results viewer provides an executive summary page with summary
data, pie charts and statistics for both the current and previous runs and a
quick link to the previous run results.
Easy Regular Expressions
You can now create reg ex with
the help of syntax hints. Regular Expression Evaluator is
available to test regular expressions that you have created. Good One.
Now identify objects not only in
relation to each other but in relation to neighboring objects.
With this feature, QTP 11 has
moved beyond the unreliability of ordinal identifiers. Objects identified with
ordinal identifiers are good only as long as they maintain their relative
positions with respect to each other in the new build of application. In case
if this position changes or gets interchanged, ordinal identifiers may go for a
toss.
HP has now introduced Visual Relation Identifier.
HP has now introduced Visual Relation Identifier.
A visual
relation identifier is a set of definitions that
enable you to identify the object in the application according its neighboring
objects in the application. You can select neighboring objects that will
maintain the same relative location to your object, even if the user interface
design changes. You define visual relations in the Visual Relation Identifier
dialog box, which is accessible from the local or shared object repository, and
from the Object Properties dialog box.
Load Function Libraries at Run Time
With the help of LoadFunctionLibrary statement.
You can now load a function library when a step runs instead of at the
beginning of a run session.
Test Your GUI and UI-Less
Application Functionality in One Test
Since
QTP is integrated with Service Test, you can now test your GUI and non-GUI
based apps in a single run.
Record Support
For
FireFox is now available.
Much Awaited Log Tracking is available
now
QTP
11 is capable of receiving Java or .NET log framework messages from your
application which can then be embedded in the run results.
Embed/Run Javascript in web pages
You can use the new EmbedScript/EmbedScriptFromFile andRunScript/RunScriptFromFile functions
to embed JavaScripts in all loaded browser pages. You can use these scripts to
perform operations on, or retrieve data from, the browser pages in your
application.
Manage Test Data
Web 2.0 Toolkit Applications
Support
Automatically Parameterize Steps
You
can instruct QTP 11 to automatically parameterize test steps at the end of
record session.
Silverlight Add-in
To
test objects in Silverlight 2 and Silverlight 3 applications. [After
installation, Silverlight Add-in is displayed in the Add-in Manager as a child
add-in under the WPF Add-in]
Extend WPF and Silverlight Support
You
can use WPF and Silverlight Add-in Extensibility SDK to develop support for
testing third-party and custom WPF and Silverlight controls that are not
supported out-of-the-box
working
with add-ins and add-in manager
Using the
Add-In Manager you can specify which add-ins to load at startup.
Using the Add-In Manager you can specify which add-ins to load at
startup. You can also unload certain add-ins while in session. The available
add-ins and their load behavior is listed in the dialog box. Add-ins that are
not loaded at startup are listed without a load behavior.
When an add-in is unloaded, its functionality is not available.
However, all translator add-ins (such as DXF, DWF, and DWG) automatically load
when that format is selected when doing a Save Copy As. By default, the
translators are not loaded at startup.
NoteYou cannot
unload or load an Autodesk Inventor Professional add-in session.
Restart the application for your selection to take effect.
·
Reduce the memory footprint for the application and increase the
capacity. An increased capacity enables you to work with larger assemblies. If
you experience capacity issues while using Autodesk
Inventor Professional, unload some of the larger add-ins (such as Tube
& Pipe, Cable & Harness) if they are not used in your design. In most
cases, we recommend that you do not unload Autodesk add-ins.
·
Correct problems with the application. If you experience problems
with Autodesk Inventor, start to unload non-Autodesk add-ins
systematically to see if unloading corrects the problems. It is possible for
some non-Autodesk Inventor add-ins to be invalid for a current release,
and unloading them may correct problems. Refer to the following default add-in
lists to determine which add-ins to remove.
There are two ways to use the Add-In Manager. From within the
application or from the Windows Start menu.
2. On the ribbon,
click Tools tabOptions panel Add-Ins.
3. In the Add-In
Manager dialog box, double-click the name in the list to switch between Loaded
and Unloaded or between Startup/Loaded and Startup/Unloaded.
4. Click OK.
1. From the
Windows Start menu, select Programs Autodesk Autodesk Inventor[version] Tools Add-In Manager.
2. In the Add-In
Manager dialog box, double-click the name in the list to switch between Loaded
and Unloaded or between Startup/Loaded and Startup/Unloaded.
3. Click OK.
·
Assembly Bonus Tools
·
Autodesk DWF Markup Manager
·
Autodesk iDrop Translator
·
AutoLimits
·
Content Center
·
Content Center Item Translator
·
Design Accelerator
·
Drag & Drop Interoperability
·
ESKD Support
·
Eco Materials Adviser
·
Frame Generator
·
iLogic
·
Inventor Studio
·
Inventor Vault
·
Translator: Alias
·
Translator: CATIA V4 Import
·
Translator: CATIA V5 Import
·
Translator: CATIA V5 Part Export
·
Translator: CATIA V5 Product Export
·
Translator: DWF
·
Translator: DWFx
·
Translator: DWG
·
Translator: DXF
·
Translator: IGES
·
Translator: JT
·
Translator: Parasolid Binary
·
Translator: Parasolid Text
·
Translator: PDF
·
Translator: Pro/ENGINEER
·
Translator: Pro/ENGINEER Granite
·
Translator: Pro/ENGINEER Neutral
·
Translator: SAT
·
Translator: SolidWorks
·
Translator: STEP
·
Translator: STL
·
Translator: UGS NX
·
Assembly Bonus Tools
·
Autodesk DWF Markup Manager
·
Autodesk iDrop Translator
·
Autodesk IDF Translator
·
AutoLimits
·
Content Center
·
Content Center Item Translator
·
Design Accelerator
·
Drag & Drop Interoperability
·
ESKD Support
·
Eco Materials Adviser
·
Frame Generator
·
iLogic
·
Inventor Studio
·
Inventor Vault
·
Routed Systems: Cable & Harness
·
Routed Systems: Tube & Pipe
·
Simulation: Dynamic Simulation
·
Simulation: Stress Analysis
·
Translator: Alias
·
Translator: CATIA V4 Import
·
Translator: CATIA V5 Import
·
Translator: CATIA V5 Part Export
·
Translator: CATIA V5 Product Export
·
Translator: DWF
·
Translator: DWFx
·
Translator: DWG
·
Translator: DXF
·
Translator: IGES
·
Translator: JT
·
Translator: Parasolid Binary
·
Translator: Parasolid Text
·
Translator: PDF
·
Translator: Pro/ENGINEER
·
Translator: Pro/ENGINEER Granite
·
Translator: Pro/ENGINEER Neutral
·
Translator: SAT
·
Translator: SolidWorks
·
Translator: STEP
·
Translator: STL
·
Translator: UGS NX
Sort the list
by name or load behavior by clicking the column header. Press CTRL + click to
select multiple items on the list.
Start menu:
Programs Autodesk Autodesk
Inventor [version] Tools Add-In Manager.
|
Different
ways of developing automation tests:
Recording Tests Using Windows Internet Explorer and Playing Back
Using Mozilla Firefox
Using
the Microsoft Visual Studio 2010 Feature Pack 2, you can use Windows Internet
Explorer 7 (or later versions) to record UI actions on a website or a Web-based
application and then play back the tests using the Mozilla Firefox browser
·
Coded UI Tests: You can create automated tests of the user interface (UI)
known as coded UI tests. These tests provide functional testing of
the user interface and validation of user interface controls. Coded UI tests
let you test the functionality of a user interface. They are quicker to run
than manual tests. Therefore, you can run them more frequently. Using the
Microsoft Visual Studio 2010 Feature Pack 2, you can record UI actions on a
website or on a Web-based application. You can create coded UI tests using
Internet Explorer and then play back the tests using the Firefox browser.
·
Manual Tests: You can create manual test cases to test your application.
In a manual test case, you can document all the required test steps for a
specific scenario and any other information that you must have to run the
manual test. This might include attaching files to the manual test case. You
must add your manual test cases to a test plan to be able to run them using
Test Runner. By adding your manual test cases to a plan you can save the
results every time that you run your test. Using the Microsoft Visual Studio
2010 Feature Pack 2, you can create an action recording for manual test steps
that are performed on a website or on a Web-based application. You can record
the tests using Internet Explorer and then play back the tests using the
Firefox browser.
For
more information about manual tests, see Creating Manual Test
Cases and Running Manual Tests
Using Test Runner.
If
you want to run your coded UI tests remotely for your application, you must
install the Microsoft Visual Studio 2010 Feature Pack 2 on any computer that
has a test agent or a test controller that you will use to run the tests. For more
information about how to run coded UI tests, see How to: Set Up Your
Test Agent to Run Tests that Interact with the Desktop and Running Automated Tests.
If
you want to build the test project that contains your Silverlight coded UI
tests as part of team build using a build agent, you must install the Microsoft
Visual Studio 2010 Feature Pack 2 on any computer that has a build agent that
is used to build the test project. For more information about how to build and
run tests, see How to: Configure and
Run Scheduled Tests After Building Your Application.
The
user could have multiple versions of Firefox installed and multiple languages
of the same version of Firefox installed. The playback lets the user choose the
version and language of Firefox on which the playback is supposed to occur.
While doing playback using the Microsoft Test Runner, all the Firefox versions
that are installed on the machine are displayed for the user to choose from. In
case of CodedUITest, the user can set the BrowserWindow.CurrentBrowser
environment attribute to any of the installed versions and playback will choose
the designated Firefox version for playback.
For example, if you
set BrowserWindow.CurrentBrowser = “Firefox 3.5.7 (ar)” playback will use the
3.5.7 Arabic Version of Firefox. Setting the CurrentBrowser property to
“Firefox” would choose the default version of Firefox installed for playback.
Check the registry key under HKEY_LOCAL_MACHINE\SOFTWARE\Mozilla\Mozilla
Firefox to find the names of all the Mozilla Firefox versions installed on your
machine and use these names to set the CurrentBrowser property. You can also
specify the CurrentBrowser property through CodedUITestCurrentBrowser
Environment variable. Coded UI tests would read this environment variable and
set the CurrentBrowser property itself as a part of test initialization. This
is a better way to choose a browser for playback because it wouldn’t involve
changing your coded UI test. Additionally, you can manipulate the browser for
playback by using this environment variable.
Standered recording:
An analog
recording is one where a property or
characteristic of a physical recording medium is made to vary in a manner
analogous to the variations in air pressure of the original sound. Generally,
the air pressure variations are first converted (by a transducer such as a microphone) into an
electrical analog signal in which either the instantaneous voltage or current
is directly proportional to the instantaneous air pressure (or is a function of
the pressure). The variations of the electrical signal in turn are converted to
variations in the recording medium by a recording machine such as a tape
recorder or record cutter—the variable property of the medium is modulated by the signal. Examples of properties
that are modified are the magnetization of magnetic
tape or the deviation (or displacement) of the groove of a gramophone disc from a smooth, flat spiral
track.
A digital
recording is
produced by converting the physical properties of the original sound into a
sequence of numbers, which can then be stored and read back for reproduction.
Normally, the sound is transduced (as by a microphone) to an analog signal in
the same way as for analog recording, and then the analog signal is digitized, or
converted to a digital signal, through an analog-to-digital converter and then recorded onto a digital storage medium such as a compact
disc or hard
disk.
Both analog and digital systems have limitations. The bandwidth of the digital system is limited, according to the Nyquist
frequency, by the sample
rate used.
The bandwidth of an analog system is limited by the physical capabilities of
the analog circuits and recording medium. The signal-to-noise ratio (S/N) of a digital system is limited by the bit
depth of the
digitization process. In an analog system, other natural analog noise sources
exist, such as flicker
noise and
imperfections in the recording medium.
QTP Low Level Recording Tutorial
You can switch to Low Level Recording mode only
while recording a test. The option is not available while editing a test.
The
record mode changes to Low Level Recording and all of your keyboard input and mouse clicks are
recorded based on mouse coordinates. When QTP runs the test, the cursor
retraces the recorded clicks.
3.
When you are finished and want to return to normal
recording mode, click the Low Level Recording button or selectAutomation > Low Level
Recording to turn off
the option.
The
following examples illustrate the difference between the same operations
recorded using normal mode and Low Level Recording mode.
Suppose
you type the word tutorial into a user name edit box and then press the Tab key
while in normal recording mode. Your test is displayed as follows in the
Keyword View and Expert View:
Introduction to Descriptive Programming.
How to write Descriptive Programming?
When and Where to use Descriptive programming?
Some points to note with Descriptive Programming.
Introduction to Descriptive Programming:
Descriptive programming is used when we want to perform an operation on an object that is not present in the object repository. There can be various valid reason to do so. We will discuss them later in this article.
How to write Descriptive Programming?
How to write Descriptive Programming?
When and Where to use Descriptive programming?
Some points to note with Descriptive Programming.
Introduction to Descriptive Programming:
Descriptive programming is used when we want to perform an operation on an object that is not present in the object repository. There can be various valid reason to do so. We will discuss them later in this article.
How to write Descriptive Programming?
There are two ways in which descriptive programming can be used
1. By giving the description in form of the string arguments.
2. By creating properties collection object for the description.
1. By giving the description in form of the string arguments.
This is a more commonly used method for Descriptive Programming.
You can describe an object directly in a statement by specifying property:=value pairs describing the object instead of specifying an object’s
name. The general syntax is:
TestObject("PropertyName1:=PropertyValue1", "..." , "PropertyNameX:=PropertyValueX")
TestObject—the test object class could be WebEdit, WebRadioGroup etc….
PropertyName:=PropertyValue—the test object property and its value. Each property:=value pair should be separated by commas and quotation
marks. Note that you can enter a variable name as the property value if you want to find an object based on property values you retrieve during a run session.
Consider the HTML Code given below:
<--!input type="”textbox”" name="”txt_Name”"-->
<--!input type="”radio”" name="”txt_Name”"-->
Now to refer to the textbox the statement would be as given below
Browser(“Browser”).Page(“Page”).WebEdit(“Name:=txt_Name”,”html tag:=INPUT”).set “Test”
And to refer to the radio button the statement would be as given below
Browser(“Browser”).Page(“Page”).WebRadioGroup(“Name:=txt_Name”,”html tag:=INPUT”).set “Test”
If we refer to them as a web element then we will have to distinguish between the 2 using the index property
Browser(“Browser”).Page(“Page”).WebElement(“Name:=txt_Name”,”html tag:=INPUT”,”Index:=0”).set “Test” ‘ Refers to the textbox
Browser(“Browser”).Page(“Page”).WebElement(“Name:=txt_Name”,”html tag:=INPUT”,”Index:=1”).set “Test” ‘ Refers to the radio button
To determine which property and value pairs to use, you can use the Object Spy:
1. Go to Tools -> Object Spy.
2. Select the "Test Object Properties" radio button.
3. Spy on the desired object.
4. In the Properties list, find and write down the properties and values that can be used to identify the object.
2. By creating properties collection object for the description.
Properties collection also does the same thing as string arguments. The only difference is that it "collects" all the properties of a particular object in an instance of that object. Now that object can be referenced easily by using the instance, instead of writing "string arguments" again and again. It is my observation that people find "string arguments" [1] method much easier and intuitive to work with.
To use this method you need first to create an empty description
Dim obj_Desc ‘Not necessary to declare
Set obj_Desc = Description.Create
Now we have a blank description in “obj_Desc”. Each description has 3 properties “Name”, “Value” and “Regular Expression”.
obj_Desc(“html tag”).value= “INPUT”
When you use a property name for the first time the property is added to the collection and when you use it again the property is modified. By default each property that is defined is a regular expression. Suppose if we have the following description
obj_Desc(“html tag”).value= “INPUT”
obj_Desc(“name”).value= “txt.*”
This would mean an object with html tag as INPUT and name starting with txt. Now actually that “.*” was considered as regular expression. So, if you want the property “name” not to be recognized as a regular expression then you need to set the “regularexpression” property as FALSE
obj_Desc(“html tag”).value= “INPUT”
obj_Desc(“name”).value= “txt.*”
obj_Desc(“name”).regularexpression= “txt.*”
This is how we create a description. Now below is the way we can use it
Browser(“Browser”).Page(“Page”).WebEdit(obj_Desc).set “Test”
When we say .WebEdit(obj_Desc) we define one more property for our description that was not earlier defined that is it’s a text box (because QTPs WebEdit boxes map to text boxes in a web page).
If we know that we have more than 1 element with same description on the page then we must define “index” property for the that description
Consider the HTML code given below
<--!input type="”textbox”" name="”txt_Name”"-->
<--!input type="”textbox”" name="”txt_Name”"-->
Now the html code has two objects with same description. So distinguish between these 2 objects we will use the “index” property. Here is the description for both the object
For 1st textbox:
obj_Desc(“html tag”).value= “INPUT”
obj_Desc(“name”).value= “txt_Name”
obj_Desc(“index”).value= “0”
For 2nd textbox:
obj_Desc(“html tag”).value= “INPUT”
obj_Desc(“name”).value= “txt_Name”
obj_Desc(“index”).value= “1”
Consider the HTML Code given below:
<--!input type="”textbox”" name="”txt_Name”"-->
<--!input type="”radio”" name="”txt_Name”"-->
We can use the same description for both the objects and still distinguish between both of them
obj_Desc(“html tag”).value= “INPUT”
obj_Desc(“name”).value= “txt_Name”
When I want to refer to the textbox then I will use the inside a WebEdit object and to refer to the radio button I will use the description object with the WebRadioGroup object.
Browser(“Browser”).Page(“Page”).WebEdit(obj_Desc).set “Test” ‘Refers to the text box
Browser(“Browser”).Page(“Page”).WebRadioGroup(obj_Desc).set “Test” ‘Refers to the radio button
But if we use WebElement object for the description then we must define the “index” property because for a webelement the current description would return two objects.
Getting Child Object:
We can use description object to get all the objects on the page that matches that specific description. Suppose we have to check all the checkboxes present on a web page. So we will first create an object description for a checkboxe and then get all the checkboxes from the page
Dim obj_ChkDesc
Set obj_ChkDesc=Description.Create
obj_ChkDesc(“html tag”).value = “INPUT”
obj_ChkDesc(“type”).value = “checkbox”
Dim allCheckboxes, singleCheckBox
Set allCheckboxes = Browse(“Browser”).Page(“Page”).ChildObjects(obj_ChkDesc)
For each singleCheckBox in allCheckboxes
singleCheckBox.Set “ON”
Next
The above code will check all the check boxes present on the page. To get all the child objects we need to specify an object description.
If you wish to use string arguments [1], same thing can be accomplished by simple scripting.
Code for that would be:
i=0
Do While Browse(“Browser”).Page(“Page”).WebCheckBox("html tag:=INPUT",type:=checkbox, "index:="&i).Exist
Browse(“Browser”).Page(“Page”).WebCheckBox("html
tag:=INPUT",type:=checkbox, "index:="&i).Set "ON"
i=i+1
i=i+1
Loop
Possible Operation on Description Objects
Consider the below code for all the solutions
Dim obj_ChkDesc
Set obj_ChkDesc=Description.Create
obj_ChkDesc(“html tag”).value = “INPUT”
obj_ChkDesc(“type”).value = “checkbox”
Q: How to get the no. of description defined in a collection
A: obj_ChkDesc.Count ‘Will return 2 in our case
Q: How to remove a description from the collection
A: obj_ChkDesc.remove “html tag” ‘would delete the html tag property from the collection
Q: How do I check if property exists or not in the collection?
A: The answer is that it’s not possible. Because whenever we try to access a property which is not defined its automatically added to the collection. The only way to determine is to check its value that is use a if statement “if obj_ChkDesc(“html tag”).value = empty then”.
Q: How to browse through all the properties of a properties collection?
A: Two ways
1st:
For each desc in obj_ChkDesc
Name=desc.Name
Value=desc.Value
RE = desc.regularexpression
Next
2nd:
For i=0 to obj_ChkDesc.count - 1
Name= obj_ChkDesc(i).Name
Value= obj_ChkDesc(i).Value
RE = obj_ChkDesc(i).regularexpression
Next
Hierarchy of test description:
When using programmatic descriptions from a specific point within a test object hierarchy, you must continue to use programmatic descriptions
from that point onward within the same statement. If you specify a test object by its object repository name after other objects in the hierarchy have
been described using programmatic descriptions, QuickTest cannot identify the object.
For example, you can use Browser(Desc1).Page(Desc1).Link(desc3), since it uses programmatic descriptions throughout the entire test object hierarchy.
You can also use Browser("Index").Page(Desc1).Link(desc3), since it uses programmatic descriptions from a certain point in the description (starting
from the Page object description).
However, you cannot use Browser(Desc1).Page(Desc1).Link("Example1"), since it uses programmatic descriptions for the Browser and Page objects but
then attempts to use an object repository name for the Link test object (QuickTest tries to locate the Link object based on its name, but cannot
locate it in the repository because the parent objects were specified using programmatic descriptions).
When and Where to use Descriptive programming?
Below are some of the situations when Descriptive Programming can be considered useful:
1. One place where DP can be of significant importance is when you are creating functions in an external file. You can use these function in various actions directly , eliminating the need of adding object(s) in object repository for each action[If you are using per action object repository]
Possible Operation on Description Objects
Consider the below code for all the solutions
Dim obj_ChkDesc
Set obj_ChkDesc=Description.Create
obj_ChkDesc(“html tag”).value = “INPUT”
obj_ChkDesc(“type”).value = “checkbox”
Q: How to get the no. of description defined in a collection
A: obj_ChkDesc.Count ‘Will return 2 in our case
Q: How to remove a description from the collection
A: obj_ChkDesc.remove “html tag” ‘would delete the html tag property from the collection
Q: How do I check if property exists or not in the collection?
A: The answer is that it’s not possible. Because whenever we try to access a property which is not defined its automatically added to the collection. The only way to determine is to check its value that is use a if statement “if obj_ChkDesc(“html tag”).value = empty then”.
Q: How to browse through all the properties of a properties collection?
A: Two ways
1st:
For each desc in obj_ChkDesc
Name=desc.Name
Value=desc.Value
RE = desc.regularexpression
Next
2nd:
For i=0 to obj_ChkDesc.count - 1
Name= obj_ChkDesc(i).Name
Value= obj_ChkDesc(i).Value
RE = obj_ChkDesc(i).regularexpression
Next
Hierarchy of test description:
When using programmatic descriptions from a specific point within a test object hierarchy, you must continue to use programmatic descriptions
from that point onward within the same statement. If you specify a test object by its object repository name after other objects in the hierarchy have
been described using programmatic descriptions, QuickTest cannot identify the object.
For example, you can use Browser(Desc1).Page(Desc1).Link(desc3), since it uses programmatic descriptions throughout the entire test object hierarchy.
You can also use Browser("Index").Page(Desc1).Link(desc3), since it uses programmatic descriptions from a certain point in the description (starting
from the Page object description).
However, you cannot use Browser(Desc1).Page(Desc1).Link("Example1"), since it uses programmatic descriptions for the Browser and Page objects but
then attempts to use an object repository name for the Link test object (QuickTest tries to locate the Link object based on its name, but cannot
locate it in the repository because the parent objects were specified using programmatic descriptions).
When and Where to use Descriptive programming?
Below are some of the situations when Descriptive Programming can be considered useful:
1. One place where DP can be of significant importance is when you are creating functions in an external file. You can use these function in various actions directly , eliminating the need of adding object(s) in object repository for each action[If you are using per action object repository]
2. The objects in the application are dynamic in nature and need
special handling to identify the object. The best example would be of clicking
a link which changes according to the user of the application, Ex. “Logout
<>”.
3. When object repository is getting huge due to the no. of objects being added. If the size of Object repository increases too much then it decreases the performance of QTP while recognizing a object. [For QTP8.2 and below Mercury recommends that OR size should not be greater than 1.5MB]
4. When you don’t want to use object repository at all. Well the first question would be why not Object repository? Consider the following scenario which would help understand why not Object repository
Scenario 1: Suppose we have a web application that has not been developed yet.Now QTP for recording the script and adding the objects to repository needs the application to be up, that would mean waiting for the application to be deployed before we can start of with making QTP scripts. But if we know the descriptions of the objects that will be created then we can still start off with the script writing for testing
Scenario 2: Suppose an application has 3 navigation buttons on each and
every page. Let the buttons be “Cancel”, “Back” and “Next”. Now recording action
on these buttons would add 3 objects per page in the repository. For a 10 page
flow this would mean 30 objects which could have been represented just by using
3 objects. So instead of adding these 30 objects to the repository we can just
write 3 descriptions for the object and use it on any page.
5. Modification to a test case is needed but the Object repository for the same is Read only or in shared mode i.e. changes may affect other scripts as well.
5. Modification to a test case is needed but the Object repository for the same is Read only or in shared mode i.e. changes may affect other scripts as well.
6. When you want to take action on similar type of object i.e.
suppose we have 20 textboxes on the page and there names are in the form txt_1,
txt_2, txt_3 and so on. Now adding all 20 the Object repository would not be a
good programming approach.
No comments:
Post a Comment