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,如需转载请自行联系原作者
目录
相关文章
|
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方法后执行。
1112 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方法后执行。
1070 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方法后执行。
1134 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...
1446 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”。
1360 0
|
Windows 内存技术 Go
Embeding Video Players in web pages Summary
1. Windows Media Player     2.
796 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.
800 0
|
17天前
|
XML JSON API
ServiceStack:不仅仅是一个高性能Web API和微服务框架,更是一站式解决方案——深入解析其多协议支持及简便开发流程,带您体验前所未有的.NET开发效率革命
【10月更文挑战第9天】ServiceStack 是一个高性能的 Web API 和微服务框架,支持 JSON、XML、CSV 等多种数据格式。它简化了 .NET 应用的开发流程,提供了直观的 RESTful 服务构建方式。ServiceStack 支持高并发请求和复杂业务逻辑,安装简单,通过 NuGet 包管理器即可快速集成。示例代码展示了如何创建一个返回当前日期的简单服务,包括定义请求和响应 DTO、实现服务逻辑、配置路由和宿主。ServiceStack 还支持 WebSocket、SignalR 等实时通信协议,具备自动验证、自动过滤器等丰富功能,适合快速搭建高性能、可扩展的服务端应用。
75 3
|
23天前
|
设计模式 测试技术 持续交付
开发复杂Web应用程序
【10月更文挑战第3天】开发复杂Web应用程序
31 2