Wednesday, February 25, 2015

Enabling scripted rules

Because of heavy business schedule I wasn't able to submit new posts. Meanwhile I was mostly working on UFT and HP's Service Virtualization (SV). After the business hours it would be better for me to write some posts before forgetting what I learned. I am going to describe how to enable scripted rules in SV.

For some of the web services that needed to be virtualised, sometimes default rules and default functions may not be enough to implement desired output. For this reason there are scripted rules that you can do by programmatically for those you weren't able to implement by default functions. First you have to enable scripted rules funcionality from the SV Designer.

Open the SV Designer and click Tools->Options. Then select the Labs section and click the "Enable Scripted rule" checkbox that is in the Scripting section. By doing this you can write Javascript (and C#) codes in your rules.

HP tells that this feature is in experimental phase, but according to my experience it works pretty smooth. In version 3.61 we were able to write javascript codes but that was insufficient in some cases. But with the version 3.62 now we are able to write C# code and it is very powerful and stable.

When you enable the scripted rule feature you can create a scripted rule for a data model (as below screenshot). You can either create a javascript rule and C# rule (or both if you want).

Next, I am going to describe adding .Net referance to your C# rule.

No comments: