Performance Testing for Ajax Applications



Similar documents
RadView Software Whitepaper. Load Testing Web 2.0 Technologies Ajax-RIA-SOA-Web Services

Term Paper. P r o f. D r. E d u a r d H e i n d l. H o c h s c h u l e F u r t w a n g e n U n i v e r s i t y. P r e s e n t e d T o :

Web Dashboard User Guide

An introduction to creating Web 2.0 applications in Rational Application Developer Version 8.0

Using WebLOAD to Monitor Your Production Environment

WebLOAD IDE User's Guide Version 8.0

MASTERTAG DEVELOPER GUIDE

Load Testing RIA using WebLOAD. Amir Shoval, VP Product Management

Chapter 12: Advanced topic Web 2.0

Scripting Guide. Version 10.0

Load and Performance Load Testing. RadView Software October

Position Paper: Toward a Mobile Rich Web Application Mobile AJAX and Mobile Web 2.0

Why AJAX? Keywords - Web applications, Java Script, Web INTRODUCTION. Why Not AJAX? 111 P a g e

Web application Architecture

Enabling AJAX in ASP.NET with No Code

Manage Workflows. Workflows and Workflow Actions

Are AJAX Applications Vulnerable to Hack Attacks?

Getting Started Guide with WIZ550web

Front-End Performance Testing and Optimization

It is highly recommended that you are familiar with HTML and JavaScript before attempting this tutorial.

Adding Panoramas to Google Maps Using Ajax

Portals and Hosted Files

Some Issues on Ajax Invocation

AJAX. Gregorio López López Juan Francisco López Panea

Client-side Web Engineering From HTML to AJAX

AJAX and JSON Lessons Learned. Jim Riecken, Senior Software Engineer, Blackboard Inc.

Ajax Development with ASP.NET 2.0

Credits: Some of the slides are based on material adapted from

JavaScript By: A. Mousavi & P. Broomhead SERG, School of Engineering Design, Brunel University, UK

Programming Fundamentals of Web Applications Course 10958A; 5 Days

Web Testing. Main Concepts of Web Testing. Software Quality Assurance Telerik Software Academy

Software Requirements Specification For Real Estate Web Site

Installation Guide. Version 10.2

Spectrum Technology Platform

4 Understanding. Web Applications IN THIS CHAPTER. 4.1 Understand Web page development. 4.2 Understand Microsoft ASP.NET Web application development

How To Test Your Web Site On Wapt On A Pc Or Mac Or Mac (Or Mac) On A Mac Or Ipad Or Ipa (Or Ipa) On Pc Or Ipam (Or Pc Or Pc) On An Ip

Introducing Apache Pivot. Greg Brown, Todd Volkert 6/10/2010

Preface. Motivation for this Book

Cache Configuration Reference

Lucy Zhang UI Developer Contact:

Unlocking the Java EE Platform with HTML 5

Web-JISIS Reference Manual

Distance Examination using Ajax to Reduce Web Server Load and Student s Data Transfer

Client-Side Web Programming (Part 2) Robert M. Dondero, Ph.D. Princeton University

Slide.Show Quick Start Guide

How To Write A Web Server In Javascript

Rich Internet Applications

Performance Testing Web 2.0

WebSphere Business Monitor V7.0 Script adapter lab

Nikhil s Web Development Helper

Developing a Web Server Platform with SAPI Support for AJAX RPC using JSON

AJAX and jmaki for Web 2.0 Development using Java. Inyoung Cho Java Technology Evangelist Sun Microsystems, Inc.

ASP.NET: THE NEW PARADIGM FOR WEB APPLICATION DEVELOPMENT

Experimenting in the domain of RIA's and Web 2.0

From Desktop to Browser Platform: Office Application Suite with Ajax

HP Business Process Monitor

RoomWizard Synchronization Software Manual Installation Instructions

Web Development. Owen Sacco. ICS2205/ICS2230 Web Intelligence

Ajax Design and Usability

Mobility Information Series

J j enterpririse. Oracle Application Express 3. Develop Native Oracle database-centric web applications quickly and easily with Oracle APEX

Wakanda Studio Features

Implementing Mobile Thin client Architecture For Enterprise Application

Ajax: A New Approach to Web Applications

Overview. In the beginning. Issues with Client Side Scripting What is JavaScript? Syntax and the Document Object Model Moving forward with JavaScript

T320 E-business technologies: foundations and practice

Programming in HTML5 with JavaScript and CSS3

Developing ASP.NET MVC 4 Web Applications MOC 20486

Sample Chapters. To learn more about this book visit Microsoft Learning at:

1. Introduction. 2. Web Application. 3. Components. 4. Common Vulnerabilities. 5. Improving security in Web applications

Specify the location of an HTML control stored in the application repository. See Using the XPath search method, page 2.

Dynamic Web Programming BUILDING WEB APPLICATIONS USING ASP.NET, AJAX AND JAVASCRIPT

