1 / 67

Quick Revision of HP QTP 10.0 - Part 2

Learn about recovery scenarios, keyword-driven testing framework, script debugging, and more in this advanced solution to functional and regression test automation.

berrymark
Télécharger la présentation

Quick Revision of HP QTP 10.0 - Part 2

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. A Quick Revision of HP QTP 10.0 An Advanced Solution to Functional & Regression Test Automation Part - 2 >>>>>>>>>>>>>>>>>>>>>> www.softwaretestinggenius.com <<<<<<<<<<<<<<<<<<<<<<

  2. Recovery Scenarios Keyword Driven Testing Framework Script Debugging Database Management by SQL Queries Relative Path Regular Expressions Working with HP Quality Center Topics Covered in Part - 2 >>>>>>>>>>>>>>>>>>>>>> www.softwaretestinggenius.com <<<<<<<<<<<<<<<<<<<<<<

  3. What is a Recovery Scenario? Recovery Scenario is a mechanism by which QTP handles any unexpected windows, pop-ups or application crashes while the test is running so that the test is not interrupted. Every type of recovery situation needs to be handled with a separate recovery scenario. The recovery scenarios continuously look for the recovery situations occurring in the application as long as the test is running. >>>>>>>>>>>>>>>>>>>>>> www.softwaretestinggenius.com <<<<<<<<<<<<<<<<<<<<<<

  4. How to create a recovery scenario? Select "recovery Scenario Manager" from the "Resources" menu. >>>>>>>>>>>>>>>>>>>>>> www.softwaretestinggenius.com <<<<<<<<<<<<<<<<<<<<<<

  5. How to create a recovery scenario? Recovery Scenario Wizards starts. Click Next on this screen. >>>>>>>>>>>>>>>>>>>>>> www.softwaretestinggenius.com <<<<<<<<<<<<<<<<<<<<<<

  6. How to create a recovery scenario? Depending on the desired type of recovery scenario, select the appropriate Radio button. Recovery scenarios can be defined for unwanted Pop-up window, Object state, Test run error or application crash. >>>>>>>>>>>>>>>>>>>>>> www.softwaretestinggenius.com <<<<<<<<<<<<<<<<<<<<<<

  7. How to create a recovery scenario? Click Next button to view a pop-up window. For Instance, following Pop-up window may appear while navigating from non-secure to a secure web page. >>>>>>>>>>>>>>>>>>>>>> www.softwaretestinggenius.com <<<<<<<<<<<<<<<<<<<<<<

  8. How to create a recovery scenario? QTP captures the window title and window text. Uncheck the checkbox "Window text contains". Now QTP look for any security window with the title Security Information or any generic title. >>>>>>>>>>>>>>>>>>>>>> www.softwaretestinggenius.com <<<<<<<<<<<<<<<<<<<<<<

  9. How to create a recovery scenario? If the window title changes dynamically with some pattern, Click the checkbox "Regular Expression" and provide the pattern. Click Next >>>>>>>>>>>>>>>>>>>>>> www.softwaretestinggenius.com <<<<<<<<<<<<<<<<<<<<<<

  10. How to create a recovery scenario? Next screen informs us that we should define the recovery operation to be done in order to handle this window. >>>>>>>>>>>>>>>>>>>>>> www.softwaretestinggenius.com <<<<<<<<<<<<<<<<<<<<<<

  11. How to create a recovery scenario? Click Next button to view the Recovery Operation window. Select the appropriate action to be performed. >>>>>>>>>>>>>>>>>>>>>> www.softwaretestinggenius.com <<<<<<<<<<<<<<<<<<<<<<

  12. How to create a recovery scenario? Keyboard or mouse operation allows us to click a button on the screen. Close application process allows us to kill the process which starts the unwanted window so we can continue with testing. Function call will allow us to write a user-defined function to handle the unwanted window. Restart Microsoft Windows allows us to restart the windows all together if needed. In above example, click on the first radio button "Keyboard or mouse operation". >>>>>>>>>>>>>>>>>>>>>> www.softwaretestinggenius.com <<<<<<<<<<<<<<<<<<<<<<

  13. How to create a recovery scenario? We can show the button we want QTP to click using the hand icon in the following screen and click Next button. >>>>>>>>>>>>>>>>>>>>>> www.softwaretestinggenius.com <<<<<<<<<<<<<<<<<<<<<<

  14. How to create a recovery scenario? We can add another recovery scenario if needed from the following screen. If we don't want to create another scenario uncheck thecheckbox "Add another recovery operation" Click "Next" >>>>>>>>>>>>>>>>>>>>>> www.softwaretestinggenius.com <<<<<<<<<<<<<<<<<<<<<<

  15. How to create a recovery scenario? Following screen allows us to define the Post-recovery operation to be performed. >>>>>>>>>>>>>>>>>>>>>> www.softwaretestinggenius.com <<<<<<<<<<<<<<<<<<<<<<

  16. How to create a recovery scenario? Since the recovery scenario is kicked off only when the error is about to be thrown since QTP could not find an object because of the unwanted window or object state it is logical to re-execute that particular statement again after the post-recovery operation. Hence select the option "Repeat current step and continue".If the situation is different, make the appropriate selection depending on the desired operation. If the exception does not allow us to test the application anymore in this test run, select the last radio button "Stop the test run" >>>>>>>>>>>>>>>>>>>>>> www.softwaretestinggenius.com <<<<<<<<<<<<<<<<<<<<<<

  17. How to create a recovery scenario? Use “Proceed to next step” if you want to continue with the test. Use “Proceed to next action” if you want to skip the current action in the flow and continue with the next action. Use “Proceed to next test iteration” if you want to skip the current row of global row and continue with the next row of Global sheet.Use “Restart current test run” if you want to start the test altogether. Click Next. >>>>>>>>>>>>>>>>>>>>>> www.softwaretestinggenius.com <<<<<<<<<<<<<<<<<<<<<<

  18. How to create a recovery scenario? Provide a name for the recovery scenario and click "Next". >>>>>>>>>>>>>>>>>>>>>> www.softwaretestinggenius.com <<<<<<<<<<<<<<<<<<<<<<

  19. How to create a recovery scenario? Make sure that the checkboxes "Add scenario to current test" and "Add scenario to default test settings" are selected as shown below. This will add the Recovery scenario to the current and the QTP settings as well. >>>>>>>>>>>>>>>>>>>>>> www.softwaretestinggenius.com <<<<<<<<<<<<<<<<<<<<<<

  20. How to create a recovery scenario? Click "Finish" and follow the further steps to save the recovery scenario to a recovery file >>>>>>>>>>>>>>>>>>>>>> www.softwaretestinggenius.com <<<<<<<<<<<<<<<<<<<<<<

  21. How to create a recovery scenario? Save the recovery scenario to a recovery file by Clicking the “Save” button in the following screen. >>>>>>>>>>>>>>>>>>>>>> www.softwaretestinggenius.com <<<<<<<<<<<<<<<<<<<<<<

  22. How to create a recovery scenario? Save the file to Disc >>>>>>>>>>>>>>>>>>>>>> www.softwaretestinggenius.com <<<<<<<<<<<<<<<<<<<<<<

  23. Keyword Driven Testing Framework Keyword-driven testing is a technique that separates much of the programming work from the actual test steps so that the test steps can be developed earlier and can often be maintained with only minor updates, even when the application or testing needs change significantly.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. >>>>>>>>>>>>>>>>>>>>>> www.softwaretestinggenius.com <<<<<<<<<<<<<<<<<<<<<<

  24. Keyword Driven Testing Framework The keyword-driven testing methodology divides test creation into two stages: 1) Preparing a set of testing resources or test automation infrastructure: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. >>>>>>>>>>>>>>>>>>>>>> www.softwaretestinggenius.com <<<<<<<<<<<<<<<<<<<<<<

  25. Keyword Driven Testing Framework Advantages of keyword-driven testing methodology: Benefit No.1: It enables us to design our tests at a business level rather than at the object level. For example, QTP may recognize a single option selection in our application as several steps: a click on a button object, a mouse operation on a list object, and then a keyboard operation on a list sub-item. We can create an appropriately-named function to represent all of these lower-level operations in a single, business-level keyword.Benefit No. 2: By incorporating technical operations, like a synchronization statement that waits for client-server communications to finish, into higher level keywords, tests are easier to read and easier for less technical application testers to maintain when the application changes. >>>>>>>>>>>>>>>>>>>>>> www.softwaretestinggenius.com <<<<<<<<<<<<<<<<<<<<<<

  26. Keyword Driven Testing Framework Advantages of keyword-driven testing methodology: Benefit No. 3: Keyword-driven testing leads to a more efficient separation between resource maintenance and test maintenance. This enables the automation experts to focus on maintaining objects and functions while application testers focus on maintaining the test structure and design. Benefit No.4: When recording tests, we may not notice that new objects are being added to the local object repository. This may result in many testers maintaining local object repositories with copies of the same objects. When using a keyword-driven methodology, you select the objects for your steps from the existing object repository. >>>>>>>>>>>>>>>>>>>>>> www.softwaretestinggenius.com <<<<<<<<<<<<<<<<<<<<<<

  27. Keyword Driven Testing Framework Advantages of keyword-driven testing methodology: When you need a new object, you can add it to your local object repository temporarily, but you are also aware that you need to add it to the shared object repository for future use.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 <<<<<<<<<<<<<<<<<<<<<<

  28. Keyword Driven Testing Framework Advantages of keyword-driven testing methodology: While using keyword-driven methodology, we select from existing objects and operation keywords. Hence we must need to be familiar with both the object repositories and the function libraries that are available. We must also have a good idea of what we want our test to look like before we begin inserting steps. This usually results in well-planned and better-structured tests, which also results in easier long-term maintenance. 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. >>>>>>>>>>>>>>>>>>>>>> www.softwaretestinggenius.com <<<<<<<<<<<<<<<<<<<<<<

  29. Keyword Driven Testing Framework Using Keyword Driven Testing >>>>>>>>>>>>>>>>>>>>>> www.softwaretestinggenius.com <<<<<<<<<<<<<<<<<<<<<<

  30. Keyword Driven Testing Framework In Keyword Driven Testing Framework every resource of QTP is considered as a Keyword and can be dragged and dropped into the script area from the "Available Keywords" section. 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". >>>>>>>>>>>>>>>>>>>>>> www.softwaretestinggenius.com <<<<<<<<<<<<<<<<<<<<<<

  31. Keyword Driven Testing Framework When we expand every folder in the Available Keywords section, we can view all the resources or Key words listed out there. >>>>>>>>>>>>>>>>>>>>>> www.softwaretestinggenius.com <<<<<<<<<<<<<<<<<<<<<<

  32. Keyword Driven Testing Framework When we drag and drop the objects from the Object repository to the script area, the script is automatically populated for us with the most common method used for that kind of object. For Instance: 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").SetWhen we do the same from the “Key Word view” it allows us to set the value for that method. >>>>>>>>>>>>>>>>>>>>>> www.softwaretestinggenius.com <<<<<<<<<<<<<<<<<<<<<<

  33. Keyword Driven Testing Framework Please refer the snapshot.We can set the value of the Edit field "CommunicationValue" by clicking in the "Value" field of the Keyword view for that object after dragging the object and by clicking "#" sign which opens the "Value Configuration Options" window where we can enter the value or we can parameterize the value. >>>>>>>>>>>>>>>>>>>>>> www.softwaretestinggenius.com <<<<<<<<<<<<<<<<<<<<<<

  34. Keyword Driven Testing Framework The key to the success of the Key word driven framework is creating as many functions as possible for the application and adding all the objects of the application to the repository before starting the project. There are two types of function libraries: 1) For application specific library where we store all the functions which cover the test casesAnd 2) With generic functions which includes the functions like CIoseAllBrowsers(), VerifyObjectEnabled etc. >>>>>>>>>>>>>>>>>>>>>> www.softwaretestinggenius.com <<<<<<<<<<<<<<<<<<<<<<

  35. Keyword Driven Testing Framework Keyword Driven Framework can be further simplified by using the Keywords or flags from a data table. For Instance: If DataTable("WeightTicket",dtGIobaISheet) = "Yes" Then RunAction "WeightTicketVerification [WeightTicketVerification]", onelteration End If In this example, the flag "WeightTicket" in the Global Sheet is set to "Yes" or "No" and depending on the value of that flag we run the Action pertaining to that functionality, in this case the action name is "WeightTicketVerification". >>>>>>>>>>>>>>>>>>>>>> www.softwaretestinggenius.com <<<<<<<<<<<<<<<<<<<<<<

  36. Keyword Driven Testing Framework Keyword Driven Frame Work emphasizes that1) All the functionality is coded in the functions 2) All these functions are dragged into the script area This avoids the script outside the function libraryIt is very important to name the functions carefully with relevant and meaningful names. If we have to use multiple function libraries, we need to ensure that the names of every function are unique i.e they should not repeat. >>>>>>>>>>>>>>>>>>>>>> www.softwaretestinggenius.com <<<<<<<<<<<<<<<<<<<<<<

  37. Keyword Driven Testing Framework Use of an Initialization script As a best practice an Initialization script is used to load all the required resources into QTP Secondly this is called in to the Driver script having flow of actions Such driver script can be called “Flow”. The initialization script should be kept as the first script in the flow of actions. >>>>>>>>>>>>>>>>>>>>>> www.softwaretestinggenius.com <<<<<<<<<<<<<<<<<<<<<<

  38. 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. Debugging is a process of eliminating the bugs in QTP scripts. For starting the debugging process, go to "Debug" menu and select the desired debug process. We can start debugging from the existing position of the cursor or we can execute the script up to the cursor position in the debug mode. >>>>>>>>>>>>>>>>>>>>>> www.softwaretestinggenius.com <<<<<<<<<<<<<<<<<<<<<<

  39. 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 <<<<<<<<<<<<<<<<<<<<<<

  40. 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" menuSelect "Add to Watch".This will add the variable to the Watch list in the debug viewer at the bottom of the script. >>>>>>>>>>>>>>>>>>>>>> www.softwaretestinggenius.com <<<<<<<<<<<<<<<<<<<<<<

  41. Script Debugging >>>>>>>>>>>>>>>>>>>>>> www.softwaretestinggenius.com <<<<<<<<<<<<<<<<<<<<<<

  42. Database Management by SQL Queries Whenever needed, we can write the SQL queries and do the insert, delete and update of the records in the database using QTP scripts. We need the Data Source Name (DSN) information which can be created using the Database checkpoint. 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. >>>>>>>>>>>>>>>>>>>>>> www.softwaretestinggenius.com <<<<<<<<<<<<<<<<<<<<<<

  43. Database Management by SQL Queries We can drive the input to the SQL query using the data table values. Example of QTP script to connect to the sample flight VB application's database provided with QTP and deletes the order from the Orders table taking the order number from the "OrderNumber" field in the Global Sheet of the data table. Set MyConn = CreateObject ("ADO DB.Connection") MyConn.ConnectionString = "DBQ=C:\Program Files\HP\QuickTest Professional\samples\flight\app\flight32.mdb; DefauItDir=C:\Program Files\HP\QuickTestProfessional\samples\flight\app; Driver={Microsoft Access Driver (*.mdb, *.accdb)}; Driverld=281;FIL=MS Access; FILEDSN=C:\Program Files\Common Files\ODBC\Data Sources\FlightJuly10DSN.dsn; >>>>>>>>>>>>>>>>>>>>>> www.softwaretestinggenius.com <<<<<<<<<<<<<<<<<<<<<<

  44. Database Management by SQL Queries MaxBufferSize=2048;MaxScanRows=8;PageTimeout= 5;SafeTransactions=O;Thread s=3;UID=admin;UserCommitSync=Yes;" Set RecordSet = CreateObject ("ADO DB.Recordset") RecordSet.CursorType = 1 OrderNumber=DataTable("OrderNumber", dtGIobalSheet) SQLQuery="Delete Orders. Order Number FROM Orders WHERE Orders.Order Number ="&OrderNumer MyConn.Open RecordSet.Open SQLQuery, MyConn MyConn.Close Set MyConn = Nothing >>>>>>>>>>>>>>>>>>>>>> www.softwaretestinggenius.com <<<<<<<<<<<<<<<<<<<<<<

  45. 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”. >>>>>>>>>>>>>>>>>>>>>> www.softwaretestinggenius.com <<<<<<<<<<<<<<<<<<<<<<

  46. 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 <<<<<<<<<<<<<<<<<<<<<<

  47. How to Implement Relative Path Mechanism Go to the “Options” from “Tools” menu and select “Folders” tab. Click on the green "+" sign in the search list section. Browse the folders one by one where we had stored the actions, function libraries, data tables, object repositories, environment variables etc. Now whenever we are making calls to the resources, we just need to provide the resource name excluding the path. QTP will search the search list folders for the specified resource and find out the desired resource. When we are to migrate from one location to the other, we just need to go to the “Folders” tab in “Options” and delete the old folders and enter the new folders where our resources are residing now. >>>>>>>>>>>>>>>>>>>>>> www.softwaretestinggenius.com <<<<<<<<<<<<<<<<<<<<<<

  48. How to Implement Relative Path Mechanism Make sure that while using the relative path to call the resources, we are not duplicating the action names or repository names etc. Repercussions of having same name for two resources:Same names for the two resources will be confusing QTP. For example: we have two projects with a shared object repository for each of them and we have kept the name of the repository as "SharedObjectRepository" for both of them. When QTP searches the search folders specified in the “Options”“Folders” it captures the first instance of the "SharedObjectRepository" in its path irrespective of the project. Thus we might end up calling the wrong shared object repository. >>>>>>>>>>>>>>>>>>>>>> www.softwaretestinggenius.com <<<<<<<<<<<<<<<<<<<<<<

  49. How to Implement Relative Path Mechanism Folders Node to set the relative path. >>>>>>>>>>>>>>>>>>>>>> www.softwaretestinggenius.com <<<<<<<<<<<<<<<<<<<<<<

  50. How to Implement Relative Path Mechanism In QTP 10.0, check the checkbox: "Remind me to use relative paths when specifying a path to resource" in the Folders node of the options window. >>>>>>>>>>>>>>>>>>>>>> www.softwaretestinggenius.com <<<<<<<<<<<<<<<<<<<<<<

More Related