LoadRunner测试AJAX

什么是AJAX

Ajax, shorthand for Asynchronous JavaScript and XML, is a web development technique for creating interactive web applications. The intent is to make web pages feel more responsive by exchanging small amounts of data with the server behind the scenes, so that the entire web page does not have to be reloaded each time the user requests a change.This is meant to increase the web page‘s interactivity, speed, and usability.

The Ajax technique uses a combination of:

  • XHTML (or HTML) and CSS, for marking up and styling information.
  • The DOM accessed with a client-side scripting language, especially ECMAScript implementations such as JavaScript and JScript, to dynamically display and interact with the information presented.
  • The XMLHttpRequest object is used to exchange data asynchronously with the web server. In some Ajax frameworks and in certain situations, an IFrame object is used instead of the XMLHttpRequest object to exchange data with the web server, and in other implementations, dynamically added <script> tags may be used.
  • XML is sometimes used as the format for transferring data between the server and client, although any format will work, including preformatted HTML, plain text, JSON and even EBML. These files may be created dynamically by some form of server-side scripting.

Like DHTML, LAMP and SPA, Ajax is not a technology in itself, but a term that refers to the use of a group of technologies.

JSON

JavaScript Object Notation (JSON) is a lightweight format for representing

objects and their state. Major technology providers, such as Yahoo WS

and Microsoft ASP.NET, have chosen JSON for client-server data exchange

as an alternative to XML, because it can be parsed more easily than XML.

For example, JSON objects can be de-serialized by simply passing them to the JavaScript evalfunction.

LoadRunner支持的AJAX框架

LoadRunner支持的AJAX框架比较少,以下内容摘自http://www.wilsonmar.com/ajax_rec.htm

HP has stated that they support these frameworks for AJAX functions:

    • Atlas 1.0.10920.0/ASP.NET AJAX (All controls) (developed using Visual Studio 2005). LoadRunner 9.10 supported the Atlas 2.0 version in Visual Studio 2005.

      • This is one generation behind the ASP.NET 3.5 AJAX AjaxControlToolkit shown on the their sample website. However, I have been able to use LoadRunner 9.51 to work with many MS AJAX 3.5 controls even though some controls are not being created during recording.
    • Scriptaculous 1.8 — Autocomplete, Reorder List, and Slider

HP advertises that VuGen supports these frameworks at the "engine level", implying that VuGen will create Web Click and Script LoadRunner functions, but not LoadRunner‘s AJAX specific functions:

    • Prototype 1.6
    • Google Web Toolkit (GWT) 1.4

I‘ve heard that additional licensing is needed for LoadRunner to support the Infragistics library. What is the HP product code for this, if it exists???

LoadRunnerAJAX函数

LR9.0:

VuGen supports recording for the following ASP.NET AJAX controls: Accordion, Collapsible Panel, Rating, Reorder List, and Slider.


Function Name


Description


ajax_accordion


Emulates a user extending or collapsing a menu.


ajax_collapsiblepanel


Emulates a user collapsing or expanding sections on a web page.


ajax_rating


Emulates a user setting a value of a rating control.


ajax_reorderlist


Emulates a user reordering elements in a list.


ajax_slider


Emulates setting a value using a slider control.

LR9.5:

The supported frameworks for AJAX functions are:

? Atlas 1.0.10920.0/ASP.NET AJAX—All controls

? Scriptaculous 1.8—Autocomplete, Reorder List, and Slider

VuGen supports the following frameworks at the engine level. This implies

that VuGen will create standard Web Click and Script steps, but not AJAX

specific functions:

? Prototype 1.6

? Google Web Toolkit (GWT) 1.4


Function Name


Description


ajax_accordion


Emulates a user extending or collapsing a menu.


ajax_autocomplete


Selects an item from a list based on text entered in a field.


ajax_collapsiblepanel


Emulates a user collapsing or expanding sections on a web page.


ajax_rating


Emulates a user setting a value of a rating control.


ajax_reorderlist


Emulates a user reordering elements in a list.


ajax_slider


Emulates setting a value using a slider control.


ajax_tabs


Emulates use of folder-style tabs in Atlas applications.

LoadRunner测试AJAX的例子

以asp.net ajax的在线samples为例:

http://www.asp.net/AJAX/AjaxControlToolkit/Samples/Slider/Slider.aspx

测试其中的slider,LoadRunner可以录制下脚本,并调用ajax_slider函数来处理slider控件的行为:

web_browser("Slider.aspx",

DESCRIPTION,

ACTION,

"Navigate=http://www.asp.net/AJAX/AjaxControlToolkit/Samples/Slider/Slider.aspx",

LAST);

ajax_slider("Slider",

DESCRIPTION,

"Framework=atlas",

"ID=ctl00_SampleContent_Slider1",

ACTION,

"UserAction=SetValue",

"Value=100",

LAST);

执行JavaScript的方法

使用web_browser函数,可以通过给EvalJavaScript属性赋值来执行javaScript语句,例如访问DOM,用EvalJavaScriptResultParam属性可以把语句执行的结果存入参数:

web_browser("keyId_Get",

ACTION,

"EvalJavaScript=document.getElementById(/"ctl00_SampleContent_Slider1_BoundControl/").innerText;",

"EvalJavaScriptResultParam=strValue",

LAST);

lr_output_message(lr_eval_string("{strValue}"));

时间: 2024-12-26 07:46:02

LoadRunner测试AJAX的相关文章