ACCESSING THE PROGRESS OPENEDGE APPSERVER FROM PROGRESS ROLLBASE USING JSDO CODE

What s New in WebLOAD 10.1

Oracle Universal Content Management

This tutorial provides detailed instructions to help you download and configure Internet Explorer 6.0 for use with Web Commerce application.

Performance Testing Web 2.0. Stuart Moncrieff (Load Testing Guru) /

The purpose of jquery is to make it much easier to use JavaScript on your website.

ISL Online Integration Manual

Deepak Patil (Technical Director) iasys Technologies Pvt. Ltd.

Debugging JavaScript and CSS Using Firebug. Harman Goei CSCI 571 1/27/13

Data Visualization in Ext Js 3.4

PROJECT MANAGEMENT SYSTEM

Microsoft.Realtests v by.ERICA.50q

The Great Office 365 Adventure

CMSC434 TUTORIAL #3 HTML CSS JavaScript Jquery Ajax + Google AppEngine Mobile WebApp HTML5

XML Processing and Web Services. Chapter 17

maximizing IT productivity

AJAX Storage: A Look at Flash Cookies and Internet Explorer Persistence

Example. Represent this as XML

AJAX The Future of Web Development?

Introduction to web development and JavaScript

InPost UK Limited GeoWidget Integration Guide Version 1.1

Simply type the id# in the search mechanism of ACS Skills Online to access the learning assets outlined below.

Apple Applications > Safari

How To Use Query Console

Transcription:

Radview Software How to Performance Testing for Ajax Applications Rich internet applications are growing rapidly and AJAX technologies serve as the building blocks for such applications. These new technologies bring new challenges to the performance tester. In this document you will learn how to use WebLOAD to load test your Ajax applications. We will cover what Ajax is and how to work with different Ajax data types including XML, JSON and text-based. 1

Table of Contents Overview...3 What is Ajax?...3 JSON...3 Testing Ajax applications...4 Configuration of recording options...4 Parsing responses from Ajax applications...4 Setting the SaveSource option...4 Working with different data types...5 Working with Get request instead of Post request...5 Recording the session...6 Debugging an Ajax enabled agenda script...6 The complete sample...6 Troubleshooting...7 Setting content type options...7 Future enhancements...7 Additional resources...8 2

Overview Rich Internet applications (RIA) are web applications that have the features and functionality of traditional desktop applications. RIAs typically delegate the processing necessary for the user interface to the web client but keep the bulk of the data (i.e. maintaining the state of the program, the data etc) back on the application server. There are a number of useful technologies for building a good RIA, but the one we get asked about most frequently is Ajax. This document provides information on how to use WebLOAD (version 7.6 and higher) for load testing of Ajax applications. What is Ajax? From Wikipedia, the free encyclopedia 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 3

the JavaScript eval function. This is a great advantage for WebLOAD users since JavaScript is our standard scripting language. Testing Ajax applications The overall process of testing Ajax applications is no different than testing any other web application. We start by authoring a test agenda (WebLOAD test script), debugging it in the WebLOAD IDE authoring environment, and running the test session on the WebLOAD Console. The rest of the document shall focus on how to best work with the new IDE to efficiently create an Ajax based agenda script. Configuration of recording options By default, WebLOAD supports most Ajax applications as long as they use text, XML or JSON data types. This means that most users do not need to change anything in the recording options. If you are still having trouble getting your Ajax calls recorded see the troubleshooting section later in this document. Parsing responses from Ajax applications Setting the SaveSource option Ajax applications return valuable data as a response to the Ajax request. In most test scenarios we would like to parse and parameterize the response. By default, WebLOAD does not save the text of the response as is. Instead, WebLOAD uses the response to build an internal DOM object. If you want to manipulate the Ajax response returned from the server, the SaveSource option must be turned on. The SaveSource option Instructs WebLOAD to store the complete downloaded HTML source code in an HTTP command: False - Do not store the source HTML. (default) True - Store the source HTML in document.wlsource. When SaveSource is enabled (True), WebLOAD automatically stores the downloaded HTML whenever the Agenda calls the wlhttp.get() or wlhttp.post() method. WebLOAD stores the most recent download in the document.wlsource property, refreshing it when the Agenda calls wlhttp.get() or wlhttp.post() again. The stored code includes any scripts or other data embedded in the HTML. The Agenda can retrieve the code from document.wlsource and interpret it in any desired way. To set the SaveSource option for a specific request, use the following code: wlhttp.savesource = true To set the SaveSource option for all requests in the agenda, use the following code: 4

