Beruflich Dokumente
Kultur Dokumente
An Advanced Solution to
Functional & Regression Test Automation
Part - 2
Recovery Scenarios Keyword Driven Testing Framework Script Debugging Database Management by SQL Queries Relative Path Regular Expressions Working with HP Quality Center
Recovery scenarios can be defined for unwanted Pop-up window, Object state, Test run error or application crash.
Now QTP look for any security window with the title Security Information or any generic title.
Click Next
If we don't want to create another scenario uncheck the checkbox "Add another recovery operation"
Click "Next"
The Keyword-driven automation infrastructure usually includes one or more shared object repositories and one or more function libraries.
Once the test automation infrastructure is ready, the application testers can begin designing their keyword-driven tests by selecting objects and operation keywords in the Keyword View.
Preparing the test automation infrastructure includes a planning stage and an implementation stage.
2) Creating tests in the QTP Keyword View: by selecting the keywords (objects and/or operations) that represent the application functionality we want to test.
Benefit No. 5: When we record a test, QTP enters the correct object methods, and argument values for us.
Hence it is possible to create a test with little preparation or planning. Repercussions: Although we can easily create our tests quickly, But # Such tests are harder to maintain when the application changes and often require re-recording large parts of the test.
>>>>>>>>>>>>>>>>>>>>>> www.softwaretestinggenius.com <<<<<<<<<<<<<<<<<<<<<<
Benefit No. 6: Automation experts can add objects and functions based on detailed product specifications even before a feature has been added to a product.
For being successful with this framework the names of the resources should be clear and relevantly indicates the function of that particular resource.
For Instance, a function meant for creating a policy for a customer may be named as "CreatePolicy".
Browser("OAKLEAF Acorn - Log in"). Page(" OAKLEAF Acorn"). Frame("mainBody"). WebButton("Add"). Click
Browser("OAKLEAF Acorn -Login").Page("OAKLEAF Acom").Frame(" main Body").WebEdit("CIientSubGroup").Set When we do the same from the Key Word view it allows us to set the value for that method.
1) For application specific library where we store all the functions which cover the test cases
And 2) With generic functions which includes the functions like CIoseAllBrowsers(), VerifyObjectEnabled etc.
Script Debugging
Script debugging is a process, involving careful examination of the code line by line while executing the script with an objective to see the actions performed by the script at every step. This is required to fix a script which does not perform as expected.
Script Debugging
There are two types of debugging processes: 1) Debugging by "Step Into": When we select "Step Into" option, we can see if a function being executed is performing as expected. This will open the function desired to be debugged in "Read Only" mode and we can keep on hitting the F11 key on the keyboard to view the execution of every line of the function. 2) Debugging by "Step Over: This option is selected when we are sure that the function is performing as expected & we don't want to view the execution of the function. We can hit "F10" key to execute the entire function without stopping and will stop for our next command at the beginning of the next line after the function call.
>>>>>>>>>>>>>>>>>>>>>> www.softwaretestinggenius.com <<<<<<<<<<<<<<<<<<<<<<
Script Debugging
We can watch the values of the variables by adding the variables to the watch list. How to do? Place the cursor on the variable whose value needs to be watched while the script is being executed and from the "Debug" menu Select "Add to Watch". This will add the variable to the Watch list in the debug viewer at the bottom of the script.
Script Debugging
While creating the database checkpoint, once the DSN is created we can view the code for the connection between QTP & the database.
We can copy this code and save this string for use while connecting directly from the script I.e. without going through the checkpoint. DSN establishes a connection between QTP and the database we plan to work on.
Relative Path
What is Relative Path? Relative path is a way of instructing QTP to search for the resources like Actions, Repositories, Function Libraries and Data Tables by just specifying the name of the resource.
This is a very useful and powerful feature of QTP and can save tremendous amount of operational time when the project has to be migrated to a different place from the existing one.
This is useful in situation like: For example we had developed all scripts in a shared drive on the network and the organization happen to go in for Quality Center and we are required to migrate all the scripts into Quality Center.
Relative Path
Comparison with Normal Path or Absolute Path In the normal path or absolute path we go to the resources tab in the Test Settings and browse the resources for that script or action. If we have to change the location of the scripts we have to open each script and change the pointers to the resources in the resource tab. This could be extremely time consuming especially when we happen to have large number of scripts. The most complicated situation is of a flow where we have calls to the reusable actions following the absolute path, we will be required to build an entirely new flow to replace the existing one. Whereas by following the relative path, changing the resources is a one step process that could be completed in a few minutes time.
>>>>>>>>>>>>>>>>>>>>>> www.softwaretestinggenius.com <<<<<<<<<<<<<<<<<<<<<<
Regular Expressions
When we have an object in our application whose properties keep changing dynamically based on the state of the application, we need to manage these objects with the help of regular expressions. Regular expressions enable QTP to identify objects and text strings with varying values. You can use regular expressions when: 1) Defining the property values of an object in dialog boxes or in programmatic descriptions 2) Parameterizing a step 3) Creating checkpoints with varying values
Regular Expressions
For example, we can use a regular expression to create a text checkpoint on a date text string, but the displayed date changes according to the current date. If we define the date as a regular expression, the checkpoint checks that the captured text string matches the expected date format, rather than checking the exact date value. What is a regular expression A regular expression is a string that specifies a complex search phrase. By using special characters, such as a period (.), asterisk (*), caret (^), and brackets ([ ]), we can define the conditions of a search.
Here . (dot) represents one character and * (star) represents any number of characters or numbers.
4) After flow has been created, include the details and dependencies of the flow in the details tab in Quality Center.
5) To secure the usage of the tool, users should be created in Quality Center with QA Tester privileges for all the automation engineers. All the users should be added to the projects on which they are working.
Easy reach of Site administrator is very important, as some times the user login does not get disconnected normally and the test gets locked, and we need to kill the process from site admin.
7) Automation engineers should have the Project Administration privileges instead of Site Administrator privileges to create any User Defined variables in QualityCenter.
9) "Test Plan" part of the Quality Center should be extensively used by creating the required folders and saving the corresponding elements in them.
For example: The actions folder should have all the reusable actions for that project/application and Flows folder should have the Flows saved in them. This ensures easy accessibility.
11) The tests shoud always be run through Quality Center. This will enable us to compare the result history for every release.
12) Since QTP results consume large amount of disk space on the Quality Center server, it is better to flush out the results from the test set from time to time, while preserving the results of releases during last one year or so.
Thank You
End of Part -2
Quick Revision of HP QTP 10.0