Highlighted
Regular Contributor.. Regular Contributor..
Regular Contributor..
1752 views

TruClient exception handling

Jump to solution

TruClient 12.53 script to be executed by AppPulse

I have a situation where need a script to read the last updated time stamp from a web page and throw an error if that time stamp is more than 20 minutes old. I am using TruClient 12.53 and have a script that can read the time stamp, compare it to the current time and determine if it is too old. What I can't get it to do is make the transaction fail so I get an alert. I have tried using the LR.log and LR.endTransaction functions, but I can't get the script to fail. Do you have any suggestions? An example would be great.

Here is an exerpt from the mdrv.log after I run the script in VuGen.  You can see it logs an error, then says that the transaction ended with a Fail status and then says it has no error messages!:

t=00007744ms: Error -205177: Error: Outage map not updated within past 20 minutes Snapshot Info [MSH 1 0] [MsgId: MERR-205177]
Notify: Transaction "Map Refresh" ended with a "Fail" status (Duration: 0.7320 Think Time: 0.0130 Wasted Time: 0.2100).
Notify: Transaction "Map Refresh" has 0 error message(s).
t=00007988ms: ** 3.1: Evaluate JavaScript code LR.log("Error: Outage ma...fresh", "Fail"); ** successfully completed with end event 'Action completed' [MsgId: MMSG-205180]
t=00008028ms: ** 3: If (true) ** successfully completed with end event 'Action completed' [MsgId: MMSG-205180]

Thanks in advance!

Joe

0 Likes
1 Solution

Accepted Solutions
Highlighted
Acclaimed Contributor.
Acclaimed Contributor.

Re: TruClient exception handling

Jump to solution

Hi Joe,

I guess AppPulse needs the script to generate an error and not just exit when needed.

You can easily mimic that. Instead of the exit step add a Generic Object action step inside the if statement.

1. Change the object timeout to 1 or 2 seconds (to avoid long waiting time),

2. In the object section of the step, select an arbitrary ui element in some application. You can even manually navigate to a different application which is not the one being monitored by your script and select an object. Change the step action from Click on <some object> to Wait for <some object>. Do not add a respective navigate step. The idea is to intentionally cause this step to fail. Alternatively you can pick a UI element in your application, such that you didn't already interact with in other steps and then change its' object identification method to XPath. Change the XPath statement to something that does not exist

The idea is to cause this step to always fail. That will probably fail the script in the way AppPulse expect it to fail 🙂

Shlomi

 

View solution in original post

7 Replies
Highlighted
Acclaimed Contributor.
Acclaimed Contributor.

Re: TruClient exception handling

Jump to solution

Hi Joe,

Here is the general flow you should follow

1. Extract the value from the application and validate the value (to extract the value you can use Get Property action in Generic Object Action step)

2. Use Evaluate JavaScript step to initialize a boolean variable that indicates whether or not the value meets your criteria

3. Add If statement from the Toolbox > Flow Control and use the boolean variable as the condition (let's assume that true value indicates you should stop the script run

4. Drop Exit step from the toolbox and place it inside the If statement. Play with the Exit step arguments to exit the script run the way that fits your need best

Good Luck,

Shlomi

0 Likes
Highlighted
Regular Contributor.. Regular Contributor..
Regular Contributor..

Re: TruClient exception handling

Jump to solution

Shlomi,

Thank you for the  response.  The exit step is what I was missing.  The script now ends in an error status when I execute it in VuGen.  Unfortunately, AppPulse still shows it running successfully.  I expected it to give an availability error.  Any experience with running TruClient scripts in AppPulse?

Thanks,

Joe

0 Likes
Highlighted
Acclaimed Contributor.
Acclaimed Contributor.

Re: TruClient exception handling

Jump to solution

Hi Joe,

I guess AppPulse needs the script to generate an error and not just exit when needed.

You can easily mimic that. Instead of the exit step add a Generic Object action step inside the if statement.

1. Change the object timeout to 1 or 2 seconds (to avoid long waiting time),

2. In the object section of the step, select an arbitrary ui element in some application. You can even manually navigate to a different application which is not the one being monitored by your script and select an object. Change the step action from Click on <some object> to Wait for <some object>. Do not add a respective navigate step. The idea is to intentionally cause this step to fail. Alternatively you can pick a UI element in your application, such that you didn't already interact with in other steps and then change its' object identification method to XPath. Change the XPath statement to something that does not exist

The idea is to cause this step to always fail. That will probably fail the script in the way AppPulse expect it to fail 🙂

Shlomi

 

View solution in original post

Highlighted
Regular Contributor.. Regular Contributor..
Regular Contributor..

Re: TruClient exception handling

Jump to solution

Shlomi,

Your recommendation worked great in VuGen, but AppPulse still will not fail.  I opened a ticket with the Saas support group (AppPulse) and they were less than helpful.  They basically wanted to sell me a scripting service.  Here's the response I got:

"I spoke to our scripting team and they explained that this will not necessary cause the script to fail. I see you do not have Scripting services with us so I want to take this chance to encourage you to consider a new addition to your account. They can help you to go over more details about this request and provide a high level experience service when dealing with coding related challenges. I am adding XXX, your CSM, to this conversation so you can get more details if you want to consider this offer."

Sounds like they know the answer, but.... I'll have to pay extra for it!  Thank you for taking the time to send me a suggestion.

Joe

 

0 Likes
Highlighted
Acclaimed Contributor.
Acclaimed Contributor.

Re: TruClient exception handling

Jump to solution

Hi Joe,

Thanks for the update.

Let me follow-up internally. I will get back to you as soon as I have more information.

Regards,

Shlomi

0 Likes
Highlighted
Acclaimed Contributor.
Acclaimed Contributor.

Re: TruClient exception handling

Jump to solution

Hi Joe,

Sorry for the late reply.

Apparently AppPulse requires a transaction to fail in order to fail the Vuser.

Can you wrap the section that you cause to fail with transaction and check it?

Regards,

Shlomi

0 Likes
Highlighted
New Member.

Re: TruClient exception handling

Jump to solution

Joe, 

I'm AppPulse Active dev architect, I noticed that Shlomi provided you assistance, and help you to solve this scripting problem, I encoradge you to use our forums to get any help for AppPulse Active or any other scripting issues you may face.

please let me know if this still a problem, in case you need further help  please email me personally (if possibe with customer name and ticket id) and I will make sure you will get the needed help. My eMail is: noam.hasin@hpe.com

 

Best Regards,

 

Noam
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.