LoadRunner测试ajax框架,回放后系统中没有产生数据解决方法

LoadRunner测试ajax框架的系统时,录制回放都没有报错,但是回放后系统中没有产生数据,数据始终不能写入数据库.查了一下原因,应该是录制的脚本不完善的问题,因为JS是在客户端执行的程序,LR只能监控客户机与服务器之前的通信. 解决方法: Recording options> HTTP Properites> Advanced > Headers: 选择"Record headers not in list", 然后点ok. 重新录制一遍脚本,会发现脚本里多出一

loadrunner测试ajax框架

loadrunner测试ajax框架的系统时,录制回放都没有报错,但是回放后系统中没有产生数据,解决方法 loadrunnerajax框架测试脚本headerajax [问题描述]用loadrunner测试ajax框架的系统时,录制回放都没有报错,但是回放后系统中没有产生数据,数据始终不能写入数据库.查了一下原因,应该是录制的脚本不完善的问题,因为JS是在客户端执行的程序,LR只能监控客户机与服务器之前的通信. [解决方法]: Recording options> HTTP Properites

Selenium测试Ajax程序(转)

上周末参加了Qclub的百度技术沙龙,听了百度的孙景卫讲了Web自动化测试,讲的非常好,然后在小组讨论时又有幸座在了一起.我们讨论的一个内容,就是Ajax应用程序比原来的非Ajax程序更不易测试,这里有两个主要原因. 第一:Ajax使得基于纯录制的方式无法工作,因为录制一个操作,这次返回需要5秒钟,下次会更多或更少. 第二:一些测试工具是基于原来非Ajax程序来开发的,后面没做对应的升级. 但是,同样有很多工具支持Ajax的测试,今天我们就来看一下大名鼎鼎的Selenium如何测试Ajax程序.

loadrunner测试TCP协议服务器性能

最近对服务器的性能感兴趣,于是开始研究了一阵子loadrunner如何做采用TCP协议交互的服务器的性能测试,对loadrunner不是很熟悉,所以一开始也走了一些弯路,现将学习的过程记录下来,为以后做参考吧. TCP协议的服务器的性能测试,我想大家都会选择loadrunner的winsocket协议进行测试,我也是采用此种方式.下面将逐一记录如何使用此协议做性能测试. 1.采用DLL文件方式进行测试 由于与服务器连接的客户端的DLL文件我手头有,同时其对应的头文件也有,所以一开始试想的是采用l

LoadRunner测试50人同时登陆下单

LoadRunner测试50人同时登陆下单 一.LoadRunner简介 LoadRunner,是一种预测系统行为和性能的负载测试工具.通过以模拟上千万用户实施并发负载及实时性能监测的方式来确认和查找问题,LoadRunner能够对整个企业架构进行测试.企业使用LoadRunner能最大限度地缩短测试时间,优化性能和加速应用系统的发布周期. LoadRunner可适用于各种体系架构的自动负载测试,能预测系统行为并评估系统性能. 二.名词解释 1.集合 集合点的意思时等到特定的用户数后再一起执行某

LoadRunner测试结果分析02 转载至zhangzhe的新浪博客

LoadRunner测试结果分析之我见 上述测试过程的重点在于事务,而LoadRunner生成的测试结果图并不局限于事务上,其中还有是关于Vusers.Errors.Web Resources.Web Page diagnostics的测试图. 1. 对于Vusers的测试图有3种:Running Vusers.Vusers Summary.Rendezvous,其中Running Vusers是关于虚拟用户加压.施压.减压的情况图: Vusers Summary是用户运行结果的综述图:Rend

loadrunner测试c/s架构的应用系统

用LoadRunner测试c/s架构的软件,怎样去选择协议,困扰了我很久,看到这篇文章,感觉有点收获,所以特意转了过来,希望对大家有用. 首先,什么是协议?协议无非就是一个约定,关于数据包发送的格式的约定,就是说如果大家都这样发送,那么通信就能够成功,如果大家都各按各的来,那么就没办法进行通信了.那么接下来就是LR录制时的工作原理了,LR的录制和WR不一样,它不关心你的对象识别什么的,不关心你的什么窗口之类的,LR有一个Agent进程,来专门监控客户端和服务器之间的通信,然后用自己的函数进行录制

LoadRunner测试结果分析01 转载至zhangzhe的新浪博客

LoadRunner测试结果分析之我见 LoadRunner生成测试结果并不代表着这次测试结果的结束,相反,这次测试结果的重头戏才刚刚开始.如何对测试结果进行分析,关系着这次测试的成功与否.网上关于LoadRunner测试结果如何分析的介绍相当匮乏,在总结他人的观点和自己的实验体会基础上来介绍如何进行LoadRunner测试结果分析. 1. LoadRunner测试结果分析的第一步应该是查看分析综述(Analysis Summary),其包括统计综述(Statistics Summary).事务

LoadRunner测试结果分析03 转载至zhangzhe的新浪博客

LoadRunner测试结果分析之我见 前面分析的Web Resource(网络资源)的测试情况,其主要关注的是服务器性能,而系统本身和环境都有可能存在问题,页面诊断(Web Page Diagnostics)主要就是关注这方面的问题.页面诊断可以很好地定位环境问题,如客户端问题.网络问题等,也可以很好的分析系统本身的问题,如网页问题. 1.Web Page Diagnostics (网页诊断)对测试过程中所有的页面进行一个 信息汇总,可以很容易地观察出哪个页面下载耗时,然后选择该页面得其页面分