Using SAP structured parameters in HP Unified Functional Testing 11.52

This post was written by Yan Yang (Ellie), from the HP UFT R&D team.

 

Introduction

HP Unified Functional Testing (UFT) is integrated with SAP Solution Manager, which means that you can use UFT to create tests and save them in Solution Manager. You maintain the test data, run the tests and store the run results in Solution Manager.

 

In SAP Solution Manager, the test data is stored in a Test Data Container (TDC), and is used as parameters to run the test. This data can be organized in a hierarchical structure, like the one shown in the following screenshot: 

p1.png

 

Versions of UFT (or QTP) prior to 11.52 supported only non-hierarchical parameters (such as string, number, date, etc). In order to use test data such as the one in the picture above in UFT, you had to create many separate parameters to represent each element in the structure. It was even more painful if the structure contained a variable-length array. Imagine how many parameters you’d need to create for a simple structure like the one above! Not to mention the additional work wasted on mapping each element to the parameter while running.

 

In UFT 11.52, the new support for structured parameters makes life much easier. You just define one parameter, and then you can access its elements in your script as if you were using an object.

 

Adding SAP structured parameters to a UFT test

To add the SAP parameters to a UFT test, the test must be opened in integration mode, which means you must open UFT from SAP GUI. Then you’ll find a new button “Maintain SAP Parameters” in the properties box.

p2.png

 

This button will cause SAP GUI to be shown, where you can select SAP structured parameters to add to the test. For example, suppose you want to use the parameter SALESORDER in the test data container (TDC) Z_SALESDATA - click the “Create Parameter with Template” button, circled in red in the following screenshot: 

p3.png

 

Enter Z_SALESDATA in the dialog that opens, and select the SALESORDER parameter.

 

After the parameter is added, you can change the default values that were inherited from the TDC.  You can also change it from an input parameter to an output parameter by changing “I” to “E” (import -> export), circled in red in the following screenshot.  Click the Save and Return buttons (circled in green) to save the change and go back to UFT:

p4.png

 

The parameter SALESORDER will appear in the test properties box. It belongs to SAP so it is read-only in UFT, where its value is stored as XML.

 

p5.png

 

The TDC can also contain parameters of simple types, which you can also add to UFT. In UFT, these parameters will have the type string.

 

Note: Although you click Save in SAP GUI, you must also save the change in UFT, to ensure that the SAP data and the respective data in UFT is consistent.

 

Using structured parameters in UFT tests

In order to use the structured parameter in a test, you need to create a parameter in an action, and map it to a structured parameter that you brought into the test from SAP.

 

The Input Parameter dialog has a new type, “Structure”:

 

p6.png

 

When you click OK, the new structured parameter will be added to the action. At the moment, it’s just an empty shell. You now need to map it to a structured parameter with a valid definition.

 

You can map the new action parameter to the top-level SALESORDER, or you can map it to a child structure within the SALESORDER structure. UFT shows a tree view which displays the structure’s hierarchy and enables you to select the appropriate element:

 p7.png

 

You can also create parameters with traditional types, and map them to single elements under SALESORDER.

 

Here are some examples, shown in the Action Call Properties dialog. The first parameter maps to the whole structure, the second one maps to an element inside the structure, and the third one maps to a child structure:

 p8.png

 

After the mapping is established, you can use the structured parameter in your test. You can access the structure element as you would access members of an object, with full auto-completion support: 

p9.png

Here's an example of how you can access different fields in the same structure:

p10.png

 

Running a test that contains structured parameters

When you initiate a run session from UFT, you can easily change runtime values in the Structure Editor:

p11.png

 

When executing from SAP GUI, you can use the existing test data or add new test data, as you would when running any SAP test: 

p12.png

 

More Information

For more details on how to use SAP Structured Parameters, open HP Unified Functional Testing’s Help and browse to UFT Add-ins Guide > Add-in for SAP Solutions > Windows-based SAP Support > UFT-SAP Solution Manager Integration > Tasks > How to Work with SAP Structured Parameters.

 

 

Leave us a comment in the box below to let us know how you’re testing your SAP functionality.

 

 

Thanks to Ellie for providing this article!

Comments
Yshai | ‎09-17-2013 12:32 AM

Nice article!

Majee(anon) | ‎02-20-2014 10:53 AM

Hi all

 

Mine is more of a request than a comment. First of all it is a good article.

 

My request is around SAP testing... We would like to use UFT for our regression suites and have minimum expertise on how to do it..Are there simplified slides or notes on how to do this?

 

Thanks

Leave a Comment

We encourage you to share your comments on this post. Comments are moderated and will be reviewed
and posted as promptly as possible during regular business hours

To ensure your comment is published, be sure to follow the Community Guidelines.

Be sure to enter a unique name. You can't reuse a name that's already in use.
Be sure to enter a unique email address. You can't reuse an email address that's already in use.
Type the characters you see in the picture above.Type the words you hear.
Search
About the Author
Malcolm is a functional architect, focusing on best practices and methodologies across the software development lifecycle.


Follow Us
The opinions expressed above are the personal opinions of the authors, not of HP. By using this site, you accept the Terms of Use and Rules of Participation