wlglobals.savesource = true To retrieve the content of your response use the document.wlsource. For example, if the response contains JSON formatted data, use the following code: var MyJSON = eval ( ( + document.wlsource + ) ) The same approach can be used to load your response from the document.wlsource to the XML parser of your choice or use the built in parser WLXmlDocument. Working with different data types WebLOAD supports most data type formats sent between the client and the server. The following table summarizes the different formats and the support for parsing and manipulating them inside the agenda script. Format Parsing & Access Level from script XML XML DOM Yes JSon JavaScript Object Yes WSDL XML DOM Yes Other text-based formats Binary formats JavaScript string & regular expressions functions Can be played back exactly as recorded Can be modified dynamically? Yes No Working with Get request instead of Post request So far we set the different settings relevant to Ajax calls implemented as Post requests. Sometimes you might want to have a Get request running as a backend Ajax call. To implement a Get request, you need to first manually set the content type, since the WebLOAD Post Data tab option is relevant only to Post commands (as its name implies). wlglobals.contenttype = "application/json; charset=utf-8" wlhttp.get("http://ajax.asp.net/docs/samples/sys.net.callwebservicemethods/cs/ WebService.asmx/EchoStringAndDate") 5

Recording the session To record an Ajax application just click on the record button and browse to your site. You should see your client/server Ajax calls recorded in the IDE. Note that any client side Ajax operation such as drag & drop or auto-complete has no effect on the server and is therefore not recorded in the performance agenda script. Debugging an Ajax enabled agenda script If you want to manipulate your response returned from the server you can set a breakpoint just after the eval operation and use the watch window to explore the content of your response (in our previous example, stored in the MyJSON object.) The complete sample We looked at one of the pages on the Microsoft official ASP.Net Ajax site and took the Calling web methods sample page (http://ajax.asp.net/docs/samples/sys.net.callwebservicemethods/cs/callwebservicemet hods.aspx ) /***** WLIDE - URL : http://ajax.asp.net/docs/samples/sys.net.callwebservicemethods/cs/webser vice.asmx/getservertime - ID:2 *****/ wlglobals.getframes = false // Setting the SaveSource option wlglobals.savesource = true wlhttp.post("http://ajax.asp.net/docs/samples/sys.net.callwebservicemetho ds/cs/webservice.asmx/add") MyJSON = eval ( "(" + document.wlsource + ")" ) InfoMessage(MyJSON) /***** WLIDE - URL : http://ajax.asp.net/docs/samples/sys.net.callwebservicemethods/cs/webser vice.asmx/echostringanddate?dt=%22%401167602400000%40%22&s=%22 %20Happy%22 - ID:9 *****/ wlhttp.header["referer"] = "http://ajax.asp.net/docs/samples/sys.net.callwebservicemethods/cs/callwe bservicemethods.aspx" wlhttp.formdata["dt"] = "\"@1167602400000@\"" wlhttp.formdata["s"] = "\" Happy\"" wlglobals.contenttype = "application/json; charset=utf-8" wlhttp.get("http://ajax.asp.net/docs/samples/sys.net.callwebservicemethod s/cs/webservice.asmx/echostringanddate") 6

Troubleshooting Most Ajax applications use JSON, XML or text data types between the client and the server. By default, WebLOAD supports all of them. If for some reason your Ajax request is still not getting recorded in the agenda, the recording options can be changed using the Tools - > Record Options dialog box. Setting content type options If you don t know exactly what content type your application uses, the best way to start recording is by turning On the Record Unknown types in the record options. This setting is sufficient for most known applications. If you still don t see your Ajax calls recorded in your application you can try and check the Record Unknown Extensions in the File Extensions tab. Future enhancements Our continual development efforts include a number of features to further enhance the already powerful Ajax performance testing capabilities offered in WebLOAD 8.0. Our load engine technology already enables control of browser caching and multiple thread execution among other features. We are evaluating the addition of support for asynchronous calls in a future release in support of a recently introduced Ajax feature. This new Ajax method performs asynchronous calls to the server and receives callbacks once the server is done processing the request. Our current version of the engine executes the agenda in a synchronous manner and does not support asynchronous calls. In practice, this has very little effect on real performance testing of the server application since statistically the different virtual clients shall distribute evenly. Furthermore, the WebLOAD Cruise-Control feature can be used to achieve the target load. Future versions of the engine might support execution of different calls in the same agenda in parallel. 7

Other enhancements considered for our scripting language include the addition of support for JSON objects and XML data, providing better and easier access for manipulation of such data. Additional resources 1) JSON site - http://www.json.org/ 2) Microsoft official ASP.NET AJAX site http://ajax.asp.net/default.aspx 3) Wikipedia http://en.wikipedia.org/wiki/ajax_(programming) Ajax Matters site http://www.ajaxmatters.com/ Contact Information: North America RadView Software Inc. 991 Highway 22 West Suite 200 Bridgewater, NJ 08807 Email: info@radview.com Phone:908-526-7756 Fax:908-864-8099 Toll Free:1-888-RadView United Kingdom Other Countries RadView Software (UK) Email: info@radview.com Phone: +44-080-81011165 RadView Software Ltd. 14 Hamelacha Street Rosh Haayin 48091, Israel Phone:+972-3-915-7060 Fax:+972-3-915-7683 RadView corporate website: www.radview.com WebLOAD community website: www.webload.org 8