Wednesday, 7 July 2010

Adding transactions to the WebTest

It is not unusual for single user action (i.e. submitting form, refreshing page) to issue many HTTP requests. In order to establish true user experience while navigating between pages it is necessary to sum up all request response times. Calculated number will be how much end user will have to wait since clicking a submit button until the next page finish loading.

For that reason many performance testing tools (including VSTS) provide simple solution to this common problem – transactions.

Since it would be difficult (if not impossible) for a testing tool to automatically add the transactions it is something what needs to be done manually before a meaningful test can be executed.

Having said that it will still be possible to execute a load test without addin in transactions although some manual calculations will have to be done to figure out how much time each user action takes.

It is important to define transactions in the same way if the scripts needs to be rerecorded otherwise the results of different test executions cannot be directly compared.

In order to define transactions the WebTest:

  1. Right click on the first request or comment which doesn't belong to any transaction

  2. Select "Insert Transaction…" from the context menu

  3. Enter transaction name; see transaction naming convention below

  4. Select first request or comment for this transaction; this will be already preselected to the request on which "Insert Transaction…" has been clicked

  5. Select last request for this transaction; if you followed this guide closely it will be the last request before next comment

  6. Click OK

  7. Repeat steps 1 to 6 for remaining requests

    New transaction will be added to the WebTest with the chosen requests. If for any reason the transaction is not as intended (i.e. missing requests or too many requests) it is possible to manually drag and drop requests in and out of the transaction.

Transaction naming convention
It is considered a good practise to adhere to a transaction naming convention. The naming convention which I find particularly helpful during could be defined as ShortScriptName_Index_TransactionName

Based on that convention transaction names could look as follows:

  • SMP_01_NavigateToHomePage
  • SMP_02_SearchForProduct

Using this naming it is possible to sort transaction by name while viewing test results and then follow transaction times in the execution order.

For the full guide to developing VSTS WebTests please refer to the Using Fiddler with VSTS.

No comments:

Post a Comment