LoadRunner levels of integration with web pages-阿里云开发者社区

开发者社区> 开发与运维> 正文

LoadRunner levels of integration with web pages

简介:

 

As you can see between user and web server there are mainly 2 layers:

  • Layer 1 is where user interacts with the browser by e.g. clicking a button, selecting values from the list or submitting a form

  • Layer 2 is where browser communicates with web server which includes:

    • creating and sending HTTP requests to the web server based on user’s actions

    • receiving HTTP responses from the web server

    • rendering HTTP responses, forming an UI and displaying it to the user

Below I’m providing two scripts that do exactly the same thing but in slightly different way. The goal for each script is to search for a “linux” word using google search.

First, lets look at “Web (HTTP/HTML)” type of the script:

  1. Action()

  2. {

  3.         web_url("www.google.com",

  4.                 "URL=http://www.google.com/",

  5.                 "Resource=0",

  6.                 "RecContentType=text/html",

  7.                 "Referer=",

  8.                 "Snapshot=t1.inf",

  9.                 "Mode=HTML",

  10.                 LAST);

  11.  

  12.         lr_think_time(6);

  13.  

  14.         web_url("search",

  15.                 "URL=http://www.google.co.uk/search?hl=en&source=hp&q=linux&btnG=Google+Search&meta=&aq=f&oq=",

  16.                 "Resource=0",

  17.                 "RecContentType=text/html",

  18.                 "Referer=http://www.google.co.uk/",

  19.                 "Snapshot=t2.inf",

  20.                 "Mode=HTML",

  21.                 LAST);

  22.  

  23.         return 0;

  24. }

What happens here?

  • In line 3 we are entering google.com web site

  • In line 14 we are sending HTTP request that browser would generate after searching for value “linux”

Now, lets look at “Web (Click and Script)” type of the script:

  1. Action()

  2. {

  3.  

  4.         web_browser("www.google.com",

  5.                 DESCRIPTION,

  6.                 ACTION,

  7.                 "Navigate=http://www.google.com/",

  8.                 LAST);

  9.  

  10.         web_edit_field("q",

  11.                 "Snapshot=t1.inf",

  12.                 DESCRIPTION,

  13.                 "Type=text",

  14.                 "Name=q",

  15.                 ACTION,

  16.                 "SetValue=linux",

  17.                 LAST);

  18.  

  19.         web_button("INPUT",

  20.                 "Snapshot=t2.inf",

  21.                 DESCRIPTION,

  22.                 "Type=submit",

  23.                 "Tag=INPUT",

  24.                 "ID=",

  25.                 "Value=Google Search",

  26.                 ACTION,

  27.                 "UserAction=Click",

  28.                 LAST);

  29.  

  30.         return 0;

  31. }

  • In line 4 we are entering google.com web site

  • In line 10 we are typing value “linux” into the input field

  • In line 19 we are clicking “Google Search” button that will move us to the page with search results

So what is the difference between these two scripts?

First script operates on much lover level comparing to second script. It deals with HTTP requests without taking care about what actions user actually performs. It doesn’t care how fast user’s browser renders and display the UI. It only checks how fast web server is able to response with correct message.

Second script operates only on UI level without taking care what happens underneath. Response time here includes not only time needed to send/receive HTTP traffic but also time needed to form/display UI to the user.

Basically second script approach is less error prone because you don’t have to deal with low level things like HTTP parameters. And You are replicating user’s actions in a natural way.

So if you need to choose, then I would recommend Web Click and Script type of the script.










本文转自 小强测试帮 51CTO博客,原文链接:http://blog.51cto.com/xqtesting/808764,如需转载请自行联系原作者

版权声明:本文内容由阿里云实名注册用户自发贡献,版权归原作者所有,阿里云开发者社区不拥有其著作权,亦不承担相应法律责任。具体规则请查看《阿里云开发者社区用户服务协议》和《阿里云开发者社区知识产权保护指引》。如果您发现本社区中有涉嫌抄袭的内容,填写侵权投诉表单进行举报,一经查实,本社区将立刻删除涉嫌侵权内容。

分享:
开发与运维
使用钉钉扫一扫加入圈子
+ 订阅

集结各类场景实战经验,助你开发运维畅行无忧

其他文章