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

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

     

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