How to Create Custom Code Using Service Test

API Testing Published on:

Overview of Creating Service Test Custom Code:

In a previous post (How I cracked HP Service Test’s custom code functionality), I demonstrated the use of the custom code feature in Service Test 11. Due to the recent release of Service Test 11.10, however, this functionality has changed. It seems to be due to some enhancements HP has made in the ST core.

The Custom Code Change:

As a result, the Event Handler code that was used in ST 11.00 is not supported in version 11.10. So, if you have existing custom code in ST 11.00 scripts you’ll need to open them in ST 11.10 and save them. This will modify the code as required and automatically compile it to the correct syntax. If you’re creating new code in ST 11.10, the process of creating input and output variables is still the same; however, the syntax needed to assign a value to the input and output variables has changed.

For example:

Let’s say you wish to create an input variable named joeInput.

To assign a value to an input variable you would use:
Args.Input.joeInput = “Hello”;

But in Service Test 11.10, the proper syntax would be:
This.CodeActivity.Input.joeInput = “Hello”;

The same would apply to output variables as well.