nikhil245 Contributor.
Contributor.

Re: TruClient error handling

Hi @Edo Nir  

I am facing a similar issue. When using a catch block, VUGen wont fail / close the open transaction even if the step(s) within the transaction have already failed. This transaction had started but never got a chance to reach TC.endTransaction.
 
Protocol - Tru client web
VUGen version - 12.6
Application - Salesforce Lightning 
Runtime setting - Simulate new user on each iteration is Disabled since we log in only once and not on each iteration.
 
The structure of the script is as below:
  • Init - Login to Salesforce. Close open tabs if any and landup on Dashboard page.
  • Action - Two blocks
    • 1. Mainflow - User navigates from Dashboard to other pages and completes the intended user journey. The end state should be user is back on Dashboard (similar to Init).
    • 2. Catch block to capture any error occured in the Mainflow and handle it.
      • The catch block includes logging out of the application and then logging back into the application; followed by closing any open tabs leftover in previous steps. The end state should be user is back on Dashboard (similar to Init).
  • End - Log out
Problem statement: Whenever the user encounters any error, the control moves to catch block. Now, the step that failed is part of a transaction which has already started but its TC.endTransaction is not yet reached. Problem is that this transaction is left open (it is not failed automatically unlike web http html, not sure why?). When the next iteration starts (post catch block) and we reach the same transaction start, it doesnt start the transaction saying the transaction is already started and then fails it when transaction ends citing the error that we got in previous iteration and few more errors which are unrelated to the actual failure. Note that this time the transaction had actually passed but the open transaction from previous iteration causes this mess. 
 
Workaround: I had to add a global variable at start of the script. Then, I have to change the value of the variable to the current transaction name everytime a new transaction is started. This way, if an error occurs and control moves to the catch block, the first thing I do is fail the open transaction. Earlier, the challenge was that I didnt know the transaction name as the error could occur anywhere in the script; but now with the global variable, I know the transaction name and I can fail the open transaction before moving ahead in the catch block.
 
I wanted to know if there is an easier way to get the current open transaction name in tru client web, without having to use this global variables. Thanks!
0 Likes
Trusted Contributor.. PascalCalovini Trusted Contributor..
Trusted Contributor..

Re: TruClient error handling

Hi @nikhil,
I have two solutions. The first as described is a handler which calls a handler-function() to clear up my staff. Works fine, but returns to the place where my script stepped into the errorsituation.
The second one is to add a Exit(Action) with status Fail which ends all running transactions.
Hope that helps
0 Likes
Highlighted
nikhil245 Contributor.
Contributor.

Re: TruClient error handling

Hi @PascalCalovini ,

I have tried using the exit function with Fail status, but unfortunately it doesnt fail the open transaction.

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.