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,如需转载请自行联系原作者
目录
相关文章
|
23天前
|
开发框架 前端开发 JavaScript
ASP.NET Web Pages - 教程
ASP.NET Web Pages 是一种用于创建动态网页的开发模式,采用HTML、CSS、JavaScript 和服务器脚本。本教程聚焦于Web Pages,介绍如何使用Razor语法结合服务器端代码与前端技术,以及利用WebMatrix工具进行开发。适合初学者入门ASP.NET。
|
23天前
|
开发框架 .NET PHP
ASP.NET Web Pages - 添加 Razor 代码
ASP.NET Web Pages 使用 Razor 标记添加服务器端代码,支持 C# 和 Visual Basic。Razor 语法简洁易学,类似于 ASP 和 PHP。例如,在网页中加入 `@DateTime.Now` 可以实时显示当前时间。
|
Web App开发 .NET
一起谈.NET技术,ASP.NET MVC3 基础教程 – Web Pages 1.0
  I:Web Pages 1.0中以“_”开头的特别文件(文件命名时不区分大小写)   “_appstart.cshtml” & “_pagestart.cshtml” & “_viewstart.cshtml”   _appstart.cshtml - 应用程序启动时在Global. Application_Start方法后执行。
1116 0
|
Web App开发 .NET
ASP.NET MVC3 基础教“.NET技术”程 – Web Pages 1.0
  I:Web Pages 1.0中以“_”开头的特别文件(文件命名时不区分大小写)   “_appstart.cshtml” & “_pagestart.cshtml” & “_viewstart.cshtml”   _appstart.cshtml - 应用程序启动时在Global. Application_Start方法后执行。
1075 0
|
Web App开发 .NET
ASP.NET MV“.NET研究”C3 基础教程 – Web Pages 1.0
  I:Web Pages 1.0中以“_”开头的特别文件(文件命名时不区分大小写)   “_appstart.cshtml” & “_pagestart.cshtml” & “_viewstart.cshtml”   _appstart.cshtml - 应用程序启动时在Global. Application_Start方法后执行。
1139 0
|
Web App开发 Python
Python crawler access to web pages the get requests a cookie
Python in the process of accessing the web page,encounter with cookie,so we need to get it. cookie in Python is form of a dictionary exists ,so coo...
1450 0
|
前端开发 .NET Windows
ASP.NET Web Pages 的冲突版本问题
随着VS版本和.NET MVC版本、EF的版本的不断更新,虽然很多功能随着版本的提升而更完善,但对于旧版本开发的软件就有点悲催了,或许很多开发者都遇到类似的问题! 最近有一个项目是用.NET MVC3+EXT.NET MVC开发的(当时使用本博客中Ext.Net MVC 配置(2)进行配置的),现在要移植到MVC4的环境中,就遇到了各种各样的问题,都快奔溃了,现在就来总结下: 1、ASP.NET Web Pages版本问题 调试后浏览器提示:  检测到 ASP.NET Web Pages 的冲突版本: 指定的版本为“1.0.0.0”,而 bin 中的版本为“2.0.0.0”。
1378 0
|
Windows 内存技术 Go
Embeding Video Players in web pages Summary
1. Windows Media Player     2.
801 0
Did you know… How to quickly comment and uncomment in your web pages?
Select the lines you want to be commented in your ASPX, HTML, web config file etc  and click on the Comment/ Uncomment icon in Toolbar.
804 0