Go back to all articles

API Micro Focus ALM and Performance Center: Basics for Performance Testing Engineers

Feb 15, 2022
7 min read

In this post, we are sharing our experience of using API Micro Focus ALM in the hope that load testing engineers who use LoadRunner or Performance Center will find it interesting. Working with API is useful for test automation, and/or to prepare for test launch with Jenkins or similar tools. We collected this list of examples and useful functions based on our experience, but you might also find good tips on Micro Focus’s own webpage.

Reading further, you will find a description of the main actions needed when creating an automation tool using the API service Application Lifecycle Management (ALM), which is used primarily to manage LoadRunner projects. The version we used when writing this post was ALM 12.60.

Test Automation

What is test automation?

Automated testing is a method in software testing that leverages automation tools to control the execution of tests instead of a human tester. It then compares actual test results with predicted or expected results. Automated testing offers greater efficiency and faster time-to-market for your projects. In PFLB, we often automate tests using HP ALM or Performance Center to save our clients’ time and money.

Where to use automated tests?

Automated tests are widely used in regression testing, during development, in DevOps, and even in production environments. To further enhance your testing capabilities, consider using an API load test tool that allows you to test Postman and Insomnia request collections for optimal scalability. With mobile test automation, you can quickly scale your tests and boost coverage to accelerate delivery. Of course, no software can operate without an experienced testing engineer, otherwise we wouldn’t have 400+ of them on staff, but automated tests save time for these highly valuable specialists, letting them focus on challenging tasks instead of manually running the tests.

What is HP ALM?

HP ALM (Application lifecycle management) is a web-based tool that helps organizations to manage the application lifecycle right from project planning, requirements gathering, until testing and deployment, which otherwise is a time-consuming task. It enables all the stakeholders, namely, project managers, developers, testers, product owners, and business analysts, to interact and coordinate to achieve the project goals.

You will find some basics of how to use the API service Application Lifecycle Management (ALM) in the next part of the article. We do hope it will help you automate testing for your project.

Pages

Address

The full address is formed according to the following formula:

Url + /API_TYPE/rest/domains/ + Domain + /projects/ + Project + …

An example:

http://almhost1260.com/qcbin/rest/domains/
DOMAIN/projects/PROJECT/runs

Most of the pages can be viewed in both API ALM and API Performance Center (hence, both are mentioned above as API_TYPE).

/qcbin/ – API ALM

Main pages:

  • runs
  • tests
  • test-instances
  • test-folders
  • defects

/LoadTest/ – API Performance Center

Main pages:

  • runs
  • tests
  • testInstances

Except for the syntax in the names of the pages, most of the actions in these two APIs are the same.

Main Pages

/runs

Contains data on test runs.

http://almhost1260.com/loadtest/rest/domains/
DOMAIN/projects/PROJECT/runs
http://almhost1260.com/qcbin/rest/domains/
DOMAIN/projects/PROJECT/runs

You can request data about a specific test run:

…/runs?query={…} – filtering by query

…/runs/11111 – data on the test run with ID 11111

Actions with a specific running test:

…/runs/11111/Extended – extended data on the run

…/runs/11111/stopNow – stop the running test

If /runs/ contains many tests, a request without a date may return only a partial list.

/tests

Contains scripts for the Project.

http://almhost1260.com/loadtest/rest/domains/
DOMAIN/projects/PROJECT/tests
http://almhost1260.com/qcbin/rest/domains/
DOMAIN/projects/PROJECT/tests

An example of a request:

…/tests/11111 – data for a script with ID 11111

/test-instances

Contains test instances needed for launch.

http://almhost1260.com/qcbin/rest/domains/
DOMAIN/projects/PROJECT/test-instances
http://almhost1260.com/loadtest/rest/domains/
DOMAIN/projects/PROJECT/testInstances

An example of a request:

…/test-instances/11111 – data for an instance with ID 11111

Read further to find out how to authorize, which parameters to use, and what operations to apply in ALM.

Authorization in ALM

Sends a GET-request to an address:

http://almpc1260.delta.sbrf.com/qcbin/api/
authentication/sign-in

With headers:

  • Content-Type: application/json
  • Authorization: Basic [authorization code]

An example of setting headers in Java:

HttpHeaders httpHeaders = new HttpHeaders();
httpHeaders.setAccept(Arrays.asList(new MediaType[]{MediaType.APPLICATION_JSON}));
httpHeaders.setContentType
(MediaType.APPLICATION_JSON);
httpHeaders.set("Authorization","Basic [authorization code]");

Cookies are selected from the response:

  • LWSSO_COOKIE_KEY – for authorization
  • QCSession – to keep the session alive
  • ALM_USER
  • XSRF_TOKEN – to keep the session alive

