博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
LoadRunner levels of integration with web pages
阅读量:5942 次
发布时间:2019-06-19

本文共 2948 字,大约阅读时间需要 9 分钟。

 

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,如需转载请自行联系原作者
你可能感兴趣的文章
安装R语言开发环境RStudio服务器版
查看>>
不忘初心,努力做最好的自己
查看>>
走在浪潮尖端——为什么选择云计算
查看>>
重启nagios有异常提示Starting nagios:This account is currently not available
查看>>
全面、经典视频教程(php、java、jsp、ajax、linux...)
查看>>
Windows 7/Windows 8都有上帝模式
查看>>
华为云计算FusionCompute环境部署实验之使用批量部署工具安装
查看>>
静态路由的配置实验
查看>>
linux for循环
查看>>
关卡CyclicBarrier的使用
查看>>
用好这6个新功能,让你的项目设计事半功倍
查看>>
第一篇,试试功能如何
查看>>
成为男人眼中魅力女人的十大要素
查看>>
Python(四)IP代理
查看>>
louboutin france jambe allongement lignes
查看>>
TestBird频现国内手游“盛宴” 开发商互相介绍用得很赞
查看>>
以太坊PHP离线交易开发包
查看>>
linux运维人员必须熟悉的运维工具汇总
查看>>
在PHPStorm中支持ThinkPHP代码提示
查看>>
Linux文件压缩与归档
查看>>