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,如需转载请自行联系原作者
目录
相关文章
|
7月前
|
前端开发
Error: webpack.optimize.CommonsChunkPlugin has been removed,
Error: webpack.optimize.CommonsChunkPlugin has been removed,
webpack中的optimization配置详解(持续更新)
webpack中的optimization配置详解(持续更新)
238 0
webpack中的optimization配置详解(持续更新)
|
数据采集
The Tale of Creating a Distributed Web Crawler
推荐一篇分布式爬虫的文章https://benbernardblog.com/the-tale-of-creating-a-distributed-web-crawler/
786 0
|
Web App开发 网络协议 JavaScript
How Do Web Browsers Work
Have you ever wondered how a browser is capable of displaying visually attractive and interactive web pages? Have you encountered Error 404 or a DNS r.
2812 0