Those cookies are attached to further requests to ALM in the Cookie header.

An example of an attached Cookie in Java:

httpHeaders.set("Cookie", almdto.getLWSSO_COOKIE_KEY());
httpHeaders.add("Cookie",
almdto.getQCSession());
httpHeaders.add("Cookie",
almdto.getALM_USER());
httpHeaders.add("Cookie",
almdto.getXSRF_TOKEN());
Looking for Performance and Load Testing Provider?
Drop us a line. Most likely, we have already dealt with problems like yours in the previous 300 projects.

Parameters

alt

Method:

  • GET
  • HEAD

It includes the response format. Such a request is equal to using the header Accept.

Examples:

?alt=application/xml

?alt=application/json

fields

Method:

  • GET for lists.

It brings back particular fields of elements from the list instead of all the fields. You can’t use it for singular elements.

Fields are divided with a comma. Fullstop shows which element of the page is the field related to.

Examples:

…/tests?fields=id – ID field for all the scripts

…/tests?fields=id,name – ID and name fields for all the scripts

…/tests?fields=id,test-folder.id – ID and test-folder.id fields for all the scripts

…/tests?fields=id,t-fldr.id,t-fldr.name – ID, t-fldr.id and t-fldr.name fields for all the scripts

order-by

Method:

  • GET
  • POST

Sorts results by a determined parameter. Fields and ascending/descending sorting can be included in the parameter.

Fields are put in squiggle brackets and divided by semicolon. Type of sorting is put in square brackets after the field name. Default sorting type is ascending.

  • [ASC] – ascending
  • [DESC] – descending

Syntax:

order-by={field1[ASC];field2[DESC]}

Examples:

…/tests?order-by={id[ASC]} – sort by ID, ascending. 

…/tests?order-by={status[DESC];name[ASC]} – sort by status, descending, and name, ascending.

…/tests?order-by={status;name[ASC]} – sort by status, ascending, and by name, ascending.

Used with fields:

…/tests?fields=id,name,test-folder.id,test-folder.name&order-by={test-folder.name[ASC]}

If order-by parameter is not used, default sorting is by ID of the element.

page-size

Method:

  • GET
  • POST

Used to limit the size of the response or the number of elements used.

Possible values:

  • number of elements on the page
  • max – maximum size possible (2,000 elements by default)

Examples:

…/tests?page-size=10 – retrieves the first 10 scripts

…/tests?page-size=max – retrieves 2,000 elements max.

query

Method:

  • GET
  • POST

After a question mark, you can use parameter query={…}. Put the field names in squiggle brackets to mention the fields that will be used for filtration.

Formatting for page fields:

field[comparison“value”]

Comparison operators: >, <, >=, <=, =, <>

Logical operators: and, or, not

Semicolon is used for separation, equal to logical operator AND. Other logical operators between the fields are not supported. 

Examples:

user-template[<5]

execution-date[>=’2021-09-29′]

Absence of a special sign means an equal mark:

user-template-12[“Max”]

Several parameters in one request are separated by a semicolon:

query={user-template-08[GOSUSLUGI_DCP_EXT];user-template-12[“Max”]}

Example:

http://almpc1260.delta.sbrf.com/qcbin/rest/
domains/LT_EFS/projects/GOS_LT_EFS/runs?query={execution-date[>='2021-10-01']}

Example of a query request in Java:

String parametr = "{test-id["" + testId + ""]}";
ResponseEntity<String> response = restTemplate.exchange(urlALM + "/testInstances?query=
{parametr}",
HttpMethod.GET,
entity,
String.class, parametr);

Read further to find out what operations can be used in ALM.

Not Experienced in Load Testing?
Leave it to us. We will set it all up once and for all.
Get a quote Drop us a line to find out what our team can do for you.

Operations with Elements

Overview

Method:

  • POST
  • GET

To view a full list of elements, send POST or GET request with an empty body to the page address. 

Example:

http://almpc1260.delta.sbrf.com/qcbin/rest/
domains/LT_EFS/projects/GOS_LT_EFS/tests

– overview of the list of scripts.

To view data on a particular element from the list, add the element ID after the page name.

Example:

http://almpc1260.delta.sbrf.com/qcbin/rest/
domains/LT_EFS/projects/GOS_LT_EFS/tests/11111

– overview of script with ID 11111.

For more particular requests, go back to section Parameters above.

Create an element

Method:

  • POST

Content (a script, a defect, etc.) in ALM can be created by using POST method to send the code of the element to an xml or json page.

Example:

http://almhost1260.com/loadtest/rest/
domains/DOMAIN/projects/PROJECT/defects

Request body:

<Entity Type=”defect”>
<Fields>
<Field Name=”detected-by”>
<Value>username</Value>
</Field>
<Field Name=”creation-time”>
<Value>2010-03-02</Value>
</Field>
<Field Name=”severity”>
<Value>2-Medium</Value>
</Field>
<Field Name=”name”>
<Value>Some Description</Value>
</Field>
</Fields>
</Entity>

<Entity Type=”defect”>

You can create several elements at a time this way. It is necessary to include one of the headers to do so:

  • content-type=”application/xml;type=collection”
  • content-type=”application/json;type=collection”

Delete

Method:

  • DELETE

To delete an element, send a request using DELETE method to the element’s address. The adress will be the same as for viewing, but for the method change. 

Example:

http://almpc1260.delta.sbrf.com/qcbin/rest/
domains/LT_EFS/
projects/GOS_LT_EFS/tests/11111

– delete the script with ID 11111

Parameter used: ids-to-delete

This parameter allows to delete several elements at a time. To do so, use DELETE method to address the whole list, and then mention IDs of elements you want to delete, separated by a comma. 

Example:

http://almpc1260.delta.sbrf.com/qcbin/rest/
domains/LT_EFS/projects/GOS_LT_EFS/tests?ids-to-delete=11111,22222,33333

– delete scripts with IDs 11111, 22222 and 33333.

Parameter used: force-delete-children

This parameter is used to delete child directories when deleting a directory from test-folders.

Possible values:

  • y – yes
  • n – no

If the parameter force-delete-children is not used, child directories are not deleted by default. 

Example:

…/test-folders/11111?force-delete-children=y – to delete child directories, where 11111 is an ID of a directory.

Change

Method:

  • PUT

You can change an element by using method PUT to send new values for the fields changed in xml or json. 

Example:

http://almhost1260.com/loadtest/rest/domains/
DOMAIN/projects/PROJECT/defects/11111

– change description of the defect with ID 11111.

Request body:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<Entity Type="defect">
<Fields>
<Field  Name="description">
<Value>This is new description</Value>
</Field>
</Fields>
</Entity>

You can use the same way to change several elements at a time. To do so, put the element ID in the xml instead of the address. Include one of the headers, too:

  • content-type=”application/xml;type=collection”
  • content-type=”application/json;type=collection”
Have a Project in Mind?​
We have been working on performance testing projects since 2008.
Drop us a line to find out what our team can do for you.
Get a quote You’ll hear back from our tech account manager in one day if not sooner

Conclusions

Automating performance testing services saves either the time of your staff members, or of the contractor who is running the tests. Thus, in both cases, it saves customer’s money. Although there are many tools for test automation, performance testing does not yield effective results without the eye of an experienced engineer. Make sure you have one on your team, or let us know if we can help! Our expertise with 300+ projects and 400+ staff engineers lets us share our knowledge to make your application the best version of itself.

Table of contents

Related insights in blog articles

Explore what we’ve learned from these experiences
14 min read

TOP 10 Best Online Load Testing Tools for 2024

best online load testing tools preview
Nov 7, 2024

In this article, we will go through our favourite features of each of these cloud-based load testing tools, while in the end you will find a parameterized comparison of all of them in one table.

10 min read

Essential Guide to ITSM Change Management: Processes, Benefits, and Tips

Essential Guide to ITSM Change Management
Oct 15, 2024

ITSM change management is essential for managing and implementing IT changes smoothly. It focuses on minimizing risks and aligning changes with business goals. In this guide, we’ll explore what ITSM change management entails, discuss its benefits, and provide practical tips for implementation. Key Takeaways What is ITSM Change Management? ITSM change management is a key […]

7 min read

SRE Roles and Responsibilities: Key Insights Every Engineer Should Know

sre roles and responsibilities preview
Sep 11, 2024

Site Reliability Engineers (SREs) are crucial for maintaining the reliability and efficiency of software systems. They work at the intersection of development and operations to solve performance issues and ensure system scalability. This article will detail the SRE roles and responsibilities, offering vital insights into their duties and required skills. Key Takeaways Understanding Site Reliability […]

11 min read

Understanding Error Budgets: What Is Error Budget and How to Use It

understanding error budgets what is error budget and how to use it preview
Sep 10, 2024

An error budget defines the allowable downtime or errors for a system within a specific period, balancing innovation and reliability. In this article, you’ll learn what is error budget, how it’s calculated, and why it’s essential for maintaining system performance and user satisfaction. Key Takeaways Understanding Error Budgets: What Is Error Budget and How to […]

  • Be the first one to know

    We’ll send you a monthly e-mail with all the useful insights that we will have found and analyzed