It is sometimes useful for a tester to have different types of tests run sequentially. For example, a tester might want to delete certain items from the application database with an API invocation before running a performance or functional test. A compound test in HCL OneTest is meant for such requirements. In such cases, it is required to pass in information to the API test from the compound test level. This blog shows how to run a compound test containing API tests from HCL OneTest Performance. This blog also provides the steps to pass variables defined in HCL OneTest Performance as arguments to the API tests.
The steps for running a compound test with variables mapped to test variables apply to HCL OneTest UI as well.
The HCL OneTest API Project
Before running a compound test that consists of API tests, we must have something to run. We created a project based on the calculator WSDL example that's shipped with Quality Server. This example has five services: Add, Divide, Modulus, Multiply, and Subtract.
For HCL OneTest Performance to pass arguments to these tests, the arguments for the test must be assigned by tags. This is done easily by tagging the two arguments. Once tagged, we'll see the tag store for the test that contains a Value1 and Value2 entry.
Here are the arguments used by AddTest. The other four tests will be tagged in the same way.
In addition, once tagged, we need to modify the tags. So, select "Expose as input" and clear "Confine scope to this test". Initialize the tags with a default value as well.
After adding the tags, they'll appear in the test's tag store as shown in the following screenshot.
An extra logging step was added to log the input arguments and result of the operation to a text file by configuring the logging action to use a file: C:\temp\compound\result.txt.
Configuring HCL OneTest Performance
Now that everything is configured on HCL OneTest API, let's move to HCL OneTest Performance. Some basic configuration steps are as follows:
1. Configure the environment variable, INTEGRATION_TESTER_AGENT_HOME.
2. Choose this option or modify HCL OneTest Performance installation by using Installation Manager to include HCL OneTest™ Performance Extension for HCL OneTest™ API.
3. Open HCL OneTest Performance and configure the HCL OneTest-API launcher in Preferences. Use Window > Preferences > Test > HOT-API Integration.
4. Import the API Test assets using the import wizard using File > New > HCL OneTest API > Connect to an HCL OneTest API project.
Creating a compound test using API tests
Give the Compound Test a name such as “Calculator” and add the 5 API calculator tests to it.
Let's do an initial run to see the results before we pass arguments from HCL OneTest Performance. So, run the compound test and then look at the C:\temp\compound\result.txt file.
So, this worked, and it used the default Value1 and Value2 tag values configured in HCL OneTest API for each of the tests.
Editing the compound test to pass arguments to the API tests
Let's say we want to override the default values for the API tests and pass different values. How do we do that?
At the root of the compound test, add two variables. We can call them Argument1 and Argument2. They do not have to be the same name as the tags used in HCL OneTest API. Give them the values of 10 and 5.
Now click each test so that we can map these variables to the arguments for the HCL OneTest API tests. Initially, a dialog box will appear as follows and show that the tag names are unmapped to the compound test's variables.
The steps to map the tag names are as follows:
1. Click the Tag Name, and then the button next to (select a variable).
2. In the Variable Selection dialog box, select Argument1, and then click OK.
3. Perform the same steps for Value2 but select Argument2.
4. Map Argument1 to Value1 and Argument2 to Value2 to the remaining tests.
Validating the tests
Delete the C:\temp\compound\result.txt file so that we won't mistake the past results for the current results.
Run the compound test again.
When complete, look at the C:\temp\compound\result.txt file.
As you can see, our API tests used 10 and 5 for Value1 and Value2 in all the tests.
Through this blog, we learned how to leverage compound tests to run API tests within HCL OneTest Performance and how to share information between different test types. We hope this blog helps you unleash even more power and versatility out of HCL OneTest suite of products for your specialized test automation needs.
Paul Liskay joined the Rational team in 2009. Currently, he is a Level 2 support engineer for the Rational Testing Tools for the US geography, focusing on Rational Performance Tester, Rational Integration Tester, and Rational Test Workbench Web UI.
Arun N. Kutty
Arun N. Kutty is a full-stack software developer. He currently works as a Level 3 Support Engineer for Performance Tester and Test Workbench products. Before this role, he has worked as a software engineer, functional area manager, and was a technical lead for teams developing software in the telecom domain.