- ALM allows integration with other HP products such as HP UFT and Hp Load Runner.
- HP UFT is a functional automation tool that supports automation of both windows based and web based application. It also supports multiple technologies such as .NET, Java, Siebel, SAP etc.
- In this section we will understand how to drive UFT scripts from ALM. It consists of various configurations and steps.
- Prerequisite for this module is that both ALM and UFT must have been installed.
Part A - Add-in Installation:
Step 1) Navigate to the ALM landing page (http://localhost:8181/qcbin/) and select 'Tools' as shown below.
Step 2) The Add-in page and 'HP ALM connectivity' link should be clicked.
Step 3) Click 'Download HP ALM Connectivity' link and the exe file would be downloaded in the specified location.
Step 4) Right click the downloaded file and 'Run as Administrator'.
Step 5) There won't be any installation wizard that the user has to go through if UFT is preinstalled. User only receives the installation status as shown below.
Part B – Connecting UFT and ALM
Step 1) Open UFT and you will notice the presence of ALM as one of the menus as shown below.
Step 2) Navigate the ALM menu and select ALM connection.
Step 3) ALM connection dialog opens.
- Enter the ALM server URL
- Enter the UserName
- Enter the Password and click 'Connect'
Step 4) Upon successful authentication, the ALM files would be downloaded as we are establishing connection between ALM and UFT for the very first time.
Step 5) The ALM connection dialog waits for the user to select the domain and project.
- Select Domain
- Select the project
- Click 'Login'
Step 6) The ALM connection dialog displays the status.
- Connected to the Server and lists the details about the server address and user name.
- Connected to the project and lists the details about the project.
- Click 'Close'
Part C – Saving Script into ALM
- Let us understand the various components that are required for Executing an UFT Script.
- Main Driver Script – The Entry point for any UFT Script that has .mts extension.
- Library – The relevant Script/Function Files that can either be of extension (.vbs) or (.qfl).
- Object Repository – It is usually of Shared Object repository by nature and has .tsr extension.
- DataTable – Used for parameterizing the tests. Usually an Excel file.
Note: The Idea behind this chapter is to understand ALM and UFT integration and NOT to learn how to write UFT scripts.
Step 1) First step is to save the Main Driver Script into ALM from UFT. Navigate to 'File' Menu and choose 'New Test' as shown below.
Step 2) The New Test Dialog opens.
- Select the type of test.
- Enter the Name of Test.
- We need to choose the location as ALM (by default it would display the UFT installed location). Click on 'Browse' Button.
Step 3) The 'Select Location' Dialog opens up.
- Choose 'ALM Test Plan' Tab.
- Double Click 'Functional' folder to open its subfolders.
Step 4) The 'Select Location' Dialog opens up with the subfolders of 'Functional' Folder.
- Double Click 'Automation folder.
- Click 'Select'.
Step 5) The 'New Test' Dialog is displayed back to the user
- With the selected test location pointing to ALM.
- Click 'Create'.
Step 6) Now let us verify if the test has created successfully by logging into ALM.
Navigate to 'Test Plan' Module.
- You will notice that the test script 'Guru99_Bank_Auto' is created under 'Automation' folder.
- Under details tab, we can also find that the test type is locked down as 'QUICKTEST_TEST' which means it is an UFT script.
Step 7)Now start developing the Script in UFT and save the script which can be accessed in ALM by selecting 'Test Script' Tab of the created test.
Step 8) Next step is to save the associated function library files under 'test resources' module of ALM which would be picked up automatically during execution.
For this script, we have two function libraries associated with the created test script out of which one contains all functions related to the application and one which contains function which will help the users to generate the output text result file.
Step 9) We need to save the associated library files in ALM under 'test Resources'.
- Click 'New Resource' button
- The 'New Resource' Dialog opens up
- Enter the Name of the Function Library
- Select the type as 'Function Library'
- Click 'OK'
Step 10) The created test resource will be displayed to the user as shown below.
Step 11) Now we need to upload the .vbs onto the created test resource.
- Click 'Resource Viewer'
- Click 'Upload File'
Step 12) The upload file dialog opens up.
- Select the Path where the .vbs file is located
- Select the File that has to be uploaded.
- Click 'Open'.
Step 13) Upon uploading successfully, ALM displays the status to the user. Click 'OK'.
Step 14) The uploaded test resource can be viewed using 'Resource Viewer'.
Step 15) Repeat the steps 8 to 14 to upload one other function file associated with the test. After uploading the 'generateresult.vbs', the resource viewer would be displayed as shown below.
Step 16) Now we need to upload the relevant 'Object Repository' files under 'test resources' module, similar to how we have uploaded function libraries.
- Click 'New Resource' Module
- The 'New Resource' Module window opens up.
- Enter the Name of the test resource.
- Select the type of the file as 'Object Repository'.
- Click 'OK'
Step 17) The Test resource is created as shown below. Now user needs to upload the repository file.
- Click 'Resource Viewer' Tab.
- Click 'Upload File' Button.
Step 18) Now upload the shared object repository file.
- Select the File where it has been stored.
- Click 'Open' button.
Step 19) Upon uploading successfully, ALM displays the status to the user. Click 'OK'.
Step 20) The test resource can be viewed right from ALM as shown below.
Step 21) The last test resource that we need to upload is the 'Test Data' Sheet which contains the parameterized test.
For Demo purposes, we have automated 4 tests cases. The designed Test data is shown as below. Now we need to upload the same in ALM.
Step 22) Create a new resource with name 'TestData' and select the type as 'test Resource' and select 'OK'
Step 23) As explained from step 17 to 19,uploadthe test data Excel file and uponsuccessful upload the Created 'test data' would be displayed as shown below.
Part D – Settings in UFT
Step 1) We have all the associated files loaded into ALM, we have to ensure that the automation script picks up the library file, OR and data file from ALM. Let us understand how to associate function libraries to the test script dynamically from ALM.
Step 2) The Object Repository also has to be picked up from 'Test Resources' Tab of ALM. Let us see how to load the Object repository dynamically during runtime.
Step 3) The Test Data has to be imported into the 'Global' Sheet of UFT. To perform the same we should ensure that we have the following piece of code before making an attempt to access the parameters mentioned in the data table.
Step 4) We Should ensure that we allow other HP products to interact with UFT. To perform the same, goto 'Tools' -> 'Options' as shown below.
Step 5) The Options Dialog opens up.
- Select 'GUI Testing' Tab.
- Select 'Test Runs'
- Enable 'Allow other HP products to run tests and components'
- Click 'OK'
Part E – Executing Scripts in ALM
Step 1) Create a test suite in 'Test Lab' Module for execution. Let us create a 'New Folder' for automated test suite.
- Select the 'Test Lab' Module
- Select the folder under which we like to create the new folder
- Click on New folder icon
- Enter the name of the folder
- Click OK.
Step 2) New Folder would be created as shown below:
Step 3) Now we need to create a test set under the created folder.
- Select the folder
- Click 'New Test Set' button
- Enter the Name of the Test Set
- Click 'Ok'
Step 4) Like manual tests, after creating the test set, the test instances need to be added from Test Plan tree.
- Select the created test set
- Click 'Select Tests' button. The Test Plan tree opens up.
- Select the test
- Click '<=' button
Step 5) The added test would be displayed as shown below.
- The added test displays the type of test as 'QUICKTEST_TEST' automatically.
- Click 'Run' Button to trigger the execution.
Step 5) The automatic test runner dialog opens up. Let us understand all the available features within this window.
- Run all – Allows us to execute the test set completely.
- Run – Allows us to execute only the selected test instance.
- Run all tests Locally – The test would be kicked off in the local host. If Unchecked user has the capabilities to enter to host name in which the tests has to be executed.
- Enable Log – Creates an execution log file during the test run. To view the execution log after text execution, Select 'View Execution' from 'Run' menu of the same dialog.
Click 'Run' to trigger the test.
Step 6) UFT will be launched in the background while the script is being executed. The run status will be displayed once the test execution is completed as shown below. Close the window.
Part F – Analyzing the Results:
Step 1) The execution grid is displayed back to the user upon closing the 'Automatic Runner' dialog.
- With test execution status updated.
- The inbuilt UFT test report can be accessed by clicking the 'Launch Report' button.
Step 2) The inbuilt UFT test report will be shown to the user.
Step 3) The detailed results can be accessed using 'Test Runs' module. Like manual tests, the detailed result displays all the information.
Step 4) The test also generates a text result file which can accessed from the attachments section. The text file is generated by the script(test framework) which is NOT the inbuilt report of UFT. To access the same perform the following:
- Select the 'Run ID'.
- The 'Run details' dialog opens up.
- Goto 'Attachments' Section.
- A result file will be available for the users to download. Double click on the text file.
Step 5) The text result file is opened in notepad. The result file will be displayed as shown below.
Video on QTP integration with Quality Center
- Quality Center provides many a features like copying test steps , emailing scripts for review , adding attachments etc. to facilitate faster development of test cases.
- You can create a script in Automation tools like QTP and Loadrunner , and then upload and store them in Quality Center
- You can also directly convert a Manual Test Script in Quality Center into an Automated Script.