Highlighted
Absent Member.. Absent Member..
Absent Member..
2554 views

Exiting a script using TruClient

Hello,

 

A simple one. When my transaction fails in TruClient, I'd like to exit that iteration by using Javascript.

 

According to the help documentation, the syntax is function lr.exit ( continuation_option, exit_status ). This doesn't work.

 

What is the syntax to exit an iteration using Javascript?

 

Thanks

0 Likes
6 Replies
Highlighted
Absent Member.
Absent Member.

Re: Exiting a script using TruClient

Hi,

You are not reading TruClient documentation. The function reference you mentioned is not related to TruClient protocol.

To obtain the desired functionality in TruClient just drag the Exit step from the toolbox and configure it to "iteration" or "action" and to status "fail" or "pass"

Guy Rosenthal
Network Virtualization PM
Highlighted
Absent Member.. Absent Member..
Absent Member..

Re: Exiting a script using TruClient

Thanks for responding Guy. So it's not possible using Javascript? 

0 Likes
Highlighted
Absent Member.
Absent Member.

Re: Exiting a script using TruClient

Not possible. Only thru the Exit step as I mentioned.

Guy Rosenthal
Network Virtualization PM
0 Likes
Highlighted
Absent Member.
Absent Member.

Re: Evaluate java script is failing on Paremetrisation

Hi,

 

 

I have written a code in evaluate javascript for my drop down list

 

window.division=TC.getParam("pDivision")

 

this code is failing on replay , showing error as API_UNEXPECTED _ERROR parameter not defined. Any help is much appreciated. Thanks in advance.

 

Madhu

0 Likes
Highlighted
Absent Member.. Absent Member..
Absent Member..

Re: Exiting a script using TruClient

Actually, you kinda CAN do it through a combination of Javascript and an IF block.

 

Create a variable in your Javascript to output your result.

Next step, add an IF block and drag the exit to the if block. Your conditional for the if block will be based on your variable.

 

example:

 

I have a Javascript that looks within the Document for a specific folder ID and assignes "true" or "false" to variable "Found" depending on if it finds it.

 

In the IF block I set    If (Found=="true")

 

then put the action I want if it's true

add an "else"

drag the Exit into the Else.

 

That's the easiest way to do it.  I created a string variable instead of boolean as I could never get the IF block to work with a boolean.

 

I have tried other ways but found the IF block only accepts one arguement for the IF statement.

0 Likes
Highlighted
New Member.

Re: Exiting a script using TruClient

Please elaborate the difference between vuser  exit with fail status and vuser exit as pass status

0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.