Business transactions to record for this exercise. For sample script, please refer Scripts.
Steps to record | Transaction Name |
---|---|
Launch https://blazedemo.com | T00_Launch |
Select desired locations, click on Find Flights |
T10_FindFlights |
Select any Choose this Flight |
T20_ChooseThisFlight |
Fill the form and then click on Purchase Flight |
T30_BookFlight |
00. Create above mentioned transactions while recording.
Click here to view the hint/answer
In the Recording toolbar, click on `Insert Start Transaction` before the page navigation or clicks, once the page is loaded completed, click `Insert `End Transaction`.
10. How to add transactions in Action?
Click here to view the hint/answer
Select the steps in the desired action, right click > `Surround with Transaction`.
20. How to intentionally fail a transaction?
Click here to view the hint/answer
In `lr_end_transaction`, add `LR_FAIL` argument as shown below.
lr_start_transaction("T00_Launch");
web_url("blazedemo.com",
"URL=https://blazedemo.com/",
"Resource=0",
"RecContentType=text/html",
"Referer=",
"Snapshot=t1.inf",
"Mode=HTML",
EXTRARES,
"Url=/favicon.ico", ENDITEM,
LAST);
lr_end_transaction("T00_Launch",LR_FAIL);
30. How to configure Automatic Transactions settings?
Click here to view the hint/answer
Go to Runtime Settings, General > Miscellaneous > Automatic Transactions as shown below.
40. How to create a transaction, its status, and its duration in a single call?
Click here to view the hint/answer
Use lr_set_transaction() function as shown below.
lr_set_transaction("T00_Blazedemo", 5, LR_PASS);
web_url("blazedemo.com",
"URL=https://blazedemo.com/",
"Resource=0",
"RecContentType=text/html",
"Referer=",
"Snapshot=t1.inf",
"Mode=HTML",
EXTRARES,
"Url=/favicon.ico", ENDITEM,
LAST);
lr_set_transaction("T00_Example", 1, LR_PASS);
web_url("blazedemo.com",
"URL=https://example.com/",
"Resource=0",
"RecContentType=text/html",
"Referer=",
"Snapshot=t1.inf",
"Mode=HTML",
EXTRARES,
"Url=/favicon.ico", ENDITEM,
LAST);
50. How to create sub transactions?
Click here to view the hint/answer
By using lr_start_sub_transaction() and lr_end_sub_transaction() functions inside the transactions. E.g.
lr_start_transaction("BookFlight");
lr_start_sub_transaction("BookFlight","SearchFlight");
...
...
lr_end_sub_transaction("SearchFlight", LR_AUTO);
lr_end_sub_transaction("BookFlight", LR_AUTO);