LoadRunner Use tips: Adding transactions

Source: Internet
Author: User
Tags header http request insert

A transaction (Transaction) is used to simulate a relatively complete, meaningful business operation of a user, such as login, query, transaction, transfer, which can be a transaction, and generally does not take every HTTP request as a transaction.

Take the author of the test of the mailbox system for example, for the mailbox more basic and users use most of the application is to send and receive mail function, we can take email as a transaction: Open the letter page, fill in the recipient, subject, content, click to send a letter. In doing performance requirements analysis is the system to pull out the business, in performance scripts in the transaction to describe.

In the process of recording a script, we can add transactions through the recording Panel's transaction button.

Also take the LoadRunner webtours as an example, the operation steps:

1, hit webtours home

2, click on the Start button, enter "Login"

3, enter user name password click the login button

4, click on the end of the transaction button, OK. (Note: The start and end of a transaction must be the same name)

The script is as follows:

Action () {Web_url ("webtours", "url=http://127.0.0.1:2080/webtours/", "resource=0", " 
        Reccontenttype=text/html "," referer= "," Snapshot=t3.inf "," mode=html ", Extrares, "Url=."
    
    /favicon.ico "," referer= ", Enditem, last);    Lr_start_transaction ("Landing"); Transaction start function Web_submit_data ("login.pl", "action=http://127.0.0.1:2080/webtours/login.pl", "method= 
        POST "," Referer=http://127.0.0.1:2080/webtours/nav.pl?in=home "," mode=html ", ItemData,  "Name=usersession", "VALUE=110409.949777238FZHQCVVPHQVZZZZHDTAHFPCHAHF", Enditem, "Name=username", "Value=test", Enditem, "Name=password", "value=123456", Enditem, "Name=jsformsubmit", "Value=on", Enditem, L
    
    AST); 
        Web_submit_data ("Login.pl_2", "action=http://127.0.0.1:2080/webtours/login.pl", "Method=post", "Reccontenttype=text/html",
        "Referer=http://127.0.0.1:2080/webtours/nav.pl?in=home", "Snapshot=t4.inf", "mode=html", ItemData, "Name=usersession", "VALUE=110409.949777238FZHQCVVPHQVZZZZHDTAHFPCHAHF", Enditem, "Name=use Rname "," Value=test ", Enditem," Name=password "," value=123456 ", Enditem," Name=jsformsubmit "," Value=on "
    
    , Enditem, "name=login.x", "value=51", Enditem, "Name=login.y", "value=12", Enditem, last);   Lr_end_transaction ("Landing", Lr_auto);
Transaction End Function return 0; }

See more highlights of this column: http://www.bianceng.cnhttp://www.bianceng.cn/Programming/extra/

To view the results of a run:

ACTION.C: Notify:transaction "Landing" started.
ACTION.C (a): Web_submit_data ("login.pl") was successful, 795 body bytes, header bytes      [msgid:mmsg-26386]
ACTION.C (MB): Web_submit_data ("Login.pl_2") was successful, 795 body bytes, header bytes      [msgid:mmsg-26386]
action.c: Notify:transaction "Landing" ended with "pass" status (duration:0.5704 wasted time:0.0152).

By running the results we can see clearly that this transaction is pass, the duration of the entire script, and the elapsed time of the transaction.

How to insert a transaction:

The insert transaction operation can be performed during the recording script or after the recording is completed. You can find the part of the script where you want to add the transaction, and insert directly:

-------------------------------------------------

Lr_start_transaction ("Business");

.....

Lr_end_transaction ("Business", Lr_auto);

------------------------------------------------

Note: 1, start and end functions must appear in pairs

2, the name of the transaction must be the same.

Of course, we can also position the mouse where we want to insert the transaction, insert the transaction via the menu bar (insert--->start transaction/end transaction)

---------------------------------------------------------------------------

Some of the basic settings for the LoadRunner script have been introduced. You question whether it is less important to the concept of parameterization.

LoadRunner Parametric detailed explanation has been introduced, here also no longer repeat.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.