Wednesday, 4 November 2015

Transactions in QTP

Transactions: A transaction represents the process in your application that you are interested in measuring. By defining a transaction you can measure how long it takes to run a section of a test script.
In Qtp we have a facility to measure how long it takes to run a section of your test by defining  an operation called Transactions. Generally in order to define transactions within our test we make the application close by giving the appropriate sections of the test with start and end transaction statements.
  • Transactions can be inserted anywhere in the dynamic script we write or record.
  • There is no limit to the number of transactions that can be added to a test.
  • You can also insert a transaction within a transaction
For example, If I want to note the time taken to book a flight using the Flight reservation application then, in QTP first record the script and select the appropriate statement where we want to start our transaction. These are the steps to insert transaction in a QTP script
Step 1:  Select Insertà Start Transaction. Then Start Transaction Dialog Box opens
Step 2: Give the transaction a suitable name, just simply name it as "Booking Time"
Step 3: A start transaction statement is added in the test
Step 4: Select the statement where you want to end the transaction
Step 5: Click Insert à End Transaction
Step 6: End Transaction Dialog Box Opens with the list of all available transactions

Step 7: Click Okay. An end transaction statement is added
After inserting the transactions in the test script when we run the test we should get the time taken to insert an order in the flight reservation application. So run the test and analyze the Test. In results, the end transaction statement gives the time taken to insert the order as so and so seconds

Need for inserting Transactions in QTP:
  • Transactions can be used to measure the performance of the script
  • By analyzing the output of the Transaction we can optimize the script in certain areas



No comments:

Post a Comment