Manage tests, the automation way
Most software applications today are web-based. To keep pace with competition and highly demanding processes within the enterprise, these web-based applications undergo frequent updates, either to add new features incorporate new innovations. While these updates are necessary, the amount spent to roll-out these updates are important too.
For faster testing, the testing team has to inevitably depend on automation. Among the various commercial and open source tools available in the test automation world today, selenium is the most popular and widely used tool. It can integrate with anything to give a robust framework for compilation, continuous integration, bug tracking, and reporting, to name a few.
HP ALM (formerly, HP Quality Center) is an HP offering, which is much more than a test management tool; used for managing user requirement documentation, test plan ,test execution and so on.
To get the best of the two worlds, we propose an integration framework, which reduces the overall cost of automation by using open source tools and brings the best of the capabilities for automation testing of a web application.
Integrating Selenium Webdriver with HP Application Lifecycle Management (ALM)
A web interface is the most common way of accessing ALM, but when accessing it from third-party tools, APIs are needed. Out of the different ways of communicating with ALM, this paper discusses HP ALM Open Test Architecture which offers a COM-based API to work with ALM through different programming languages, including Java. Open Test Architecture (OTA) APIs allow testers to customize their testing which cannot be done using web interface. OTA is an API which allows the integration of any third-party tools with ALM and also allows interaction with ALM without using the user interface. The entry point for this API is the "TDConnection" object which can access the ALM functionalities. The functions are accessible to any COM aware programming languages. Using this, we can fetch data from the ALM database such as the bug details or even update the status details in ALM from an external script. The below diagram shows the different ways of interacting with the ALM servers - using browser interface and third-party tools with OTA client.
Let's look into how the actual integration is done. The entire process is shown in the below diagram. In the local machine, we need to have the HP ALM Client, the selenium test scripts, which in turn use the script having the ALM integration logic. In the ALM server, we need to have a test lab, which has the test plan with the script to call the selenium script added in it. Now, whenever required, the selenium script can be directly triggered from ALM to get the status updated at the end of the test. The sections - before scripting, scripting phase, and triggering test from ALM - throw more light to the process.
The below files are required before we proceed with the scripting of the actual code for integration:
- Com4j.jar (The Open Test Architecture of ALM can be accessed through DLLs.OTAClient.dll is the one which is used with Java to connect to ALM server, which is created when ALM is accessed from a machine for the first time.Com4J is the jar file, which is used to generate java files from the dll)
- Hpqc.jar (The jar file created for the java class files generated by Com4j. This is required to setup the communication with the ALM components)
DLL registration is required to create an instance of the object and to tell COM, which DLL should be loaded for instance creation. This can be done using the regxvr32 command, which is a command line utility for registering and unregistering the DLLs.
HP Client installation
- From the ALM add-ins section in the HP Website download and install the ALM Client MSI Generator
- Provide the ALM server address and generate MSI (if required, you may change the output folder location)
- In the output folder, click on the installer and click on the installer to install the HP ALM Client
Ant is required to get your dependencies automatically at run time. It can be used to script builds to run from command line. It allows migration of software between different environments and the issues related to compilation, path setup and so on, which is cumbersome and time consuming. You may refer to the below manual for ant setup:
- ALM server URL, login credentials, project and domain details should be known before proceeding with the scripting
- Create a VAPI-XP test plan in ALM and add it in the test lab
- Create a java project in an IDE like eclipse and include the above mentioned jars in the build path
- Create a java script (ALM connectivity) for connecting, disconnecting and performing all other functions in ALM
- Create a test script to capture the actual application test scenarios and calls to the ALM connectivity script
Building the project:
Build the project using ant and generate build.xml file
Triggering test from ALM
There are different options of running a test. One such possibility is to run individual script / the entire build file using command line execution (using shell commands) in the Test Scripts section of Test Plan in ALM.
Why OTA CLIENT?
Out of the different ways of integrating Selenium with ALM, Rest API and OTA Client are the most popular and most widely used. The main advantage of using OTA Client is that it exposes more functionalities of ALM and also object-based nature of API is easier to work with. The Rest API, currently, provides only the CRUD operations for the core entities.
Key benefits of the integration
The key benefits of this integration are:
- With the integration of ALM and selenium in place, we expect a potential reduction in the cost compared to using QTP with ALM
- For open source functional automation tools such as Selenium, which can be used to generate the automation tests with the scripting language of our choice, there is good online support
- Traceability can be brought in place with ALM's built-in traceability feature
- Having an ant build in place and triggering the selenium scripts from ALM using Ant build helps us bring in automation of test execution in true sense
- With this setup, selenium scripts being run from ALM using Ant build, the dependability on the script developers for test execution is eliminated, thus ensuring that the scripts can be triggered by anyone, not necessarily the automation test engineers
Software test automation has always been considered critical in major software companies, but it is often considered to be too expensive. More often than not, the tools used in the testing lifecycle are chosen with lot of analysis, where, one of the key factors is the cost. Though UFT supports web UI automation, which is also supported by selenium, the demand for selenium in the market is more since UFT comes with a cost. Without doubt, ALM is one of the leading test management tools in the market. Thus most teams look for the integration of Selenium and ALM. Considering the support that HP is currently providing for the OTA and the functionalities that it supports, it is the best option for integrating selenium with ALM. In addition, in several teams, there is a huge dependency on automation test engineers to run the automation scripts, generate automation test reports, and so on. With this integration in place, the manual test engineers, who are well aware of and comfortable with test management tools such as ALM, can also trigger the automation tests. This reduces the dependency and effort of the automation test engineer, who can utilize the time saved in automating more test cases. By using ant build, any changes made to the script dependencies by different automation test engineers at different point in time are taken care of, without any changes needed in the ALM script call, thus enabling the testers to manage tests the automation way.