博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
LoadRunner测试AJAX
阅读量:4199 次
发布时间:2019-05-26

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

什么是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 eval function.

 

 

LoadRunner支持的AJAX框架

 

LoadRunner支持的AJAX框架比较少,以下内容摘自:

 

 

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 . 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.
    • 1.8 — Autocomplete, Reorder List, and Slider

HP advertises that VuGen supports these frameworks at the "engine level", implying that VuGen will create , but not :

  •  
    • 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为例: 

 

 

测试其中的sliderLoadRunner可以录制下脚本,并调用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}"));

 

 

 

 

 

 

 

转载地址:http://iknli.baihongyu.com/

你可能感兴趣的文章
JPA 注解
查看>>
JQuery 简介
查看>>
Java创建对象的方法
查看>>
Extjs自定义组件
查看>>
TreeGrid 异步加载节点
查看>>
Struts2 标签库讲解
查看>>
Google Web工具包 GWT
查看>>
材料与工程学科相关软件
查看>>
MPI的人怎么用仪器
查看>>
windows 下AdNDP 安装使用
查看>>
Project 2013项目管理教程(1):项目管理概述及预备
查看>>
ssh客户端后台运行
查看>>
哥去求职,才说了一句话考官就让我出去
查看>>
【React Native】把现代web科技带给移动开发者(一)
查看>>
【GoLang】Web工作方式
查看>>
Launch Sublime Text 3 from the command line
查看>>
【数据库之mysql】mysql的安装(一)
查看>>
【数据库之mysql】 mysql 入门教程(二)
查看>>
【HTML5/CSS/JS】A list of Font Awesome icons and their CSS content values(一)
查看>>
【HTML5/CSS/JS】<br>与<p>标签区别(二)
查看>>