Reputation: 1
I want to define dynamic transaction name with a variable in it like for(var i=0;i<=5;i++)
LR.startTransaction("Application_TransactionLoopcount_"+myloopcount); Truclient step1 Truclient step2
LR.endTransaction("Application_TransactionLoopcount_"+myloopcount, "Auto");
Expecting transaction like: Application_TransactionLoopcount_1
But always throwing an syntax expection Pls advice
Upvotes: 0
Views: 670
Reputation: 28
Your code should work but it's going to be hard give an exact answer without the exception you see.
For example: Dynamic Transaction Names in TruClient
These are the results: Vugen Output log
Your code does not have "myloopcount" defined. I get an error if the variable in the transaction statement is undefined:
Exception Reference is not defined
Upvotes: 0
Reputation: 1
You should be able to do so using TC.startTransaction and TC.endTransaction.
Make sure the steps are wrapped in TC ForLoop step and you use the index variable name in your JavaScript steps.
TC.startTransaction("Transaction_LoopCount" + i);
TC.endTransaction("Transaction_LoopCount" + i, "Auto");
In case you still have an exception, it would be worth to paste the exception here as reference.
Upvotes: 0