Highlighted
Absent Member.
Absent Member.
320 views

TruClient 12.02: transactionDuration returns negative value

Hi,

 

I am using TruClient 12.02.

I am having a problem with TC.transactionDuration().

 

What I do is this:

 

in "evaluate Javascript":

 

  var overallTransaction = "BUC02_Main";

  TC.setParam("pOverallTransaction", overallTransaction); // store transaction name in paramter pOverallTransaction

  TC.startTransaction(overallTransaction);

 

then some other steps... (takes a few seconds)

 

then I do this in an "evaluate Javascript":

window.alert("pOverallTransaction: " + TC.getParam("pOverallTransaction") + "\n" + "transactionDuration: " +TC.transactionDuration(TC.getParam("pOverallTransaction")) );

 

This returns an alert window with this info:

 

pOverallTransaction: BUC02_Main
transactionDuration: -16972

 

I would expect a (small) positive value for the transactionDuration and not a negative value.

 

 

Interestingly enough... when I save, close and reopen Vugen and run the script again, the result of the TC.transactionDuration() is now a positive number (like: 19.342)

 

When I run the script again, it returns that negative value. Mind you, i didn't finish the script (meaning: I did not run TC.endTransaction())

 

Any idea what is going on?

 

 

Raymond

0 Likes
2 Replies
Highlighted
Absent Member.
Absent Member.

Re: TruClient 12.02: transactionDuration returns negative value

I have a (nasty?) workaround...

 

 

var overallTransaction = "BUC02_Main";

  TC.setParam("pOverallTransaction", overallTransaction); // store transaction name in paramter pOverallTransaction

 

try
{
    TC.endTransaction(overallTransaction, "Fail"); // Fail? Pass? Auto?? No opinion yet...
}
catch(err)
{
    TC.log("endTransaction", "Status");  // have to do something...
}

TC.startTransaction(overallTransaction);

 

 

I added the red code. (it basically tries to end the transaction) This seems to work.

Still, I'd like to know why the transactionDuration() resulted in a negative value...

 

0 Likes
Highlighted
Acclaimed Contributor.
Acclaimed Contributor.

Re: TruClient 12.02: transactionDuration returns negative value

Strange....

 

I have tried to reproduce locally but it worked like a charm. I got negative duration only when I tried to query the duration after ending the 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.