Test Workbench Community
  • Home
  • Blogs
  • FORUM
  • About
  • Contact
  • Resources

Running API tests in a compound test with test variables

10/14/2018

1 Comment

 
Picture
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.
Picture
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.
Picture
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.​
Picture
Picture
After adding the tags, they'll appear in the test's tag store as shown in the following screenshot.
​
Picture
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.
​
Picture
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.

Picture
2. Choose this option or modify HCL OneTest Performance installation by using Installation Manager to include HCL OneTest™ Performance Extension for HCL OneTest™ API.
Picture
3. Open HCL OneTest Performance and configure the HCL OneTest-API launcher in Preferences. Use Window > Preferences > Test > HOT-API Integration. ​
Picture
4. Import the API Test assets using the import wizard using File > New > HCL OneTest API > Connect to an HCL OneTest API project.​
Picture
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.

Picture
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.   ​
Picture
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.
Picture
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.​
Picture
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.​
Picture
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.
Picture
As you can see, our API tests used 10 and 5 for Value1 and Value2 in all the tests.

​Conclusion
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 
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.

1 Comment
Don Weber
4/1/2020 07:11:58 am

If you are doing this in a linux environment, make sure you set the system level environment variables at /etc/environment. The file is owned by root and must be edited by root.

https://askubuntu.com/questions/866161/setting-path-variable-in-etc-environment-vs-profile

Reply



Leave a Reply.

    Archives

    March 2020
    September 2019
    August 2019
    June 2019
    April 2019
    October 2018
    September 2018
    August 2018
    July 2018
    May 2018
    April 2018
    March 2018
    February 2018
    January 2018
    December 2017
    November 2017
    October 2017
    September 2017
    August 2017
    July 2017

    Categories

    All
    API Testing
    Embedded Testing
    Functional Testing
    Performance Testing

    RSS Feed

Proudly powered by Weebly
  • Home
  • Blogs
  • FORUM
  • About
  • Contact
  • Resources