UPDATE: Service Test 11.10: How to Create Custom Code using Service Test 11.10

Automation Guild Online Conference Top ad

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.

10 comments
How I cracked HP Service Test’s custom code functionality — Joe Colantonio -- Test Automation Geek | Bibliomaniac | Software Imagineer - August 23, 2011

[…] Joe Colantonio TweetUPDATE: HP has changed the syntax for input and output variables. Check out UPDATE: Service Test 11.10: How to Create Custom Code using Service Test 11.10 for more […]

Reply
    Joe Colantonio - August 23, 2011

    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

    Reply
Irfan - April 2, 2012

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

Reply
Sushil - August 23, 2012

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

Reply
vidya - December 1, 2013

Hi’

Can u please explain me the steps to create a reusable custom code in HP Service test.

I have already tried the steps what u have given u in ur book but it throws error at open Visual Studio Step. Error is Could not able to find denve.exe file”.

Thanks in advance

Reply
    Joe Colantonio - December 5, 2013

    Hmm – not sure usually that error is a .NET framework issue. What version of .NET is installed on your machine? Do you have visual studio installed

    Reply
Nick - August 15, 2014

Hi Joe,

Do you have any updates on this for UFT 11.5+? It looks like it’s slightly different now. I never used Service Test previously.

When I drag over the Custom Code tool to my test area and setup the Input Property it will not let me link to the Read from File. It does not show as an available step.

Any ideas?

Thanks!

Reply
Nick - August 15, 2014

Hi Joe,

Do you have any updates on this for UFT 11.5+? It looks like it’s slightly different now. I never used Service Test previously.

When I drag over the Custom Code tool to my test area and setup the Input Property it will not let me link to the Read from File. It does not show as an available step.

I think I can just link it to a test input param but not sure if that will work either.

Any ideas?

Thanks!

Reply
    Joe Colantonio - August 21, 2014

    I tried to repo — I created a new api test, added Read From File on the main canvas, added a Custom Code activity under it on the main canvas. I clicked on the Custom Code properties and added a Input property.I click on the Input value’s Link to data source. In the Select Link Source for ‘Input’ I’m able to select the Read from File’s Content property. Am I doing anything different then you? I am using UFT 12.01 Build 1112 which is the latest and greatest version

    Reply
Click here to add a comment

Leave a comment: