Transactions

Any sequence of interactions or page clicks can be grouped as a transaction. Transactions are mechanisms to measure server response time for any operation. In simple words, the use of the word “Transaction” helps to measure the time taken by the system for a particular request.

Need of Transaction

Transactions in Script are needed due to the following reasons:

Start Transaction

In script, Transactions API(ns_start_transaction) can be used anywhere in the flow files. Start transaction is normally added before ns_web_url API.

Alternatively, start a transaction before the main URL.

Example:

voidflow()
{
// Using transaction for home page
ns_start_transaction("HomePage");
ns_web_url ("Homepage", "URL=http://127.0.0.1/tours/index.html");
ns_end_transaction ("HomePage", NS_AUTO_STATUS);
}
  1. Enter the transaction name and click Advanced
  2. In Advanced, you have the following options of whether you want: