Overview:
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 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.

{ 4 comments… read them below or add one }
Hello Joe,
Loved your code…
Is there any way to put auto generated date field for eg,
I want the code to retrieve current system date and then add 20 days for check in date.
I just want to know how to add this kinda code.
Thanks,
Irfan
Irfan » Thanks Irfan! I just wrote a blog post on how to do this How To Automatically Increment a Date. Let me know if you still have any questions. Cheers~Joe
The information provided is very useful.
I have a question. Can we set the value (NIL or Not NIL) of any input parameter of a web service request using the custom code?
Thanks and Regards,
Sushil
How I cracked HP Service Test’s custom code functionality — Joe Colantonio — Test Automation Geek | Bibliomaniac | Software Imagineer » Hi Asheena – Sorry I need to update this post to mention that HP changed the syntax for calling input and output parameters. Check out my post UPDATE: Service Test 11.10: How to Create Custom Code using Service Test 11.10 for more info. Basically you need to change the syntax from
myCounter = args.Input.inCounter;
To:
This.CodeActivity.Input.inCounter;
Let me know if you need more info. Cheers~Joe
{ 1 trackback }