Your SlideShare is downloading. ×
AppPerfect Load Test
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×

Introducing the official SlideShare app

Stunning, full-screen experience for iPhone and Android

Text the download link to your phone

Standard text messaging rates apply

AppPerfect Load Test

3,363
views

Published on


0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
3,363
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
24
Comments
0
Likes
0
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  • 1. AppPerfect™ Load Test v 10.5.0 User Guide Copyright (C) 2002-2009 AppPerfect Corporation. All rights reserved. AppPerfect is a trademark of AppPerfect Corporation. Java is a trademark of Sun Microsystems, Inc.
  • 2. AppPerfect Software License Agreement IMPORTANT: READ THIS AGREEMENT CAREFULLY BEFORE YOU INSTALL, COPY, DOWNLOAD OR USE THE SOFTWARE ACCOMPANYING THIS PACKAGE This AppPerfect Software License Agreement "ASLA" is a legal agreement between "You" (either an individual or a single entity) and AppPerfect Corporation (referred herein as "AppPerfect") for the AppPerfect software products and printed and/or electronic documentation accompanying this ASLA (collectively referred herein as "SOFTWARE"). By installing, copying, downloading or using the SOFTWARE, You agree to be bound by the terms of this ASLA. If You do not agree with all the terms of this ASLA, AppPerfect is unwilling to license the SOFTWARE to You. In such an event, You may not install, copy, download or use the SOFTWARE and You must return to AppPerfect the complete SOFTWARE package, including the disks and printed materials or if you downloaded the SOFTWARE, notify AppPerfect in writing that You have de-installed the SOFTWARE within thirty (30) days of receipt for a refund of the purchase price. 1. LICENSE. 1.1 Grant. Subject to the terms and conditions of this ASLA, AppPerfect hereby grants to You a limited, non-exclusive, non-transferable license to use the SOFTWARE for the authorized use for which You have paid AppPerfect a license fee. This SOFTWARE is licensed for use, not sold. AppPerfect and its suppliers retain all rights in the SOFTWARE. 1.2 Mechanism: The AppPerfect Java Unit Test, AppPerfect Java Code Test, AppPerfect Java Profiler, AppPerfect Web Test, AppPerfect Load Test and AppPerfect App Test products are licensed for installation on a single client machine and for use by a single user. The AppPerfect Test Manager and AppPerfect Agentless Monitor Server is licensed for the machines on which it is installed. AppPerfect Agentless Monitor is licensed for each device (as defined by the SOFTWARE ) that is monitored. 1.3 Term. The license granted herein begins upon installation, copying, downloading or use of the SOFTWARE and continues in perpetuity unless sooner terminated. Without prejudice to any other rights, AppPerfect may terminate this ASLA if You fail to comply with the terms and conditions of this ASLA. 1.4 No Copies. Except as expressly allowed by the terms of this license, You shall not copy or modify any portion of the SOFTWARE other than that You may make one (1) copy of the computer program portion of the SOFTWARE solely for archival purposes. 1.5 Other Limitations. You shall not rent, lease, loan, sell or otherwise distribute the SOFTWARE or use the SOFTWARE as an application service provider, as a service bureau, or in a fee-generating service provided to third parties. You shall not reverse engineer, decompile or otherwise attempt to derive the source code for the SOFTWARE.
  • 3. 2. CONFIDENTIALITY; OWNERSHIP. 2.1 Title and Ownership. All titles, ownership rights, and copyrights and other intellectual property rights in the SOFTWARE shall remain in AppPerfect and/or its suppliers. You acknowledge such ownership and intellectual property rights and will not take any action to jeopardize, limit or interfere in any manner with AppPerfect's or its suppliers' ownership of or rights with respect to the SOFTWARE. The SOFTWARE is protected by copyright and other intellectual property laws and by international treaties. Nothing in this license shall be construed as a grant in or a transfer of any proprietary rights. This SOFTWARE is licensed for user, not sold. 2.2 Proprietary Information. You agree that the SOFTWARE and all computer code, inventions, algorithms, know-how and ideas embodied in or by the SOFTWARE and all other business, technical and financial information You obtain from AppPerfect, whether designated confidential or not (hereinafter referred to as "Proprietary Information") are the confidential property of AppPerfect. You also agree that any expression of AppPerfect's findings, analyses, conclusions, opinions, recommendations, ideas, techniques, know-how, designs, programs, enhancements, SOFTWARE, and other technical information provided to You by AppPerfect in the course of performing consulting, training, maintenance or other services related to the SOFTWARE are the Proprietary Information of AppPerfect and are licensed to You, pursuant to this ASLA. 2.3 Non-Disclosure. You agree to keep the Proprietary Information in a secure place, under access and use restrictions designed to prevent disclosure of the Proprietary Information to unauthorized persons and to instruct Your personnel to keep the Proprietary Information confidential. 2.4 Breach. You agree that any disclosure of the Proprietary Information to a Third Party other than in accordance with the terms of this ASLA constitutes a material breach of this ASLA and will terminate the license granted by this ASLA. 2.5 Injunctive Relief. You further agree that You will be liable for all damages to AppPerfect that result from any wrongful disclosure of the Proprietary Information to any Third Party or any breach of this ASLA. You acknowledge that such wrongful disclosure or breach could cause irreparable injury that cannot be compensated by monetary damages and that injunctive or other equitable relief may be appropriate. 3. PRODUCT MAINTENANCE. You understand and agree that AppPerfect may provide updates to the SOFTWARE from time to time but AppPerfect shall have no obligation to provide maintenance or updates to You for SOFTWARE licensed under this ASLA. 4. DISCLAIMER OF WARRANTY AND LIABILITY. 4.1 THE SOFTWARE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, APPPERFECT FURTHER DISCLAIMS ALL WARRANTIES, INCLUDING WITHOUT LIMITATION ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. THE
  • 4. ENTIRE RISK ARISING OUT OF THE USE OR PERFORMANCE OF THE PRODUCT AND DOCUMENTATION REMAINS WITH YOU, THE LICENSEE. 4.2 TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, IN NO EVENT SHALL APPPERFECT OR ITS SUPPLIERS BE LIABLE FOR ANY CONSEQUENTIAL, INCIDENTAL, DIRECT, INDIRECT, SPECIAL, PUNITIVE, OR OTHER DAMAGES WHATSOEVER (INCLUDING, WITHOUT IMITATION, DAMAGES FOR LOSS OF BUSINESS PROFITS, BUSINESS INTERRUPTION, LOSS OF BUSINESS INFORMATION, OR OTHER PECUNIARY LOSS) ARISING OUT OF THE USE OF OR INABILITY TO USE THE PRODUCT OR DOCUMENTATION, EVEN IF APPPERFECT HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. BECAUSE SOME STATES/JURISDICTIONS DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES, THE ABOVE LIMITATION MAY NOT APPLY TO YOU. 5. TERMINATION. 5.1 Basis for Termination. AppPerfect may terminate this ASLA if You commit a material breach of this ASLA 5.2 Obligations Upon Termination. Upon termination of this ASLA, You will immediately destroy or return to AppPerfect all SOFTWARE and Proprietary Information in Your possession. 5.3 Effect of Termination. The following provisions shall survive termination of this ASLA: 2, 4, 5.2, 5.3, and 6. 6. GENERAL TERMS AND CONDITIONS. 6.1 Severability. If any provision of this ASLA is found by any court of competent jurisdiction to be invalid, then the remaining provisions shall nevertheless remain in full force and effect. 6.2 Choice of Law and Venue. This ASLA shall be governed by and construed under the laws of the State of California without regard to conflicts of laws or provisions thereof, and without regard to the United Nations Convention on Contracts for the International Sale of Goods. You agree that the federal and state courts within Santa Clara County, California shall have exclusive jurisdiction to adjudicate any dispute arising out of this ASLA. 6.3 Complete Agreement. This ASLA is the complete and exclusive statement of the mutual understanding of the parties and that it supersedes and cancels all previous written and oral agreements and communications relating to the subject matter of this ASLA. AppPerfect disclaims all preprinted terms of any purchase order or other written instrument submitted by You. 6.4 No Modification. You agree that this ASLA can be modified only by a written agreement duly executed by persons authorized to execute agreements on behalf of the parties hereto. 6.5 No Waiver. You agree that any failure or delay to exercise or any partial exercise of any right, power, or privilege hereunder by AppPerfect shall not operate as a waiver.
  • 5. 6.6 Attorneys' Fees. If any legal action is necessary to enforce the terms of this ASLA, the prevailing party shall be entitled to reasonable attorneys' fees and costs in addition to any other relief to which that party may be entitled. 6.7 Export Laws. You shall comply with all then current export laws and regulations of the U.S. Government and the government of the country in which You receive delivery of the SOFTWARE, which pertain to the SOFTWARE. You may not install the SOFTWARE outside of the country to which the SOFTWARE was initially shipped. 7. U.S. GOVERNMENT RESTRICTED RIGHTS. The SOFTWARE, including related documentation, is provided with Restricted Rights. The use, duplication or disclosure by the U.S. Government is subject to restrictions as set forth in this ASLA, and in the applicable provisions of subparagraph (c)(1)(ii) of the Rights in Technical Data and Computer Software clause DFARS 252.227-7013, or subparagraphs (c)(1) and (2) of the Commercial Computer Software - Restricted Rights at 48 CFR 52.227-19. The manufacturer is AppPerfect Corporation, 11651 Timber Spring Court, Cupertino, CA 95014. Should you have any questions concerning this ASLA, or if You desire to contact AppPerfect for any reason, please write: AppPerfect Corporation, 11651 Timber Spring Court, Cupertino, CA 95014 Acknowledgement of Third Party Software This AppPerfect software contains certain third party software as listed below which are acknowledged here. These are open source software for which you may obtain source and binaries from the URL listed next to the software. q Apache Ant (http://ant.apache.org/) q Apache BCEL Library (http://jakarta.apache.org/bcel/index.html) q Apache Commons Library (http://jakarta.apache.org/commons) q Apache Jakarta ORO (http://jakarta.apache.org/oro/index.html) q Apache Log4J (http://jakarta.apache.org/log4j) q Apache POI Excel Library (http://jakarta.apache.org/poi/index.html) q Apache Struts Framework (http://jakarta.apache.org/struts) q Apache Tomcat JSP/Servlet Engine (http://jakarta.apache.org/tomcat) q Apache Xerces XML Library (http://xml.apache.org/xerces2-j/index.html) q Apache Xalan XML Library (http://xalan.apache.org/) q Direct Web Remoting (http://getahead.org/dwr) q Eclipse.org (http://www.eclipse.org) q Hibernate (http://www.hibernate.org/) q HSQL Database Engine (http://hsqldb.sourceforge.net/) q HTML Parser (http://htmlparser.sourceforge.net)
  • 6. q HtmlUnit (http://htmlunit.sourceforge.net/) q Impression Math Expression Java parser (http://impression.sourceforge.net/) q iText PDF Library (http://sourceforge.net/projects/itext/) q JavaAssist (http://www.jboss.org/products/javassist) q Java Communications API (http://java.sun.com/products/javacomm/) q jregex - regular expressions for Java (http://sourceforge.net/projects/jregex) q JUnit (http://www.junit.org/index.html) q JCraft JSch (http://www.jcraft.com/jsch/index.html) q Quartz Scheduler (http://www.quartzscheduler.org/) q Remote Tea ONC/RPC for Java (http://www.plt.rwth-aachen.de/ks/english/remotetea.html) q Rhino (http://www.mozilla.org/rhino/) q SmsJ SMS library for the Java platform (http://sourceforge.net/projects/smsj/) q Spring Framework (http://www.springframework.org) q StrutsTestCase for JUnit (http://strutstestcase.sourceforge.net/) q Subclipse plug-in for Subversion (http://subclipse.tigris.org/) q Subversion Server (http://subversion.tigris.org/)
  • 7. AppPerfect Load Test Introduction AppPerfect Load Test helps you design and simulate usage traffic which can be used to test your application infrastructure for performance, reliability and scalability. AppPerfect Load Test targets the most commonly used application infrastructure: Web applications and databases. The overwhelming majority of software being developed today is designed to work with a Web- based (HTML) interface. AppPerfect Load Test helps design and simulate HTTP requests (URLs) which can be targeted at your Web application infrastructure (Web server, J2EE AppServer.). The software being developed today predominantly use databases as their data persistence mechanism. AppPerfect Load Test helps you design and simulate database queries (using JDBC) and target most commonly used databases. As server-based, multi-tiered and distributed applications continue to supplant desktop-based applications, it has become increasingly important for software developers to test the entire application infrastructure to ensure it performs within acceptable parameters. Application behavior while serving multiple users often varies drastically from the same application's behavior while serving a single user. This document helps you create the test by creating a Javascript file. Although it is possible to create/edit a test through UI, Scripting support provides user advanced features which are not possible through UI For e.g. writing a user-defined function to perform various actions in between execution of two task(s). Performing custom validations. AppPerfect Load Test provides extensive APIs for processing the DOM tree of the HTML response received after executing a task. User gets a control over execution of the test while it is being replayed. The document is targeted for advanced users having knowledge of JavaScript language and using Java APIs. A script variable "engine" represents the Load Test scripting engine is available in global scope. Need for AppPerfect Load Test Most developers face the following questions when designing a server-based multi-user system: q Do you know the number of concurrent users that your application can safely support? q Will your application scale as more users access it? q Do you know how long it would take a visitor to receive a page? q Do you know the load point where your server crashes? q Is your current hardware sufficient to meet your predicted demand? If no, what additional hardware would you need? AppPerfect Load Test is designed to answer these and other similar questions.
  • 8. AppPerfect Load Test Key Features AppPerfect Load Test offers you a variety of features for easing the burden of load testing and promoting a realistic test environment. q Browser recording: You can use the browser recording facility to create the tests as you would normally work with your application. There is no need to learn any proprietary scripting language. You can then edit and run the test fast and easily. All web browsers are supported for recording, including Internet Explorer, Netscape, Mozilla, and Firefox. q UI based editing of tests: The UI is easy to use and allows you to edit your existing test as well as add new URLs and parameters to the test. You can quickly modify your tests and easily build on the Test Cases as and when additional functionality is added to your products q Central Controller: You can run distribute load on multiple machines and can control the test from one central machine. You can specify number of virtual users each machine should run allowing you to control your test better. At the end of execution application will present the result of entire test as well as individual machines in the results. q Scripting Support: For advanced user AppPerfect Load Test provides scripting language support. The scripting language used is simple java script, users can view/edit the test using script editor provided. Users can customize a test as much as they want using java script. q Parameterized Tests: In real world scenario, for any Web-based application, the pages that are requested are not all static. In fact, most of the pages accept some parameters as input and then correspondingly show the appropriate customized content. Parameterized tests feed these parameters automatically to the request and thus help simulate a more realistic usage environment. q Five different run strategies supported: AppPerfect Load Test supports five different types of strategies, that help you determine the breaking point of your application, and how it recovers after being stressed to some level. Each of the strategies determines how the URLs are fired and what is the load applied on the server being tested. q Response Validation: You can validate the responses received for a URL request with the AppPerfect Load Test. You can customize what constitutes a valid or invalid response for an URL request. Response codes can be included to constitute valid or erroneous responses. q Support for basic authentication, cookies, SSL: With the AppPerfect Load Test, you can test URLs that require basic authentication as well as those using HTTPS by allowing the configuration of the SSL Provider. It also handles the sending of cookies with the appropriate requests and supports URL rewriting if your application uses it. Two way SSL authentication is also supported. q Support for Browser Simulation, Network bandwidth and IP addresses: With the AppPerfect Load Test, you can test simulate virtual user behave as browser. Browser simulation for Internet Explorer and Firefox is supported currently. You can limit bandwidth of virtual user for various speeds as 56K to unlimited. You can also configure to run each virtual user from a different IP address. q Importing of tests: AppPerfect Load Test can import a test that has been created using the AppPerfect Functional Tester. This makes it easy for a user to create a test instead of replicating the effort of creating a test, the test can be imported and a load test generated for the URLs in that test.
  • 9. q Informative reports and Custom report designer: The application provides reports that help you pin point failure points of the test. These reports are available through the UI and can be exported into 3 different formats: HTML, PDF and CSV. In addition, Test Status Reports help you monitor the progress of the test as it executes. Load Test also provides a utility called Analytics which is basically a custom report designer to help user design their own custom reports. Product comes with lot of system reports defined in Analytics to help user understand how they can design their own reports. q Trend Analysis: AppPerfect Load Test provides a utility called Trend Analytics to generate trend reports for load testing of your application. This utility takes multiple result files and generates trend charts and reports based on the data found. q Scheduling of tests: You can schedule your tests with the AppPerfect Load Test. You do not have to be physically present to start the test. The whole process is automated so you can schedule a test to run in the night and have a look at the results the next day and then correct any errors found by the test. q Notification of results: You can configure AppPerfect project to notify results using Email or custom notification mechanism. In case of Email notification you can specify whether you want results as attachement and AppPerfect will export the results as HTML file and send the same as attachement with the mail. q IDE Integration: AppPerfect Load Test supports IDE integration with most commonly used IDEs. This enhances ease-of-use and productivity. Currently supported IDEs are Eclipse, NetBeans, IntelliJ, JBuilder, JDeveloper and Workshop. q ANT Integration and Command line execution: AppPerfect Load Test supports ANT Integration and command line execution so you can load test your application by invoking product by running ANT script or by running bat/sh file. About AppPerfect Products AppPerfect offers following products for complete and comprehensive solution for testing and monitoring the performance of your application. These products that are designed to help you test your application throughout the development life-cycle. AppPerfect Java Unit Test: AppPerfect Java Unit Test is a feature-rich wrapper for the popular JUnit and HtmlUnit testing frameworks for non-web and web-based Java projects respectively. It provides the Java programmer with an easy to use and fully customizable unit-testing environment, which can be integrated with popular Java IDEs as well as the project's build process. AppPerfect Java Code Test: AppPerfect Java Code Test reads your software code and analyzes it for optimization, errors, coding conventions, complexity and style based on industry-standard rules. Over 750 pre-defined, high-value rules can be applied to your code. AppPerfect Java Code Test is an ideal tool to perform code reviews on an on-going basis to ensure high quality of code. AppPerfect Java Profiler:
  • 10. AppPerfect Java Profiler profiles a Java Virtual Machine to assist you in understanding the behavior of your application as it performs its functions. AppPerfect Java Profiler recognizes that your application does not operate in a vacuum and hence provides a unique blend of Java information combined with operating system information. AppPerfect App Test: AppPerfect App Test performs regression and functional testing of your Windows/Desktop applications. Performing manual functional testing by having a person sit and manually click away at the application is extremely expensive and error-prone. AppPerfect App Test provides the means to perform such labor-intensive activity in an automated manner. AppPerfect Web Test: AppPerfect Web Test performs regression and functional testing of your Web applications. Performing manual functional testing by having a person sit and manually click away at the application is extremely expensive and error-prone. AppPerfect Web Test provides the means to perform such labor-intensive activity in an automated manner. AppPerfect Load Test: AppPerfect Load Test is a stress/load testing tool that can simulate hundreds of virtual users from a single machine. Features supported include site recording, dynamic variable substitution, cookies support, session tracking, SSL support and run strategies. It can run tests based on a variety of strategies such as burst, incremental, exponential, quadratic or loop. It also provides you a comprehensive solution to monitor various attributes of various operating systems present in your application infrastructure. AppPerfect Test Manager: The AppPerfect Test Manager is central server with a Web-based UI for accessing various modules in the server. AppPerfect Test Manager consists of five main modules: Requirements Manager: This module is used to create requirement specifications around which your tests will be designed and executed. Functional, business, performance, technical and usability requirements should be defined here to ensure the tests cover all defined criteria. Test Manager: Once tests have been designed, the Test Manager can be used to manage the execution of your tests. Automatically running tests on a specific schedule, notification of test results, saving of test results, etc. can be defined in this module. Results Manager: Once results for your various tests have run a few iterations, the Results Manager can be used to manage the archived results. Trend Analysis of multiple results to detect key quality trends is a key feature of this module. Storage management can also be performed via this module.
  • 11. Issues Manager: As tests are run, issues such as defects, enhancements, modifications, etc. will occur. This module can be used to create and track such issues. This module is designed as a light- weight issues manager that seamlessly integrates with the rest of the server and is not intended to replace full-featured issues management system. License Manager: Floating/site licenses are managed using this module. This module acts as the central manager for issuing and reclaiming floating licenses for the AppPerfect products. AppPerfect Agentless Monitor: The AppPerfect Agentless Monitor is an agentless, Web-based monitoring solution. It helps you monitor your applications and the underlying system resources. The AppPerfect Agentless Monitor consists of: AppPerfect Monitor: A pure Web-based solution that helps you monitor your application infrastructure. Provides a rules engine to define alerts: a notification server for email and SMS notifications. Also includes a powerful report designer to create custom reports to analyze and understand the performance data. AppPerfect Monitors: A series of modules designed to support specific devices. AppPerfect Monitor does not use the traditional agents-based approach to monitoring. Apart from being expensive, agents-based approach is also highly complex and error-prone. AppPerfect Monitors are designed to impose negligible overhead on the monitored system. These monitors are superbly optimized programs providing the maximum amount of information while imposing the lowest possible overhead. Currently, the following devices are supported: q Java/J2EE App Servers (Tomcat, WebLogic, WebSphere, etc.) q Operating Systems Resources (Windows, Linux, Mac OS X) q Databases (Oracle, MySQL, MS SQL, DB2, Sybase) q Web Servers (Apache HTTP Server, MS IIS) q SNMP Monitors (v1 and v2) q Ping Monitor (Device heartbeat monitor) q Mail Server (MS Exchange) About AppPerfect Corporation AppPerfect Corporation is an independent software development company dedicated to providing the developer community with the best-in-class tools throughout the entire software life-cycle. Our aim is to be your primary vendor for most of your development- and deployment-tool needs. Our mission is to help you reduce your software development costs, increase your productivity and help improve the availability and scalability of your applications. Please visit us on the Web at www. AppPerfect.com for more information.
  • 12. Getting Started This chapter covers information relating to the minimum system requirements, getting product support, starting the AppPerfect Load Test, selecting the type of project to be created and overview of how to access the documentation provided with the AppPerfect Load Test and also how to access Help while using the AppPerfect Load Test. Minimum System Requirements Minimum system requirements for installing AppPerfect Load Test products are listed below: System Parameter Requirement Operating System Microsoft Windows 2000/XP/2003, Linux x86, Mac OSX RAM 512 MB CPU 1 GHz Disk Space 130 MB NOTE: The preferred screen area or resolution for the AppPerfect products is 1024 x 768 pixels. Startup Instructions You can start the AppPerfect Load Test in any of the following ways: For Windows Shortcut: Follow this path: Start -> Programs -> AppPerfect Load Test x.x.x -> AppPerfect Load Test Installation Folder: Follow these steps: 1. You have to browse to the location where you have installed AppPerfect Load Test 2. From the %LoadTest%eclipse folder, run LoadTest.exe Once AppPerfect Load Test starts up, click AppPerfect Load Test icon. For Other Operating Systems Shortcut:
  • 13. 1. In the path provided while installing, you can see the AppPerfect_LoadTest_x.x.x shortcuts folder. 2. An executable link file: AppPerfect_LoadTest_x.x.x is provided there. Run it. Installation Folder: 1. Go to AppPerfect Load Test home folder 2. Run the file $LoadTest/eclipse/LoadTest Inside AppPerfect Load Test You can read a brief overview of AppPerfect Load Test in the Welcome screen. Now you can start using AppPerfect Load Test to test your JSP/database based web applications. Supported Products AppPerfect Load Test supports : Products Category Products Supported Operating Systems Microsoft Windows 2000/XP/2003, Linux x86, Mac OSX Browsers Microsoft Internet Explorer 5.x or higher, Mozilla Firefox, Safari, Google Chrome, Opera Databases All databases that have JDBC drivers and support JDBC specifications Apache Tomcat 4.x/5.x; BEA WebLogic 7.x/8.x/9.x; IBM WebSphere 5.x/6.x; JBoss 3.x/4.x; AppServers Macromedia JRun 4x, Resin2.x/3.x, Orion 2.x, OracleAS 10g, Jetty4.x/5.x, SunOne 7.x/8.x Web Servers Apache HTTP Server 1.3.x/2.0.x, Microsoft IIS 5.0/6.0 Eclipse 2.1.x/3.0, NetBeans 4.0/4.1/5.0, IBM WSAD 5.1.x, IBM RAD 6.0, IntelliJ IDE 3.0.5/4.0/4.5/5.0, JBuilder 9.x/10.x/2005/2007, JDeveloper 9.x/10.x Using the Documentation Help can be invoked from anywhere in the application by pressing F1. To view the Table of Contents after context sensitive help has been brought up, scroll to the top of the page and click Show link. This will bring up the contents in a frame on the left. Alternatively, the Table of Contents in the Help menu. If you want to go through the entire documentation or search for a specific topic, then perform any of the following actions: Using the shortcut: Click Start point to Programs> AppPerfect Load Test x.x.x>Documentation and Examples in Windows, or go to /AppPerfect_LoadTest_x.x.x/Documentation and Examples in Linux. You can reach to a specific topic, by finding it in the contents (Table of Contents) in the left-hand-side frame. The documentation is also available in PDF format online and can be accessed as follows: Using the shortcut: Click Start ->Programs -> AppPerfect Load Test x.x.x -> Documentation and Examples > Print Manuals in Windows or /AppPerfect_LoadTest_x.x.x/Documentation and Examples/Print Manuals in Linux.
  • 14. To start with, it is recommended that you read through all the topics following the sequence of the contents for a better understanding of the product and the features it provides. Glossary provides explainations of commonly used terms in AppPerfect Load Test. Getting Product Support If you need additional assistance with our products, please contact AppPerfect at the email address specific to your query: Sales: sales@AppPerfect.com Support: support@AppPerfect.com Online Technical Support (FAQs, Tips, Tutorials, Docs): AppPerfect Load Test Comments and suggestions The AppPerfect Development Group welcomes and appreciates your comments and suggestions. Please send all comments/suggestions at our direct email address at: feedback@AppPerfect.com
  • 15. Creating a New Project To create a new project in AppPerfect products, follow these steps: 1. Start the desired AppPerfect Product. 2. Once the product starts. Click File -> New... AppPerfect uses a project dialog for AppPerfect Web Test, AppPerfect Load Test and AppPerfect App Test products. Once a project is defined, you need to specify certain values related to the specific product (Web Test, Load Test and App Test) for which you are creating the project. Listed below are the various properties which can be set using new project dialog. Project The 'Project' panel requests information regarding your project's name and its location on your system. By Default, all the projects are stored in the 'workspace' folder of the AppPerfect installation directory. NOTE: If you provide a project name that already exists, AppPerfect will over-write the contents of the existing project's folder. Notification Settings AppPerfect can send you customized notifications of your test results. This feature is very useful in cases where you want to schedule AppPerfect to run tests and do not want to wait for the results. For example, you can receive the results in your mailbox with (optional) HTML reports attached. You can choose to be notified on test completion or only if the test fails. The following settings are required for the Notifications feature: 1. Send Notification on: Project completion or Project failure, as is your requirement. 2. Notification Message: Click the button to create your own customized notification message using the variables relevant to your AppPerfect product. 3. Email / Custom Notification Settings: Provide the required email or custom notification settings where you want application to send notification. NOTE: If you opt for Notifications you must configure notification settings in AppPerfect Test Manager application and you must configure Test Manager information in tools > Options > Server Connections dialog in AppPerfect product, otherwise, the Notifications feature will not work.
  • 16. Project Properties Once a new project is defined using the New Project wizard, certain additional settings specific to Load Test are needed to configure and run your test. This dialog box can also be accessed from the menu: Project -> Properties Editor... These are the tabs: q Run Settings q Machine Settings q Other Settings q Response Validation q Database Settings q Advanced Settings Run Settings Run Duration You can specify the length of the test in terms of either time duration or number of hits. A 'hit' is defined as one complete request/response cycle. You can define the hit count either on a per user basis or as an aggregate value for the entire test. The minimum value necessary for a time-based test is 1 minute and the maximum you can test for is 9,999 days. The minimum value necessary for a hits-based test is 1 hit and the maximum you can test for is 999,999,999 hits. NOTE: For a Time-based test, please note that all the tasks in the Ending Group will be mandatorily executed. The Ending Group may contain tasks that will clean up your database, perform log out operations etc. Therefore, it is a possibility that for run duration specified in terms of time, there will be a slight over-run as the tasks which are in the Ending Group are performed. Generally, for a hits-based test, you would use a large number of hits and then check how much time the specified virtual users will take to hit your application the specified number of time. If you have specified many virtual users (say 100) and few hits (say 20), then your project will over-run the hit count specified as each user will be performing the tasks at least once. Load Strategy A number of execution strategies are supported to execute your test. Each strategy and its behavior is described in the dialog box. 1. Burst: To test application for sudden loads.
  • 17. 2. Loop: To test application for sequential load a fixed number of times. 3. Incremental: To test application to reach its breaking point when the load increases gradually. . 4. Exponential: Also used to test the application to reach its breaking point. But here, the load increases in leaps. 5. Quadratic: To test application's recovery from a period of increasing loads. 6. Cyclic: To test application's with cyclic load. Detailed descriptions for Load Strategies are provided in the Load Strategies chapter. Machine Settings Run project simultaneously on multiple machines Some times you will like to distribute the load over multiple machines. AppPerfect allows you to install product on multiple machines and then start project on all machines simultaneously. Select this option in case you need to execute test on multiple machines simultaneously. This way you can run load test from multiple machines and can control the load test from one central machine. At the end of execution application will present the load testing result of entire load test as well as individual machines. This requires AppPerfect Load Test to be installed on all remote machines and should have the AppPerfect product service running on remote machines. AppPerfect product service is installed and started automatically on all the machines wherever product is installed. This service by default runs on port 8874 and can be accessed as http://HOST_NAME:8874/ APPLoadTest. You need to configure the remote machine service settings by adding new remote machine for each remote machine where you need to execute the project Perform System Monitoring during test execution If you want to monitor system resources of Web or Application server you should select this option. You can configure the target machines settings here. Operating System: Select the operating system of the machine AppPerfect should monitor. Supported operating systems are Windows 2000/XP/2003, Linux x86, MAC OS X. Host Name/IP Address: Specify host name or IP Address of the machine AppPerfect should monitor. Additional properties of the machine needs to be specified. These properties are specific to operating system. Windows 2000/XP/2003: q User Name: Name of the user having Administrative privileges. q Password: Password of the user having Administrative privileges whose name has been specified in User Name.
  • 18. Linux x86 / MAC OS X: q Protocol: Select the protocol that should be used to get the machine's data. AppPerfect supports Telnet, SSH and Rstat. Rstat protocol provides less information than other two protocols, hence it should be selected only if Telnet & SSH are not available. q Port: Specify the port on which the selected Protocol's service is running. By default, Telnet service runs on 23 port, SSH service runs on 22 port. Default port for Rstat is zero. q User Name: Name of the user having permission to use the services provided by the selected protocol. q Password: Password of the user having permission to use the services provided by the selected protocol, whose name has been specified in User Name. Use Service: Remote machine are monitored in an agentless architecture i.e. AppPerfect doesn't interact any of its agents running on the remote machine to monitor the remote machine. In order to monitor a remote machine using agentless architecture, it requires some additional settings for e.g. On Linux x86 operating system, user should have either Telnet or SSH packages installed and should also have rights to use the same. It may not be possible for some users have such additional settings configured on his machine. It is still possible to montior the machine by installing AppPerfect LoadTest on that machine. AppPerfect LoadTest internally runs a service APPLoadTest which will interact with host machine to provide the data. q LoadTest Service URL: If you wish to use service for fetching the machine data, specify the host, port and service details on which LoadTest is running its service. By default, APPLoadTest service runs on port 8874 so the service URL will be of form http:// HOST_NAME:8874/APPLoadTest. Other Settings These settings define other properties related to the test. Save Successful Response Details: While AppPerfect keeps track of basic response information such as response code and response time, it does not save the complete/raw response as that imposes a significant overhead to the system. However, if your testing requires you to save the complete response, select this checkbox. Failed responses are automatically saved. Stop execution of test if number of failed task count exceeds: Specify the maximum number of tasks that can fail before the entire test execution is stopped. You can specify this maximum count either for an individual virtual user or for the entire test as an aggregate value. Retry on failure: On occasion, you may expect that there will be momentary unavailability of your application. If you anticipate such cases, you can specify AppPerfect to retry the request. q Number of times to Retry: AppPerfect will re-try the request for the number of times specified
  • 19. q Retry delay: Specify a time duration for which AppPerfect must wait after the timeout before re-sending the request again Collect top(n) tasks taking maximum response time: The default value provided is 10 tasks. You can change this to view more tasks that take high . You will be able to see an additional node 'Top Tasks' and see the tasks there that take the maximum time to provide responses. Collect first(n) failed tasks details: The default value provided is 25 tasks. Use this option to save failed tasks details for first N failed tasks. You will be able to see an additional node 'Failed Tasks' and see the first N tasks there that failed. Treat Timed-out tasks as failed tasks: This is usually the case and this option is enabled by default. q Timeout: Specify the duration, in seconds, that AppPerfect should wait for a response before canceling the request and timing out. Save all Task details to a CSV file: While AppPerfect keeps track of basic response information such as response code and response time, it does not save the complete/raw response as that imposes a significant overhead to the system. However, if your testing requires you to save the task details to some CSV file you can select this checkbox. Record Think Time: Under a normal usage scenario, it is assumed that once a page is downloaded (request is completed), the user will take some amount of time digesting the information. The amount of time it takes a user to digest the information before clicking on any other link on the page is called "Think Time". AppPerfect can either record the actual think time that was used when recording the test, or use a default fixed think time value for all URLs, irrespective of the think time taken while recording. Ignore Think Time during replaying: On occasion, you may want to run test with/without think time to see how it reacts, in such cases, you can use this option. Resolve subtasks automatically while recording: By default application tries to resolve all subtasks in the page like images/css/js automatically during recording and record them as subtasks of the Main task. You can disable this subtask resolution by unchecking the checkbox here, doing so will result in recording each image/js/css as main task in the test. Response time and throughput unit: You can configure the unit application should use to calculate response time and throughput. Response time will be calculated in either Milli seconds or seconds as per the selection. Throughput will be calculated in either Kilobytes or Mega Bytes as per the selection. Execute complete ActionGroup even if duration of test has completed: During execution its quite possible that when test duration is over, ActionGroup is in its middle of execution. You can select this option in case you want ActionGroup to complete its execution even if duration of test has completed.
  • 20. Close HTTP connection after each iteration: By default application reuse the HTTP connection created during previous iteration. You can select this option to close the connection after each iteration and create new connection for successive iteration. Response time range: Here you can specify that if during execution response time of the task is outside of the range specified then should application ignore the hit or should replace the response time for that task with the range specified. Response Validation While AppPerfect calculates success or failure of a request based on basic response information such as response code and response time, but some times its not sufficient. Like if your application is handling the error conditions and returns error page with response code of 200 then AppPerfect will declare that as successful request but in actual its a failed case. To overcome this AppPerfect provides option to validate the response received. You can specify a text or word to look for in the response and based on that whether to declare request as success or failure. Database Settings AppPerfect can load test a Web application or a Database. In order to load test Database it needs connection information about database (Tools -> Options -> Browsers, JDKs & DBs), whether to use connection pool etc. You can provide required information about database here. Advanced Settings Browser Simulation Settings Here you can provide two types of settings: Browser Simulation: Select the browser whose behaviour you wish to simulate. You can set the percentage of users that will be simulated for Internet Explorer and Mozilla Firefox. Also decide whether you want to clear the browser cache after each iteration. This will affect the response time from your application. Network Bandwidth: Select the bandwidth settings you wish to simulate. By default 'throttling' is not applied to the test. If you want to limit the requests fired according to the bandwidth, then you can select the check box 'Throttle test based on Network Bandwidth'. You can then select the bandwidth settings. Default values provided are 56Kbps, 256 Kbps, 1Mps(1024Kbps) and 2Mbps(2048Kbps). If you choose 'Maximum bandwidth' then the maximum available bandwidth will be used per user. You can also choose 'Custom bandwidth' and provide custom per user bandwidth settings. IP Address Settings If you want to test the load balancing feature of your app server, you can do so by providing a list of valid IP addresses here. Please note the following:
  • 21. q Since you need to modify your computer's network configuration to be able to use this feature, please make sure you have consulted your network / system administrator regarding the same. q A typical set up for firing test requests using multiple IP addresses will be a LAN where only private IP addresses are assigned. q Hence, you will be able to add only valid private IP addresses here q Furthermore, the IP addresses that will be added here must be configured on the system from where the requests will be fired: this is the machine running the AppPerfect Load Test. q So to be able to use this feature, all the IP addresses that you add here, must provide valid connections on the system running AppPerfect Load Test. You can configure multiple IP addresses in the following ways for different Operating Systems: NOTE: Please note that it is not possible to use use IP addresses from a DHCP server. IP addresses have to be specified manually for the system. Windows: 1. Right click on Network Connections or My Network Places. Select Properties. 2. From the list, select the network interface for LAN. It is typically named as Local Area Connection 3. Right click on it and select Properties. You will get a properties dialog. 4. From the checkbox list of items this connection uses, select Internet Protocol (TCP/IP). Click Properties button below the list. 5. You will get an Internet Protocol (TCP/IP) properties dialog box. Select the Advanced... button. 6. In the IP Settings tab, you will see the list of IP addresses assigned to your computer. 7. Select Add... button to add more IP addresses to your computer. 8. Add a valid IP address such that your computer is accessible through this IP address on the LAN. It should not conflict with IP address of any other machine on the same network. Consult your system administrator for more details Linux / Unix To create a virtual network interface, you need to provide an additional parameter with the ifconfig command. ifconfig interface add new_ip_address netmask 0xffffffff broadcast xxx.xxx.xxx.255 An example is given below with the additional parameter highlighted. [root@test root]# ifconfig eth0 add 192.168.0.1 netmask 0xffffffff broadcast 192.168.0.255
  • 22. <Enter> You can add multiple interfaces in similar manner. For instance: [root@test root]# ifconfig eth0 add 192.168.0.2 netmask 0xffffffff broadcast 192.168.0.255 <Enter> You can check how these interfaces are implemented by using the ifconfig command without any parameters. [root@test root]# ifconfig <Enter> eth0 Link encap:Ethernet HWaddr 00:50:BF:51:9D:FE inet addr:192.168.0.100 Bcast:192.168.0.255 Mask:255.255.255.0 UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:49875 errors:0 dropped:0 overruns:0 frame:0 TX packets:334288 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:100 RX bytes:91873498 (12.2 Mb) TX bytes:31234567 (8.1 Mb) Interrupt:10 Base address:0xdc00 Memory:ef111000-ef121100 eth0:0 Link encap:Ethernet HWaddr 00:50:BF:51:9D:FE inet addr:192.168.0.1 Bcast:192.168.0.255 Mask:255.255.255.0 UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:0 errors:0 dropped:0 overruns:0 frame:0 TX packets:0 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:100 RX bytes:0 (0.0 b) TX bytes:0 (0.0 b) Interrupt:10 Base address:0xdc00 Memory:ef201000-ef201038 eth0:1 Link encap:Ethernet HWaddr 00:50:BF:51:9D:FE inet addr:192.168.0.2 Bcast:192.168.0.255 Mask:255.255.255.0 UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:0 errors:0 dropped:0 overruns:0 frame:0 TX packets:0 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:100 RX bytes:0 (0.0 b) TX bytes:0 (0.0 b) Interrupt:10 Base address:0xdc00 Memory:ef201000-ef201038 You can get more information about ifconfig command here: Linux IP Alias mini-HOWTO Mac OSX: 1. Open System Preferences dialog and click on Network in the dialog. 2. In the Network configuration dialog, click on "+" to add another configuration. Select current
  • 23. interface used to connect to internet like "Ethernet" or "AirPort" from the drop down and provide a new service name. 3. Selected the newly added configuration and select "Manually" from the Configure drop down dialog. 4. Provide required information like IP address, Subnet Mask, Router etc. and click on Apply. 5. If all settings are provided correctly you should see connected for newly added configuration. 6. Add as many IP addresses as you want. In Load Test Project properties dialog, Select Advanced Properties tab. IP Addresses is the last section in this tab. This option allows you to test multiple application servers to which requests are forwarded based on the IP address range. Select the check box and select Add button. Enter all the IP addresses which should be assigned to virtual users during execution of the test. Note: Once configured, you can view details of which requests came from which IP address by selecting the option 'Log Requests fired' in Tools->Options->Log Settings. This option allows you to test multiple application servers to which requests are forwarded based on the IP address range. Additional Load Test Properties In addition to the above, there are a few other properties specific to the Load Test that can optionally be set through Tools -> Options... -> Load Test
  • 24. System Configuration The Tools -> Options dialog box lets you specify a number of important properties to control Web Test behavior. Properties configured here are applied to all the projects in the test. Following is a description of the various tabs and properties found in them. q AppPerfect q Browsers, JDKs & DBs q Custom Certificates q Custom Script Settings q Load Test q Licenses q Log Settings q Proxy Settings q Server Connection AppPerfect General Number of Recent Project Files: Specify the number of project files to show in the most recently used menu list. The default is 5. Number of Recent Result Files: Specify the number of result files to show in the most Recently used menu list. The default is 5. Screen Refresh Interval(sec): Here you can specify the time interval after which the Status views should be refreshed during load test execution. Application updates the status charts after every refresh interval provided here. Highlight Row/node on mouse over:This setting is for highlighting the current row you are browsing or the current node you are visiting in AppPerfect product. Save Result: Define your results-save strategy here. You can configure to save result for each project run automatically or to save just last run of the project. Default value is to not save result automatically. User Name: Shows the name of the user configured in AppPerfect Test Manager. Multiple users can be configured with AppPerfect Test Manager and each client AppPerfect product can use unique user name to submit results/ projects to Test Manager. This user name is used as identifier and is helpful in generating user based reports in Test Manager. In case connection to Test
  • 25. Manager is not configured Or if there is only single user configured in Test Manager then this field is un-editable. Garbage Collector Settings To control the memory usage of application during execution you can configure Garbage collector settings here. AppPerfect takes care of forcing the garbage collection once the specified limit is reached. You can also configure how often AppPerfect should check for memory consumption. Font Settings You can set your own font for AppPerfect Load Test. Update Schedule Application can be configured to check for new updates/release of the AppPerfect product. On finding one application notifies the user about the availability of same. Keeping this feature enabled ensures that you are using latest version of the product. Browsers, JDKs & DBs Browser Settings AppPerfect supports recording of test on multiple browsers including Internet Explorer, Firefox and Safari Here you can configure browser which application should use to perform recording. The one selected as default is used for recording of the test. AppPerfect also uses the browser configured here to open Help files and exported results/reports. You should have proper browser configured for application to work correctly. JDK Settings Specify your JDK's name and path here. AppPerfect will use the default JDK specified at the time of installation. You may want to use other JDKs for your applications and those can be defined and used from here. DB Connections You can configure Database related properties like Database name, Connection URL, JDBC driver, User Name, password etc. here. This is useful in case you need to fetch values from database to parameterize your test. Database configuration is also required in case you need to add Database validation in test or in case you need to Load Test Database. Custom Certificates In case your application uses a custom SSL certificate (i.e. certificate not provided by Verisign or
  • 26. Thawte), then either you need to make that custom certificate trusted by the JVM running AppPerfect product or you may select the option to "Accept Self-signed or untrusted custom SSL certificates." To make the custom certificate trusted by the JVM running AppPerfect product, you need to add the SSL certificate here. AppPerfect uses this certificate when running your test. Certificates provided by Verisign or Thawte are automatically trusted by the "trust file" within the JVM. All other certificates are considered custom SSL certificates. If you are using a Custom certificate, you will need to import that certificate into AppPerfect. In case you don't have the certificate file, open your HTTPS link in a browser and then click on the "lock" icon. This will pop up a dialog box with "Certificate" title & General tab selected. Go to Details tab and select "Copy to File..." option. Proceed with the wizard. On Export file format select "Base-64 encoded..." radio button. Save it to some temporary location and import this certificate file. Please note that you will be required to restart AppPerfect product after registering custom certificate. Custom Script Settings AppPerfect uses javascript as its scripting language. You can add your own custom code to the recorded test script.To use any custom classes in the script files you should configure the classpath of those custom classes here. You can provide the path for either the zip/jar file or can provide the path for the folder containing the custom classes. Load Test General Details Use Cookies: You can choose to disable cookies for your Load Tester tests by de-selecting the checkbox. Decode Post Parameters: Select this option in case you want application to decode the post parameters before sending request to the server during execution. Decode Request Headers: Select this option in case you want application to decode the request headers before sending request to the server during execution. Decode Get/Post Parameters while recording: Select this option in case you want application to decode the get/post parameters during recording. Compare response code with recorded response code to identify whether the task is successful or failed: Select this option in case you want application to compare recorded response code with replayed response code while finding task's execution status. Data Consolidation count: To show charts in the results, By default application consolidates data after recording every 32 values while collecting statistics. You can configure the consolidation count here after which the data consolidation should be performed.
  • 27. Remote Server port : Here you can provide the port which should be used for collecting execution results from remote machine during Remote execution of projects. By default the port used is 8669, in case this port is not free and is in use by some other application, you should change the port here to use some free port. Save failed response data on disk: Select this option in case you want application to save failed responses on disk. Save header, parameter details for failed tasks: Select this option in case you want application to save headers and parameters details for failed tasks. Save sub tasks details for failed tasks: Select this option in case you want application to save sub tasks details for failed tasks. Save failed response data on disk: Select this option in case you want application to save failed responses on disk. Filter Settings: If while recording, you want to filter out certain patterns, then you can add them here. Separate the patterns using commas. If the list of patterns to include is smaller than the list of patterns to exclude, then you can provide the 'include' pattern and vice versa. For instance, if you want to record only '.html' files and no other like '.gif' or '.jpeg' etc.. then just provide '.html' in the 'Patterns to Include' field. Response Codes What you see here by default is the list of the standard HTTP Response Codes and their description which the user will see. You can decide the behavior of these response codes here using the checkbox 'Treat as Success'. SubTask Extensions While recording subtasks in the test, application check for the extension of the task. You can configure the task extensions here which should be marked as subtasks during recording. PassThrough Resolution - Extensions In case a parameter is a passthough parameter then application parses the response of previous tasks to find the value of that passthrough parameter. Here you can configure the extensions of the tasks which should be considered for parsing for resolving the values of passthrough type parameters. You can also add your own response codes for specific testing. Licenses
  • 28. License related settings are done here. You can configure license for either single client machine or can configure the product to pick the license from Floating license server in case you have purchased Floating license. Floating licenses are managed using License Manager in AppPerfect Test Manager. Log Settings AppPerfect maintains logs of fatal exceptions for all the products. You can change this setting here to log all messages. This option is very useful for debugging purposes. It is recommended that you use this feature in case you are facing any issues with the product and send us the log files. By default log files are saved at: <AppPerfect_Home>/logs. You can configure to change the log path and save logs at different location. Application can also log the values from the test script. For each log statement in test script you will find output getting logged in script_log.txt. The script log can be used to check the values getting used during parameterized test. Select the checkbox 'Log Requests Fired' if you want to log each request fired in AppPerfect Load Test. This is useful for checking various details about the requests like the User Agent, IP Address etc. All the requests will be saved to requests.txt file under <AppPerfect_Home>/logs folder. Proxy Settings General Settings To record Load Test with browser application uses Proxy Recording. AppPerfect Proxy Server Settings AppPerfect starts its local proxy server and sets same in target browser. By default Application uses localhost and port 8690 to start the local proxy server. In case default port is in use by some other application you can change it to some other value here. AppPerfect can automatically launch and configure proxy settings in your web browser wherever possible. If you want to do that yourself, deselect the checkbox 'Automatically launch and configure browser for recording.' Target Proxy Server Settings These settings are required if you do not have a direct connection to the Internet and you normally use a proxy server to access your application. The browser's current proxy settings have to be specified here. By default AppPerfect assumes a direct connection to the Internet. Filter Settings These settings are required in case of Proxy Recording. All the patterns which are marked as excluded here are not recorded while recording. Application by default adds common update
  • 29. services installed on machine which are not part of your application and these requests should be dropped while recording tests. You can extend this list to add more patterns which you would like to exclude during recording. Server Connection Test Manager Settings AppPerfect Test Manager settings are done here. AppPerfect Test Manager provides functionality of requirement, project, results and issues management. It allows to schedule various project executions, view results, export them to various formats, add/manage test requirements and add/ manage issues in the product. AppPerfect Test Manager by default runs on port 8744 and can be accessed as http://HOST_NAME:8744/APPTestManager. Product's Service Settings Product related service settings are configured here. Each Load Test product also installs a product service which listens to requests from other Load Test product installations on remote machines while performing remote execution. This service by default runs on port 8874 and can be accessed as http://HOST_NAME:8874/APPLoadTest Repository Settings AppPerfect Repository Settings is required to share AppPerfect projects across the team. AppPerfect provides support for Subversion(SVN) server for sharing projects across team. AppPerfect Repository server by default runs on port 8747 and can be accessed as svn:// HOST_NAME:8747/AppRepository in case repository is created with "AppRepository" as the root folder. For complete details on configuration of Team or Repository Server refer to Team Server Configuration
  • 30. Proxy Recording AppPerfect starts a local proxy server at localhost:8690 by default and sets the same in browser. For proxy recording to work properly you should have default port 8690 free for use and also confirm that firewall is not blocking that port. Once recording is over AppPerfect takes care of changing the connection settings back to normal. Automatic proxy setting is supported for Internet Explorer, Mozilla Firefox and Safari browser on Windows. For Safari browser on MAC OSx you need to configure the proxy manually. Refer to Manual Proxy Configuration for more details on this. In case your application already uses a proxy you need to configure same at Tools -> Options -> Proxy Settings -> Target Proxy Server Settings. Each request from browser is passed to the local proxy server which in turn sends the same to the target proxy server or directly to target server in case there is direct connection to internet. The flow is reverse while receiving the response. AppPerfect's local proxy server sits in middle and reads the requests/response sent to and fro between browser and target server. AppPerfect uses Proxy server for recording in following cases : q Recording Load Test / Generating Test Cases with Java Unit Test / Recording memory leak scenarios with Java Profiler q Recording/Replaying Web Test with non IE browsers like Mozilla Firefox Or Apple Safari Recording Load Test / Generating Test Cases with Java Unit Test / Recording memory leak scenarios with Java Profiler While Recording Load Test OR While Generating Test Cases with Java Unit Test for web application OR While recording memory leak scenarios for web application using Java Profiler, application records all the http/https requests sent to target server by browser. Application takes care of recording request details, parameters, headers, response code etc and also saves the response recieved for each request in recorded folder at project location. All the request patterns which are configured at Tools -> Options -> Proxy Settings -> Filter settings are excluded from recording. Application records the requests as Main tasks and sub tasks. All the images/js/css etc in page are recorded as sub tasks of main task. In case you are recording for an Applet application and the applet sends the http requests to target server, then these requests are not passed to proxy by default and hence are not recorded. For applet to send requests to the proxy server,you need to set few System properties (http.proxyHost, http.proxyPort, http.proxySet) in your applet application. The http.proxyHost should be set to "localhost", http.proxyPort should be set to 8690 and http.proxySet should be set to true, so that applets sends the http request to local proxy server started by AppPerfect. Recording/Replaying Web Test with non IE browsers like Mozilla Firefox Or Apple Safari In case you are using Internet Explorer for recording/replaying Web Test then AppPerfect does not use proxy. But in case you are using Mozilla Firefox or Apple Safari, AppPerfect needs proxy for recording/replaying Web Test. While recording Web Test for Firefox or Safari or any non-IE browser, local proxy server injects each response with recorder javascript. This recorder javascript takes care of recording the events on web application. Same is true while replaying test with Firefox and Safari
  • 31. where response is injected with replayer javascript. In either case it requires the recorder/replayer javascript to load completely in browser along with the response. In case there are script errors in page or if recorder/replayer script could not load completely in browser, in such cases recording/ replaying will not work properly for non-IE browsers. For recording/replaying Web Test on Non-IE browsers the browsers should have support for javascript. Manual Proxy Configuration Application takes care of configuring Proxy settings automatically for Internet Explorer, Mozilla Firefox, Safari on Windows and Netscape browsers. But for Safari on Mac OSx and for other browsers you need to configure proxy manually. In case you find problems with Automatic proxy configuration then you can try configuring same manually. In case of manual configuration you should de-select "Automatically launch and configure browser for recording" checkbox at Tools -> Options -> Proxy Settings. Once done, you will need to change the settings back to normal while accessing your application outside of AppPerfect. Find below details on manually configuring local proxy settings on Internet Explorer, Firefox and Safari. Configuring Proxy for Internet Explorer q Open Internet Explorer browser and Select Tools -> Internet Options.. menu option. Select the Connections tab and click the LAN Settings button in case you are using LAN for connection to internet. In case you are using Dial-up or VPN you need to click the Settings button under Dial-up and VPN settings. This will launch the proxy server settings dialog. q Select the checkbox to "Use Proxy server..." and Provide proxy server address as localhost and proxy port as 8690. the option "Bypass proxy for local addresses" must be turned OFF q Click on Advanced button and make sure that "Do not use proxy server for..." must not contain localhost/127.0.0.1 or your target server address Configuring Proxy for Mozilla Firefox q Open Firefox browser and Select Tools -> Options menu option. Select the Advanced Tab and then Network Tab in the Options dialog. Click Connection Settings...button. This will launch the Connection settings dialog. q Select the radio button for "Manual Proxy Configuration" and provide proxy server address as localhost and proxy port as 8690. Select the checkbox to "Use this proxy server for all protocols" q The "No proxy for" option must not contain "localhost" or "127.0.0.1" or your target server address Configuring Proxy for Apple Safari on MAC OSX q Go to MAC OSx System Preferences -> Proxy Settings and set proxy settings for HTTP and Secure Web (HTTPS) protocols. Set proxy settings as 127.0.0.1 and 8690 q The "No proxy for" option must not contain "localhost" or "127.0.0.1" or your target server address
  • 32. Building a Web Project AppPerfect Load Test can effectively test your web applications using the HTTP or HTTPS protocols. The steps to create a Web project are as under: 1. Create a new project 2. You can then record the project by clicking Project -> Record test... from the menu bar. Browse through the web application and perform a set of tasks. Then click Project -> Stop or the Stop Recording button on the Record Using Proxy dialog box. (Please see Recording a LoadTest for more details.) 3. Now you have the URLs and tasks recorded which you can view and edit in the Editor tab. 4. The Editor shows you a hierarchical list of the elements of your recorded test which you can further edit: r Project r Parameters r Groups r Task Details Project You can see the following groups on the right hand side after you click the project name in the Editor: Host Settings For each unique host used in the test there is a host setting entry in this table. Each task in the test are linked to the host setting shown in this table. In case you need to execute recorded test against your application on some differnt host you just need to edit the host settings here. You dont need to worry about changing host for each recorded task. Just changing host settings here will result in replaying test against new host. You can edit the Host Name, the Port number and select the protocol between HTTP and HTTPS here. You can also parameterise the host settings to replay test against different hosts during multiple iterations. Group Execution Settings In a project the tasks are stored in logical groups. This enables users to better organize the test. Further,certain special tasks can be placed in special groups called "Starting Group" and "Ending Group" as needed as they are only run once for the test. However, rest of the tasks are placed in regular groups called "Action Groups". Run Groups: A test can have one or more action groups. If you have more than one action group, you can specify if you want a virtual user to run these groups sequentially or simultaneously. In sequential execution, a virtual user executes every task/url in every group. In simultaneous execution, virtual users are assigned individual groups to execute. This assignment is based on a
  • 33. percentage distribution that you can specify from the "Groups table" shown for project node view in Editor tab. Execution Behavior: In addition, you need to specify how Starting and Ending Groups should be handled. Replay Linked projects/groups: For any Automated testing tool one of the important feature is the reusability of the existing scripts. AppPerfect provides the feature of linking existing scripts with the host script so that without re-recording, common functionalites already implemented in existing scripts can be reused. Select this checkbox if you need to replay linked projects/groups. For more details refer to Link Projects chapter. Groups Table: This table lists all the Groups of the project. You can :: q Add a Group : To add new group to the test. q Delete a Group : To delete a group from the test. q Ignore any or all the groups (if you will ignore all the groups, you will not be able to run the test). q Re-order groups : To move groups in the test and change order for their execution. q Define % of Virtual Users for Group Parameters An important aspect of designing a good test is to define parameters correctly. Most modern applications use some kind of parameterization scheme to communicate data between the end user and the Web application. When a LoadTest is recorded via a browser, all parameters that are encountered for the recorded tasks are stored in the test project. These recorded parameters can be managed via the "Parameters" tab in the Test Editor. Additional information about parameterization can be found in the Parameters chapter. Groups The recorded test consists of a number of "Groups". A Group is a logical unit for combining actions inside a test. By default, three Groups are created: Starting Group, Action Group and Ending Group. After recording, all URLs are stored in the "ActionGroup". Depending on your desired behavior, you may wish to move certain URLs into the Starting Group (eg. login URLs) and move other URLs into the Ending Group (e.g. logout URLs). Behavior of the various groups can be configured by clicking the group in the Editor and setting its properties on the right side of the window. To move a URL from one group to another, click right mouse button on the URL, select Cut from the popup menu, click right mouse button on the new group where you wish to paste it, and select Paste from the popup menu. More details are available
  • 34. in the Task Groups chapter. Task Details Click any task in the Editor and you get access to the Task Editing features of AppPerfect Load Test. Task Details You can: q Provide a user friendly name to the task q Select the method of parameterization:Get/Post q Specify a Think Time q Change the startup path for this task q Specify Timeout q Ignore the Task Parameters You will see a list of parameters, if any have been encountered for the selected task. You can select any of the parameters and parameterize it to fetch different value during replaying. Additional information about parameterization can be found in the Parameters chapter. Request Headers You can review all the request headers sent along with http/https task here. Request Entity Request Entity is data sent to server as request body in case of HTTP request. It could be simple text or could be XML data like in case of XMLHTTPRequest (AJAX request). You can parameterize this data by specifying parameter name between '@'..'@'. For example lets say request entity is 'model=A' and we want to parameterize value 'A', to achieve that add parameter to request entity as 'model=@PARAM_A@' and add parameter PARAM_A in the parameters. If you wish to parameterize entire content then change content as '@PARAM_REQUEST@' and add parameter PARAM_REQUEST in the parameters. Sub Tasks In case the task has images/css/js etc. then same are shown as subtasks in this table. Validation As a web application developer or tester, you will design (or test) your application based on a 'valid'
  • 35. set of responses expected from the application. You can set these validations for each web page after you have recorded the test. You can add validations to URL task here. To add new validation right click the desired DOM tree node of the Standard DOM tree you can see above the Validation tab. It will show the following options : q Expand All / Collapse All : To expand/collpase the dom nodes in the tree. q Find... : To search for particular node in the tree q View Source : To view the HTML source of the recorded page. q Change Benchmark Page : To change the path of the stored page q Show Advanced Tree: To view the Advanced DOM tree, which is created using HTML source tree showing all the html elements used in the page. q Show Validations Tree : To view only those nodes which has validation added. This will show nodes only if you have added any validation for the page. q Validate HTML Source : To compare or validate complete HTML source of the page. q Add Validation : If selected node in the DOM tree is a root node then Add validation option can be used to add Page validation. You can also add Attribute validation in case selected node is an element node. q Edit Validation : To edit already existing validation. q Delete Validation : To delete any existing validation q Add Text Validation : To add Text validation, that is to find if a particular text or value is present on the page. Validation supports both cases sensitive and case insensitive search. You can also parameterise the value to find and can also use regular expressions to search. q Add Date Validation : To add Date validation where you can compare the date value present on page against today's date in different formats. q Add Database Query Validation : To add Database Query validation where you can validate if the ResultSet returned as a result of query is empty or not. For furthur details on each validation refer to Validations chapter.
  • 36. Building a Database Project AppPerfect Load Test can be used to load test your database directly. AppPerfect Load Test can generate and fire large number of SQL queries at your database. This enables you to load test the database layer of your application infrastructure in isolation from other layers. Having a smooth and efficient database layer is critical to a healthy and responsive Web application infrastructure. The overall process for creating a database test is as follows: 1. Create a new project 2. Configure Database Settings at Project -> Properties.. 3. Create the necessary queries manually and store them in a file or enter then into AppPerfect Load Test via the editor view provided. 4. Specify query parameters as needed for selection, filtering and sorting. 5. Specify any validation criteria you wish The queries to be fired at the database need to be created manually. Most often this is not an issue since you can obtain those queries from your Web application. Project You can see the following groups on the right hand side after you click the project name in the Editor: Host Settings These fields do not apply to a Database project. Group Settings In a project the tasks are stored in logical groups. This enables users to better organize the test. By default only ActionGroup for "HTTP tasks" is added to the project. To add Database tasks you need to create a new ActionGroup with JDBC type. To do so, right click on Project Node in the Editor tree and select Add Group... option from the popup menu. In the Add Group dialog you need to select the Group type as JDBC for database group. Run Groups: A test can have one or more action groups. If you have more than one action group, you can specify if you want a virtual user to run these groups sequentially or simultaneously. In sequential execution, a virtual user executes every task/url in every group. In simultaneous execution, virtual users are assigned individual groups to execute. This assignment is based on a percentage distribution that you can specify from the "Groups table" shown for project node view in Editor tab. This section lists the Action Groups of the project. You can :
  • 37. q Add a Group q Delete a Group q Ignore any or all the groups (if you will ignore all the groups, you will not be able to run the test). q Re-order groups q Define % of Virtual Users for Group Virtual Users The amount of load to be exerted on your target application by AppPerfect depends on the number of virtual users you specify. In general, higher the number of virtual users, higher the work load. A good way to work with AppPerfect Load Test is to view your test from the point of view of each virtual user. Additional information about virtual users can be found in the Virtual Users chapter. Parameters An important aspect of designing a good test is to define parameters correctly. Additional information about parameterization can be found in the Parameters chapter. Groups The test consists of a number of "Groups". A Group is a logical unit for combining actions inside a test. By default, three Groups are created in a project: Starting Group, Action Group and Ending Group. But all these groups are for HTTP type tasks. For database tasks we need to create a new ActionGroup with type JDBC Behavior of the various groups can be configured by clicking the group in the Editor and setting its properties on the right side of the window. To move a Task from one group to another, click right mouse button on the Task, select Cut from the popup menu, click right mouse button on the new group where you wish to paste it, and select Paste from the popup menu. More details are available in the Task Groups chapter. Task Details q Task Name: Specify a name for the Task. Default is task# where # is the task number in sequence. q Task Parameters: Click the add button to add parameters to your query. q Import Query from file: Browse to the location of your .sql file OR Write query: Use the text box to enter your query
  • 38. Validation This feature is provided so that you can define what constitutes a Successful or a Failed response. If this is not specified, then a basic validation will be performed to the effect that no error code was returned in the response. Criteria: The validation can be performed for two specific criteria, that is Success and Failure selected by using the available drop-down box. Validate Count: Select Yes or No from the drop-down box depending on if you want to validate the row count as specified in the Count field. Match Type: The Any Column or All Columns option can be selected from the drop-down box. If the Any Column option is selected and any one of the column validation is successful then the response is said to be successful. Whereas the response is said to be a failure only if all the column validations are a failure. If the All Columns is selected and all of the column validations are successful the response is deemed to be successful. If any one of the column validation is a failure then the response is said to be a Failure. If you do not want to match type you can select the blank option for the Match Type field. The above explanation is applicable when the Success criteria is selected. Count: This text box is active only when the Yes option is selected from the drop-down box in the Validate Count field. Column Name: This is an editable field where the name of the column in the Database table can be specified. Data Type: Select the String, Number or Date from the drop-down box depending on the data type of the column. Values: The Search for Values dialog opens when the row corresponding to the Values column is clicked. The values are entered in the Enter Values text box and then Add is clicked to add individual values to the list. The selected value from the list can be deleted by clicking Delete. The Add Column and Remove Column buttons are used to add or remove columns from the existing list.
  • 39. Building a Command Line Interface (CLI) Project AppPerfect Load Test can be used to load test your applications started using command line scripts. AppPerfect Load Test can execute large number of command line scripts simultaneously through its virtual users simulation. This enables you to load test your command line applications and check their performance in case of simultaneous execution. AppPerfect also provides the feature to validate the console or file output generated by the command line applications during execution. The overall process for creating a CLI test is as follows: 1. Create a new project 2. Create a new Action Group for CLI type tasks 3. Add the necessary CLI tasks to the CLI ActionGroup manually via the editor view provided. Its fairly easy to add a CLI task, all it requires is a path for command line script and arguments if any. 4. Specify command line script parameters/arguments if any as required by the script for execution 5. Specify any validation criteria you wish to on the console/file output generated during execution of scripts Project You can see the following settings on the right hand side after you click the project name in the Editor: Host Settings These fields do not apply to a CLI project. Link Project Settings Please refer to Linking groups from multiple Projects section for more details on this feature. Group Settings In a project the tasks are stored in logical groups. This enables users to better organize the test. By default only ActionGroup for "HTTP tasks" is added to the project. To add CLI tasks you need to create a new ActionGroup with CLI type. To do so, right click on Project Node in the Editor tree and select Add Group... option from the popup menu. In the Add Group dialog you need to select the Group type as CLI for Command line interface group. Run Groups: A test can have one or more action groups. If you have more than one action group,
  • 40. you can specify if you want a virtual user to run these groups sequentially or simultaneously. In sequential execution, a virtual user executes every task in every group. In simultaneous execution, virtual users are assigned individual groups to execute. This assignment is based on a percentage distribution that you can specify from the "Groups table" shown for project node view in Editor tab. This section lists the Action Groups of the project. You can : q Add a Group q Delete a Group q Ignore any or all the groups (if you will ignore all the groups, you will not be able to run the test). q Re-order groups q Define % of Virtual Users for Group Virtual Users The amount of load to be exerted on your target application by AppPerfect depends on the number of virtual users you specify. In general, higher the number of virtual users, higher the work load. A good way to work with AppPerfect Load Test is to view your test from the point of view of each virtual user. Additional information about virtual users can be found in the Virtual Users chapter. Parameters An important aspect of designing a good test is to define parameters correctly. Additional information about parameterization can be found in the Parameters chapter. Groups The test consists of a number of "Groups". A Group is a logical unit for combining actions inside a test. By default, three Groups are created in a project: Starting Group, Action Group and Ending Group. But all these groups are for HTTP type tasks. For CLI tasks we need to create a new ActionGroup with type CLI Behavior of the various groups can be configured by clicking the group in the Editor and setting its properties on the right side of the window. To move a Task from one group to another, click right mouse button on the Task, select Cut from the popup menu, click right mouse button on the new group where you wish to paste it, and select Paste from the popup menu. More details are available in the Task Groups chapter. Task Details
  • 41. q Task Name: Specify a name for the Task. Default is task# where # is the task number in sequence. q Time Out: In case of high load its possible that script execution takes time to start, in such cases you can specify timeout period so that AppPerfect waits for that amount of time before terminating the execution of task. q Think Time: Specify amount of time each virtual user should wait before execution of this task. You can also configure variable think time for diferent % of virtual users. q Script file: Specify complete path for the command line script or batch file which should be executed. Arguments and Validation Command line Arguments : You can specify command line arguments which should be passed to the script during execution. "Argument Value" is passed to the script as command line argument. "Argument Name" is required only for parameterization. You can parameterize values so that each virtual user runs script file using different value. Validation feature is provided so that you can define what constitutes a Successful or a Failed execution. If this is not specified, then a basic validation will be performed to the effect that no error code was returned as a result of execution. You can validate both the console output as well as the file output from the script execution. You can perform a case sensitive or a case insensitive search for a specified text in the output. You can check both for existence or non existence of a text value in the output. You can also use Regular expression for text comparision.
  • 42. Load Strategies You can create various load testing scenarios for your web application through the Load Strategies provided by the AppPerfect Load Test. Load Strategies can be accessed from Project Properties dialog (Project -> Properties Editor...) in Load Test perspective. There are six load strategies you can choose from. These are selected at the time of setting up the project. You can see graphical and detailed information about them at the Project Properties dialog box. With a combination of Run Duration and Load Strategy, you can create various scenarios for testing the load that your web/database application can bear. You can also use load strategies to indicate the breaking point of your applications. The first two strategies: Burst and Loop work with a constant number of virtual users. The other three strategies are all a variation of the Incremental strategy where the user count increases. Burst: Enter a fixed number of virtual users that will be used to simulate load on your application in bursts of traffic. You can specify the duration in time or number of hits. It's best to use time as the run duration for this strategy though because number of hits may limit the burst-effect for this strategy. Setup: The number of users remains constant. Users will perform the recorded tasks simultaneously at random intervals of time. Loop: Select the fixed number of users that you want should access your website/application and perform the tasks that you have recorded. This will be repeated 'n' number of times where 'n' is the number of loops you provide. This strategy will help you identify consistency in your web/database application's behavior. Setup: The number of users remains constant. The loop count has to be provided. Please note that this strategy does not follow Run Duration in time. The project runs till the loop count. Incremental: Incremental strategy provides a controlled increase in the load to your web application. Setup: You have to provide an initial user value, an increment by user value, an increment by time value and the maximum number of users that should access your web/database application. Exponential:
  • 43. Exponential strategy is similar to incremental strategy except for the speed with which the user load increases. Exponential strategy will show your web/database application's breaking point faster than Incremental strategy. Setup: All settings are same as incremental strategy, only you don't have to provide an increment by value as the user load doubles every increment by time period. Quadratic: Under this strategy, you will get a very realistic load test for your web/database application. It works like Incremental strategy for increasing the load, but like it is most likely to happen in the real world, the load is taken off from the web application. You will be able to see if your application recovers well from peak traffic. Setup: All the same settings are required as for Incremental Strategy. Cyclic: Select Cyclic strategy when you want to test your application with cyclic load on it during the test. Setup: You need to specify the initial Virtual User Count value, an Increment By value, a Interval value (seconds) and a Maximum Virtual Users value. The Virtual User Count is the number of threads that will be created when the test is run In this type of a run, the number of threads specified as the Virtual count value are started and after the specified interval, the number of threads are increased by the value specified for Increment By. Once number of virtual users reach maximum virtual users value then application will start stopping virtual users till it again reaches to initial virtual user Value. From this point onwards once again it will increasing load, this way will test your application with cycles of increasing and decreasing loads.
  • 44. Parameters Parameter are used in most modern applications to communicate data between the user and the application. AppPerfect offers extensive parameter-management. Parameter selection and hence testing with various parameter values is completely automated. Parameter values are passed either via the URL itself or via the event arguments and attributes. In the AppPerfect application, parameters are stored as name-value pairs, making it intuitive for application developers and testers. Then, depending on the number of iterations for your project, multiple parameter values can be tested, with options to select parameters sequentially or randomly. The following types of parameters are supported in AppPerfect Load Test: Runtime parameters Runtime parameters are those parameters whose value can be picked either from a DB or from a CSV file just before the replaying of test or task starts. This way AppPerfect Load Test ensures that it is running the test with most recent values present in either DB or CSV file. You can change the values in DB and CSV file just before running the test in order to test this application with different parameter values. Pass-Through parameters Pass-Through parameters are those whose value will be picked from the response of previous request while replaying the test. You can set pass-through parameters in the Parameters view by selecting the "Pass-Through" from the data source combo box. An example of Passh-through parameter is a session ID. This variable will have a value assigned it to based on some algorithm only at run-time. If you run a test using the stored value of a session ID, your test may not go furhter than login as that session might have expired. For a situation like this, you need to set the 'Pass- through' option for the parameter. Fixed parameters Fixed parameters are those parameters whose values can be entered manually or picked from DB or picked from CSV file while defining the test. AppPerfect Load Test will maintain this hard-coded list of values and will use these values during replaying. In this case each time test is run same set of values will be used. Parameterization Consider a Web application with a login page which takes a user name and a password. You need to test this page to ensure valid users (of various categories) are accepted and invalid users (incorrect user name/password) are rejected. To test this page, what you essentially want to do is connect a series of user names and passwords to the login page. This process of defining multiple values for elements is called Parameterization. While it is possible to manually go to the login page and enter each of the user name/password
  • 45. values and then have the test repeated, often, the number of combinations of input values is too large to perform manually. Consider a case of an e-commerce Web site with thousands of items in the database. In such cases, parameterization plays a vital role in making your tests flexible and powerful. Task Parameterization In most real world Web applications, URLs are not simple static links. Most are dynamic URLs designed to handle a variety of tasks. A simple example would be a login page. In a real world scenario, you might have dozens if not more registered users, each with their own password and other information such as locale, timezone. For such a scenario, the URL could be: http://machine:port/application/login.jsp?user=username&password=userpwd&timezone=pst In the URL above, "user" and "password" are parameters that are accepted by the "login.jsp" URL. The "username" and "userpwd" are parameter values that the user may have entered in the login. jsp form page and clicked on the Submit button. Most modern Web sites use this kind of mechanism of passing parameters and values through the URL. One of the most common objects passed as a URL parameter is a "session id". AppPerfect Load Test recognizes the wide spread use of parameters and provides extensive support for it. Parameters can be created and then applied to individual URLs that have been recorded. You can also define whether the applied parameters must be applied sequentially or randomly on subsequent invocation of URL. Parameter Setting Wizard These are the following ways in which you can access the Parameter Setting Wizard. q Select the URL Task node in the Editor tree and on right hand side Click the 'Parameters' tab. Here you can see the list of parameters that have been encountered while recording the task. Click a parameter name and then the button 'Parameterize'. q You can also parameterize recorded request headers for task. Just select any url task in the Editor tree and select Request Headers tab on right hand side window and parameterize the request headers using the "Parameterize" button provided. On clicking 'Parameterize' button a parameter settings dialog will be shown, which will allow you to configure parameter value as constant or configurable test parameter. You can create new test parameter and associate it with URL Parameter/ Event argument/Attribute here. Test Parameters View You can see a list of configured test parameters using "Parameters" Node in the Editor tree. Select any test parameter to see its details at the bottom. You can edit the test parameter using the UI provided at the bottom. The test parameter configuration has following fields:
  • 46. Data Source: You can choose the data source from one of the following : q Fixed Values q Import from Database q Import from CSV File q Calculated Values q Pass-Through Values Parameter Selection: You can choose parameters Sequentially or Randomly. The Random selection option is very useful when you want to test a large number of values in limited time. Every replay of the test will pick random values, thereby giving you a good picture of the application's stability and performance. Add Value: If you want to add parameters manually (Fixed Values), then enter the values in this field and click the Add button. The values added will appear in the non-editable text area Parameter Values. Fixed Values Use Fixed Values when there are only a few values you want to test the parameter with. You can configure parameter to have fixed pool of values from where the value should be picked during execution. But in most cases, you will find that Importing the values from a Database or a CSV file will make your web application's testing for parameters very efficient. Import From Database Database ID: Select the database id from the dropdown provided. It will have ids of all the Database connections configured with AppPerfect Load Test. In case this dropdown is empty, you need to configure a Database with AppPerfect Load Test. Click on configure button and it will take you to Tools -> Options -> Browsers, JDKs & DBs. You can configure Database connection settings there. Once you configure the database you will find the database id for same in this dropdown which you can select, Query: Enter the query that will be used to fetch the rows. It is recommened that you Validate this query before replaying the test, as it will eliminate the possibility of failure due to non- connectivity with the database. Fetch Values: Select from - Now or Runtime. If you select 'Now' the connection will be established right away with your database and values will be fetched. If you select 'Runtime' the connection with your database will be established while the test is being replayed when you reach the point where values have to be provided. This will be slower than the earlier option, but more realistic for testing.
  • 47. Fetch All Rows: Select this checkbox if you want to fetch all rows from your database. Please ensure that you are aware of how many rows are contained in the database so that the time it will take to fetch the values can be built into replaying the test. Number of rows to fetch: Enter the number of rows to fetch if you have not selected the previous checkbox. Validate Query: Click this button to validate the SQL query. Import from CSV File Please note for CSV files: The values in your CSV files can be separated with a comma(,), semicolon(;), colon(:) or tab, but each value must appear on a new line. CSV File: Browse to the location of the CSV file. First row contains column header: Select this checkbox if the first row in your CSV file contains column header, i.e. the actual values start from second row. Column Index: If your CSV file has multiple columns, you need to specify the column index from which to fetch the values. By default the column index value is 0. Value Delimiter: Select the character which is used in your CSV file to separate values. String Delimiter: If your file contains strings as values for parameters, specify the character that separates the strings. For instance, the strings in your file may appear with double quotes. If you don't want to use the double quotes in the values taken from the file, then specify double quotes here ("). e.g.: "Java", "J2ee", "JMX", "XML" In the above, the value delimiter is comma (,) and the string delimiter is double quotes ("). Fetch Values: Select from - Now or Runtime. If you select 'Now' the connection will be established right away with the CSV file and values will be fetched. If you select 'Runtime' the connection with your CSV file will be established while the test is being replayed when you reach the point where values have to be provided. This will be slower than the earlier option, but more realistic for testing. Fetch All Rows: Select this checkbox if you want to fetch all rows from the CSV file. Please ensure that you are aware of how many rows are contained in the CSV file so that the time it will take to fetch the values can be built into replaying the test. Number of rows to fetch: Enter the number of rows to fetch if you have not selected the
  • 48. previous checkbox. Calculated Values In case you need to generate unique parameter values automatically with fixed prefix/suffix or if you need to generate date from Today's date or random date in various format then you can select Calculated values as datasource. For example in case you calculate as "number" with fixed prefix say "example" and increment by 1, then values generated would be example1, example2, example3 etc. If you select Calculate as "Date", you will be able to configure the date format (either select from pre-defined date formats or provide your custom date format as it is an editable combo box). You can choose between Today's date or Random Date. In this case application will generate the value as date string in specified format. Pass-Through Values Pass-Through parameters are those whose value will be picked from the response of previous URL while replaying the test. You can set pass-through parameters in the Parameters view by selecting the "Pass-Through Values" from the data source combo box. An example of Pass-through parameter is a session ID. This variable will have a value assigned it to based on some algorithm only at run-time. If you run a test using the stored value of a session ID, your test may not go further than login as that session might have expired. For a situation like this, you need to set the 'Pass-through Values' option for the parameter.
  • 49. Validations As a web application developer or tester, you will design (or test) your application based on a 'valid' set of responses expected from the application. You can set these validations for each web page after you have recorded the test. This feature is highly useful for regression testing. To add validation for any URL, select the URL node in the Editor tree and on right hand side select the Validations tab. You will find the DOM tree of the stored response at top. Right click on the DOM element node for which you need to add validation and select the required option from the popup menu. Following are the different kinds of validations which are supported : q Page validation q Text validation q Attribute validation q Date validation q Database Query validation q Custom validation Page Validation: You can add Page Validation by selecting the root node in the DOM tree and clicking the Add Validation... option from the popup menu. This kind of validation is done by parsing the complete page. You can validate following : q Size of the page q Count of elements on the page q Links , Images , Input Elements, Forms count on the page Text Validation: To find if a particular text or value is present on the page or not you can use this validation. Click the "Add Text Validation..." option from the popup menu on the DOM tree to access the Text Validation Setting dialog box. Here you can set the following: Description: Provide the description of the text validation here. It should be as informative as possible explaining the purpose of the validation. Fetch Text present between: Provide surrounding values for text you want to search in the page. for e.g. say you have multiple occurrences of word "Support" in the page but you need to check against only that value which exists between "AppPerfect" and "Team", then you can provide "AppPerfect" and "Team" as the two words between which the search for "Support" should be done. This validation will be successful only if you have "AppPerfect Support Team" present on the page.
  • 50. Text Not Exists: This option should be selected to negate the search result. If this checkbox is selected application will report success only if text to search is not present in the page. Case Sensitive: This option should be selected in case you need case-sensitive search for the text. Regular Expression: We use jregex for pattern matching for search string. Please check the docs for same at http://jregex.sourceforge.net/doc-index.html having all the required details for the patterns you can use for string matching. Check For: Here you can provide the text to search or validate. You can provide Exact Match value or multiple list of values which should be checked. If you want to parameterize text then specify the Test Parameter Name between @..@ and configure that Test Parameter in Parameters view. Attribute Validation: You can add Attribute Validation by selecting the element node in the DOM tree and clicking the Add Validation... option from the popup menu. This is useful in case you need to validate properties like innerText or value etc. of specific HTML element in page Date Validation: Here you can compare the date value present on page against today's date in different formats. Click the "Add Date Validation..." option from the popup menu on the DOM tree to access Date Validation Settings. In case of Date validation application looks for date string in the response and decides success or failure based on that, meaning say todays date is July 8, 2008 then application will look for string 08/07/2008 in case of format dd/MM/yyyy and 07/08/08 in case of MM/dd/yy. If exact matching string is not found that application will treat validation as failure. Database Query Validation: Here you can validate if the ResultSet returned as a result of query execution is empty or not. Click the "Add Database Query Validation..." option from the popup menu on the DOM tree to access Database Query Validation Settings. If this option is disabled, you need to configure a Database with AppPerfect Load Test. Select Tools -> Options -> Browsers, JDKs & DBs and configure Database setting there. Once you configure the database you will find the "Add Database Query Validation..." option enabled. Select "Add Database query validation..." option and you will get a dialog where you can enter an SQL query that you want to validate. If result set retured as a result of query execution is empty then application will treat validation as failure. Custom Validation: Apart from validations explained above, In case you need to perform any custom validation on Web Page you can do so using scripting. AppPerfect stores recorded test as javascript and one can add custom code to the test script to perform any custom URL or database validation. We support custom scripting apis, using which you can parse the response and fetch appropriate fields from the
  • 51. response page and validate it against the required value. You can also use scripting apis to fire any database query and perform the required validation by fetching the required data using the result set. Please refer to Customizing Test Script chapter for more details.
  • 52. Virtual Users A "virtual" or simulated user is actually a thread started by AppPerfect Load Test to throw requests at your web service/application or database. The virtual user acts like a real user and performs the same actions as a real user would perform. You can define a large number of virtual users in your test (maximum 100 virtual users in the Professional Edition and 10 virtual users in the Standard Edition of AppPerfect LoadTest). Virtual users can be either named or anonymous. If your application requires all users to log in (via a username/password), then you will most likely need to use named users. In other cases, you can use anonymous/generic virtual users. While internally AppPerfect Load Test handles a named user the same way it would handle any other parameter, for better usability, virtual user management is separated out from the rest of the parameter management UI.
  • 53. Central Controller AppPerfect Load Test allows users to distribute load on multiple machines to simulate better load condition for server. To distribute load or virtual users on multiple machines you need to install AppPerfect Load Test product on all those machines. A product Service named "APPLoadTest" gets installed along with product, now you just need to specify number of virtual users you want to run on that machine while creating project. AppPerfect Load Test will take care to copy the required project on remote machine and to start test on all machines. The central controller machine will show status of all machines in the status view. Also at the end of execution it will present the consolidated results of all machines as well as machine wise results to help you identify the bottleneck or performance issues in your application. There is no difference in installed system of central controller machine or any other machine, so you can make any machine as central controller. You can configure the option to execute test on remote machines at Project -> Properties... -> Machine Settings.
  • 54. Task Groups and Tasks The vital elements of a Test are defined in a Task Group which comprises of various Tasks. On the basis of the project type selected while creating a test the Task Group will hold information about the URL or the database and the settings to be applied during the recording of the Test. A Task forms the fundamental, basic unit of a test. It holds all the information and the settings on the basis of which a request or query would be considered as successful or failed. Task Groups for Web Tests To facilitate testing of web applications that require a startup(e.g. login) and cleanup(e.g. logout, deleting test tables/records from database) routine before allowing access to other services, AppPerfect Load Test provides three types of groups. Starting Group The purpose of this group is to hold tasks that logically get executed in the beginning. Action Group When AppPerfect Load Test records tests, all the tasks are first stored under Action Group. After the recording, you can re-arrange the tasks by cutting and pasting into the Starting and Ending Groups. You can create several Action Groups in a single Load Test project, and record a different set of tasks for each of these ActionGroups. For each recording, you will be prompted for confirming the name of the ActionGroup you wish to record the test for. By default, the most recently created ActionGroup is selected for recording of new tasks. Ending Group This group is meant to hold the tasks that should get performed at the end in the set of tasks recorded. Most common example would be logging out. You can choose not to play any of the groups by selecting the Ignore Group checkbox. You can set a Repeat Count for the groups. You can also change the order of the tasks for a group. Action Group Action Group is used by all types of Load Test tests : Web / Database. This group holds: q Web Test: the main actions performed while recording a test
  • 55. q Database Test: the database queries You can add more Action Groups to your project, edit and delete existing ones. You can also Cut, Copy, Paste Action Groups. All these features are available by Right Clicking the Action Group. Add Right click the Action Group and click 'Add Group'. You will see a dialog box where you can provide a name to the group, a repeat count and select whether you want to ignore that group. Edit Select the Action Group and you will find all the settigns for group on right hand side panel. You can edit the group properties there: q Change the name of the Action Group q Change its Repeat Count, that is, number of times the group should be repeated when the project is replayed q Choose to ignore the group. An ignored group will not be considered while replaying a test q Add, edit or delete tasks q Change the order in which the tasks should be executed Delete Right click an Action Group and click Delete Group. Other Operations q Cut / Copy / Paste q Remove All q Add Task Manually q Add Task using Browser Recording q Move Up / Down q Ignore Group q Import Groups Recorded.. q Verify Test Using Browser q Properties Verify Test Using Browser: This feature allows you to watch the test being replayed as if in a browser window. Each URL is
  • 56. reproduced with its success or failure status and additionally you can view several details about it right there: q Task Details: Shows basic details related to the Task, like the protocol, host, port number etc. You can also see the Response code of the task here. You can edit these details when you click the task name in the Editor tab. q Request Headers: Here you can see the request headers for the task. q Parameters: The Parameters associated with the currently playing task will be listed here, with the values used. You can check parameterization very efficiently by verifying test using browser as each iteration will show the actual parameter value picked. See Parameters and Virtual Users for more details. q Sub Tasks: Here you can see the sub-tasks assigned to the currently playing tasks and the status of each of them. Load testing using single Login - Logout: To load test a single login-logout, you must have login task in Starting Group and logout task in Ending Group. To create such test at the start of recording select Group as "Starting Group" in recording dialog and start recording. Once login task is recorded, go back to recording dialog and change group to say "ActionGroup1" and continue recording rest of the tasks. When you are done and ready to logout, again go back to recording dialog and change group "Ending Group". Now record logout and other cleanup tasks. Now if you look at recorded test you will find that login task is present in "Starting Group" and logout task is present in "Ending Group". Now you can select how groups should be run, like - Starting, Action, Ending or Starting (Once), Action (Repeat), Ending (Once). In first selection its no different then having login and logout tasks in Action Group itself (if repeat count of action group is one). In second case each virtual user will login once and will execute tasks in Action Group using same logged in user and at the end will logout of application. You can select this execution behavior from Project Node view. Tasks Each URL visited and each query constitute a task in Load Tester. Features to add tasks, edit and delete existing tasks and many more, are available by right clicking the task name. Add Add Task Manually Browser recording is the more convenient method of adding groups and tasks but adding tasks manually is a useful feature that allows you to provide all details about a task and embed it anywhere in the group, which may be a little more time-consuming then browser recording. Click this option to add a task to the project manually. You will see Add Task dialog. There are 5 tabs:
  • 57. Task Details Task Name: Provide a name for your task here. Host: The host is your web server's URL. Path: In Path, you have to provide the location of that part of your application which you want to test. e.g. in the bundled petstore application, the HOST will be: http://localhost:8080/ and the path may be /petstore/selection.do, the URL of the page which you want to test. Please validate this path by clicking the validate icon. Response Code: You have to provide the expected Response code here. This can be used for validation purposes. If the task will fail on replaying the test, the response code received will be recorded and you can check it agains the response code provided. In tasks that are recorded, the response code received by the browser is stored as the valid response code for the recorded task. Method: If you wish to pass some data through this task, you need to specify the correct method - GET or POST. The default selection is GET. Timeout (sec.): Also provide a timeout value over and above the Think Time. Timeout value is considered after think time lapses. For instance, if you have provided Think Time as 10 seconds and Timeout value as 10 seconds, then the total time Load Test will allow the task to respond is 20 seconds. Uses Authentication: If your application uses some authentication mechanism then select this checkbox. Now, your authentication information will be stored and used automatically while replaying the test, rather than prompting you for the same. Ignore Task: Check this box to ignore the task. Benchmark Page: Select the page here which you want to use to validate the current page against. It should match the benchmark page you will provide here to succeed. Parameters To add parameters, click the add button on the right. You will get a list of parameters if you have recorded tasks using browser. Request Header Provide the Request Headers manually or select from the list provided. Click the add button. Request Entity
  • 58. Request Entity is data sent to server as request body in case of HTTP request. It could be simple text or could be XML data like in case of XMLHTTPRequest (AJAX request) Sub Tasks Click add to create sub tasks for the current task. Add Task using Browser Recording Click here to add task to the project using browser recording. The Recording dialog explains details regarding Proxy settings and details regarding recording the test. Please see the chapter Recording a Web Test. When you are adding a task by recording using the browser, you cannot change the group while recording. The task will get recorded in the group where you right clicked and selected the option to Add a task using browser recording. Edit Select the task in the Editor tree and on right hand side you can view the details of the task. You can edit the task details there. Delete Right click a task name and click 'Delete Task' to delete it. Other Operations q Cut / Copy / Paste q Move up / down q Make sub-task of q Ignore Task q Show DOM Tree q Import groups recorded from FT/UT q Verify Test Using Browser q Properties
  • 59. Authentication Schemes AppPerfect products support various authentication mechanisms. In case your application requires authentication you need to configure same in AppPerfect while recording/replaying test. Please find below details of each authentication scheme supported. Form Based Authentication: This authentication scheme means user is authenticated using username, password parameters entered in the input elements present in a HTML form. In this kind of authentication scheme user is not required to configure anything on the server side, he needs to handle things inside his application. This kind of authentication mechanism is not very secure if used over HTTP protocol, the security of form authentication can be improved by using it with HTTPS. Http Basic Authentication: Basic authentication is a simple and not very secure authentication scheme which is defined in RFC 2317. The username and password are encoded in base 64 and are therefore easily obtainable by anyone who has access to the packet data. The security of basic authentication can be improved when used with HTTPS, thus encrypting the request and response. Http digest Authentication: Digest is a relatively secure scheme based on cryptographic hashes of the username and password, using the MD5 hash algorithm. Digest also provides the ability for the server to prove to the client that it also knows the shared secret (password). NTLM Authentication: NTLM is a scheme defined by Microsoft. It is more secure scheme than Basic, but less secure than Digest. NTLM can be used with proxies or servers, but not with both at the same time. If a proxy is being used, then it cannot be used for server authentication. This is because the protocol actually authenticates the TCP connection rather than the individual HTTP interactions. On Microsoft Windows platforms, NTLM authentication attempts to acquire the user credentials from the system without prompting the user's authenticator object. If these credentials are not accepted by the server then the user's authenticator will be called. Because the Authenticator class was defined prior to NTLM being supported, it was not possible to add support in the API for the NTLM domain field. There are three options for specifying the domain: a) Do not specify it. In some environments, the domain is not actually required and the application need not specify it. b) The domain name can be encoded within the username by prefixing the domain name followed by a back-slash '' before the username. With this method, existing applications that use the Authenticator class do not need to be modified, so long as users are made aware that this notation must be used. c) Define system property "http.auth.ntlm.domain", the value of this property will be used as the domain name.
  • 60. Two way SSL Authentication : The SSL protocol, developed by Netscape in 1994, allows clients and HTTP servers to communicate over a secure connection. It offers encryption, source authentication, and data integrity as means to protect information exchanged over insecure, public networks. The current version of SSL used most commonly is 3.0. In HTTPS communication servers presents client a SSL certificate which is basically a set of credentials to identify itself when client tries to communicate with the server first time. Two way SSL Authentication is most secure form of authentication mechanism. In this authentication mechanism both client and server authenticates each other. Each client presents its own SSL certificate when it starts communication with server, server then authenticates that certificate to identify the client. This authentication mechanism can be used along with username, password authetication to identify the client.
  • 61. Recording a Load Test AppPerfect supports load testing of Web applications based on HTTP/HTTPS protocols. This test is normally used to simulate a large number of users who will access your applications via a Web browser. Once test settings and system settings are configured, you can start "recording a test". Browser Recording To start recording a test, click Project -> Record test... from the menubar. This will launch the AppPerfect Recorder dialog. Ensure the browser is correctly configured at Tools -> Options...-> Browsers, JDKs & DBs. Following settings can be configured in Recorder dialog before starting recording : Browser You can select the browser for recording from the list of configured browsers. AppPerfect Load Test records test using Proxy Recording Group Each project can have multiple groups based on functionality you want to record. Select the group in which you need to record the test from the Group dropdown. Application will record the events in the selected group. Starting URL: Provide the starting url of your application here. Application will take care of launching the browser with the starting url provided here. Transaction: You can record transactions to get details of response time during execution for set/group of tasks. During recording you can start/stop transaction to record transactions. Session is managed using url-rewriting Select this option in case your application maintains session using URL-rewriting. For ex. in case your application sends the session id as part of url path like http://www.abc.com/XY/SESSIONID/PQ then you need to select this option. Authentication In case your application requires Authentication then same should be configured here. Refer to
  • 62. Authentication Schemes for details on various authentication mechanisms that can be configured with AppPerfect. Remove previously recorded/created tasks In case this option is selected then application first removes or clears all the tasks from the selected group and then records new tasks. Record Web Test Script simultaneously AppPerfect support recording of Load Test and Web Test scripts simultaneously. In case this option is selected application also records Web Test script in the project. You can later on open this project in AppPerfect Web Test product and execute the web test. Filters Application will exclude or include tasks in recording based on extensions specified in filters (example *.gif, *.jpg) Recording the test Click the Start Recording button to start recording. Click Pause/Resume button to pause/resume recording. Click the Stop button to stop recording. Once you start recording application will Launch browser with your application. Perfom the required operations in your application and all the http/ https requests sent to target application from browser will be recorded in the project.
  • 63. Customizing Test Script AppPerfect Load Test stores the recorded test in javascript format. A separate javascript function is created for each node/task visible in the Editor UI. One can edit a task either in UI or in the script editor. UI and the script are always in sync with each other i.e. a change made in UI is reflected back in the script and vice-versa. Following topics are covered in this chapter : q Editing in Script Editor q Adding Custom Code to Test Script q Adding Custom validation r Adding Custom Task Validation r Adding Custom Database validation q Fetching value from response and passing it to task parameter q Script documentation Editing in Script Editor You can view and edit the script in script editor provided in the Load Test. It can be invoked in any of the following way: a. Selecting the Script editor toolbar button. b. Selecting Project -> Script Editor.. menu option c. Right click on the Editor Tree and select Script Editor... You have an option of saving and compiling the script in the editor. These options are available in toolbar and menu bar. Once the test is saved and the editor is closed, the UI is synchronized as per the changes in the script. Adding Custom Code to Test Script You can reuse the code in your custom classes in AppPerfect Test Script. You can add your own custom code to the test script. To use any custom classes in the script you should first configure the classpath of those custom classes at Tools -> Options -> Custom Script Settings. You can provide the path for either the zip/jar file or can provide the path for the folder containing the custom classes. Please ensure that the custom class is compiled using the same JRE version with which AppPerfect Load Test is running. By default AppPerfect Load Test runs with the JRE present at $LoadTest_Home/jre. Once you are done configuring the classpath, you can add package of your class at top of the script as importPackage(Packages.yourPackage);. Once package is added you can access your java class from script code and call methods on those java classes.
  • 64. For ex. lets say there is a custom class com.appperfect.sample.utils.UtilityFunction and you need to use its function getCurrentTime() in the script. To do this you will need to add following script code : importPackage(Packages.com.appperfect.sample.utils); var utilityObj = new UtilityFunction(); var currentTime = utilityObj.getCurrentTime(); log('currentTime :' + currentTime); Adding Custom validation In case you need to perform any custom validation on Web Page you can do so using scripting. We support custom scripting apis, using which you can parse the response and fetch appropriate fields from the response page and validate it against the required value. You can also use scripting apis to fire any database query and perform the required validation by fetching the required data using the result set. Find below few examples to add custom validations : Adding Custom Task Validation You can parse the response and fetch appropriate data from the response page and validate it against the required value. Select the concerned URL task in the Editor tree for which you need to add validation for. Now select Project -> Script Editor... It will open the script editor with the code scrolled to that of the javascript function for the selected URL task. Refer to the code snipped below parsing the web response to find the product Table and validating if the product table has "Load Test" listed in it : function executeTask_1() // script function for Task1 [/] { var request = engine.createGetRequest(1,'Task1','http','www.appperfect.com',80,'/'); request.setIgnored(false); request.addThinkTime(100.0, 0, 5, 0, 0); request.setTimeout(300); request.addHeader('Accept-Encoding', 'gzip, deflate', '', true); request.addHeader('Accept-Language', 'en-US', '', true); request.addHeader('Connection', 'keep-alive', '', true); request.setExpectedResponseCode(200); request.setRecordedFileName('recorded/2009_3_21_1_40_52_37/ActionGroup1/Task1.html'); var successful = engine.execute(request); if(! successful) { log('Task failed, reason for failure: ' + request.getReasonForFailure()); } else { //Validations may be added here. //Custom Validation code starts here var validationSuccess = false; var htmlPage = request.getWebResponse(); // this will return instance for com. gargoylesoftware.htmlunit.html.HtmlPage
  • 65. var tableElement = htmlPage.getHtmlElementById("productTable"); //here we are querying the product Table if(tableElement) { //Now we will get all the rows in the table. var rowList = tableElement.getRows(); for(var i = 0; i < rowList.size(); i++) { var tableRow = rowList.get(i); var cellList = tableRow.getCells(); for(var j = 0; j < cellList.size(); j++) { var tableCell = cellList.get(j); var cellData = tableCell.getNodeValue(); log('cell data ' + cellData); if(cellData == 'Load Test') { validationSuccess = true; break; } } } } if(!validationSuccess) { request.setTaskSuccessful(false); request.setReasonForFailure("Table data validation failed, could not find Load Test product in table."); } //Custom Validation code Ends here } engine.release(request); } Adding Custom Database validation You can fire SQL queries and validate the values fetched using result set. Lets say you have "Products" table in Database and you need to validate if there is product with name "AppPerfect Load Test" present in the table. To add such validation you edit script code as follows : function executeTask_1() // script function for Task1 [/] { var request = engine.createGetRequest(1,'Task1','http','www.appperfect.com',80,'/'); request.setIgnored(false); request.addThinkTime(100.0, 0, 5, 0, 0); request.setTimeout(300); request.addHeader('Accept-Encoding', 'gzip, deflate', '', true); request.addHeader('Accept-Language', 'en-US', '', true);
  • 66. request.addHeader('Connection', 'keep-alive', '', true); request.setExpectedResponseCode(200); request.setRecordedFileName('recorded/2009_3_21_1_40_52_37/ActionGroup1/Task1.html'); var successful = engine.execute(request); if(! successful) { log('Task failed, reason for failure: ' + request.getReasonForFailure()); } else { //Validations may be added here. //Custom Validation code starts here var validationSuccess = false; // DatabaseId used in following API is the database id configured at Tools -> Options -> Browsers, JDKs & DBs var resultset = engine.executeSelectQuery("DatabaseId", "select productname from Products"); // process the result set here while(resultset.next()) { var productName = resultset.getString(1); if(productName == "Load Test") { validationSuccess = true; break; } } engine.closeResultSet(resultset); if(!validationSuccess) { request.setTaskSuccessful(false); request.setReasonForFailure("Custom validation Failed: Product Load Test not present in database."); } //Custom Validation code Ends here } engine.release(request); } Fetching value from response and passing it to Event argument Lets say you have a form in the Web page which has a input text field. Now you need to fill this input text field with the value retrieved from a table in the web page and then submit the request. So what you need to do is parse the previous task response and fetch the required value and pass it to request parameter of next task. The following code demonstrates passing the value fetched from table in Task1 response to the GET parameter of next request Task2:
  • 67. We will first declare a global variable 'parameterValue' at top of the script code in which we will be storing the value we get after parsing previous response. var parameterValue; Now we will parse the Task1 and initialise parameterValue with the value we need to pass to the next request's parameter. function executeTask_1() // script function for Task1 [/] { var request = engine.createGetRequest(1,'Task1','http','www.appperfect.com',80,'/'); request.setIgnored(false); request.addThinkTime(100.0, 0, 5, 0, 0); request.setTimeout(300); request.addHeader('Accept-Encoding', 'gzip, deflate', '', true); request.addHeader('Accept-Language', 'en-US', '', true); request.addHeader('Connection', 'keep-alive', '', true); request.setExpectedResponseCode(200); request.setRecordedFileName('recorded/2009_3_21_1_40_52_37/ActionGroup1/Task1.html'); var successful = engine.execute(request); if(! successful) { log('Task failed, reason for failure: ' + request.getReasonForFailure()); } else { //Validations may be added here. //Function to parse the response starts here var htmlPage = request.getWebResponse(); // this will return instance for com. gargoylesoftware.htmlunit.html.HtmlPage var tableElement = htmlPage.getHtmlElementById("productTable"); //here we are querying the product Table if(tableElement) { //Now we will get the data from the required cell in the table var cellElement = tableElement.getCellAt(1, 2); //Intialising the parameterValue with the value we need to pass to the next request's parameter parameterValue = cellElement.getNodeValue(); } //Function to parse the response Ends here } engine.release(request); } We have parsed the response and have initialised the global variable parameterValue with requried value. Now we will pass this value to Task2 parameter. function executeTask_2() // script function for Task2 [/queryProduct] {
  • 68. var request = engine.createGetRequest(2,'Task2','http','www.appperfect.com',80,'/queryProduct'); request.setIgnored(false); request.addThinkTime(100.0, 0, 5, 0, 0); request.setTimeout(300); request.addHeader('Accept-Encoding', 'gzip, deflate', '', true); request.addHeader('Accept-Language', 'en-US', '', true); request.addHeader('Connection', 'keep-alive', '', true); //Passing parameterValue to the task's parameter request.addParameter('productName', parameterValue, '', true, false); request.setExpectedResponseCode(200); request.setRecordedFileName('recorded/2009_3_21_1_40_52_37/ActionGroup1/Task1.html'); var successful = engine.execute(request); if(! successful) { log('Task failed, reason for failure: ' + request.getReasonForFailure()); } else { //Validations may be added here. } engine.release(request); } Script documentation Refer to Scripting documentation for more details on scripting apis supported. While editing the script in script editor, you can open the API documentation using Help -> Java Documentation...as well
  • 69. Monitoring a test run Once your project is created as desired, to run the project, click Project -> Start... in the menubar. AppPerfect Load Test will automatically switch the UI to the "Status" tab. This view displays the status of your test in real-time. Data is refreshed periodically based on the "Refresh Interval" defined in Tools -> Options... -> AppPerfect. Key data points such as Response Time, Virtual User Count, Hit Count, etc. are displayed in this view. The Status tab allows you to monitor the progress of the test and witness the dynamic variations across different factors which affect your application being tested. You can view the status panel during the test run with dynamic values and once the test run has completed, it shows similar details as the Result tab but you will get more comprehensive information about the results of the completed test in the Result tab. The Status tab represents information using charts and tables. Charts You can see the following charts for: q the whole project q each group and q each individual task 1. Hit Count Chart: This chart displays the hit counts at different points of time of the URL group execution. This chart helps you determine when the number of failed/timed out requests started increasing and this information can be used in conjunction with the User Count chart to find out the approximate point where the load is not being handled effectively by the application. The X-Axis displays the time stamps at regular intervals since the start of the URL group. There are six values plotted against the Y-Axis. The one shown in green color indicates the number of successful hits at that point of time, the one shown in red color indicates the number of failed hits and the one in orange color indicates the number of requests that have failed due to time-out. 2. Response Time Chart: This chart displays the wait periods at different times and also gives a summary of the maximum, minimum and average wait period that help you get an insight into how long would it take a visitor to receive a page. The X-Axis displays the time stamps and the Y-Axis has values plotted for the maximum, minimum
  • 70. and average wait periods for that interval. This information in conjunction with the Hit Count can help determine the number of users that can safely access the application simultaneously, without too much of a degradation in service. 3. User Count chart: This chart shows the number of users at different times during the test and help you gauge the kind of load that the application can tolerate. The X-Axis of this chart plots the time stamps at regular intervals while the Y-Axis plots the number of users at that time. When compared with the Response Time chart and the Hit Count chart, it gives you important information about how your system is reacting to the load and helps you set the tolerance levels of your application. 4. Throughput chart: This chart shows the number of bytes of data received as response from the server by the application. The X-Axis of this chart plots the time stamps at regular intervals while the Y-Axis plots the number of kb of data received at that time. When compared with the Response Time chart and the Hit Count chart, it gives you information about how much response data is being sent to users with respect to hits and response time. The same charts apply to Database projects. Tables The following tables can be seen: 1. Status table The status table shows group-wise current state of the test as property:value pairs. The Status property indicates if the test is running, paused or completed. Result is shown as successful until any of the request fails. The Elapsed Time shows the time since the start of execution for that URL group. The Actual Duration shows the time the request group has been executing. The difference between the two is that when a test is paused, the elapsed time will include the pause time while the actual duration will ignore it meaning that if there is no pause during the execution of the test, then both the time values will be the same. The Current Users shows the number of threads that are currently firing the requests. Failed Hits indicates the total number of requests that have failed till now while timed out Out Hits depicts the total number of requests that have timed out. Total Hits shows the number of requests that have been processed so far. Average Response Time is calculated using the minimum and maximum response times. 2. User Details table This table provides details about the user activity recorded in the test. It comprises of tabular information about the users such as User ID and Name, number of Successful, Failed and Timed out hits, Start and End time, and the Status of the request.
  • 71. 3. Virtual User Details table This table provides details about each virtual user activity recorded in the test. It comprises of tabular information about the virtual users such as User ID, number of Successful, Failed and Timed out hits, Start and End time, and the Status of the request.
  • 72. Understanding Test Results The Results tab presents a visual analysis of the outcome of your test run. The navigation tree on the left side provides a logical view of your test run data. q Project r Virtual Users r Tasks / Groups s Starting Group s Action Group s Task N s Ending Group Under Action Group you can see a list of all tasks performed under that group. There can be several Action Groups but only one Starting and Ending Group each. Project Summary The project summary displays the results of load test for the entire project as a whole. It gives you a bird's eye view of the project and allows you to explore the details in a hierarchical fashion. You can see here the results in numbers and graphs. Hit Count, Response Time , User Count and Throughput can be seen in a consolidated chart in this view. Response Codes You can see a graphical and tabular representation of Response Codes that this project received in this test run. Virtual User Summary Hit Count, Response Time , User Count and Throughput can be seen in a consolidated chart in this view. Virtual User Details Click a Virtual user from under Virtual Users and you can see Virtual User Details. Here you can see a list of all the tasks this virtual user performed with detailed information regarding the status as well as the maximum, minimum and average response times and the number of bytes received per second (throughput). You can also see the Hit Count and Response Time charts here. Group Summary
  • 73. You can see a pie chart showing the overall success or failure of the groups in the project. You can also see a table with a list of all the groups alongwith their status and other details. Group Details Click a group from the navigation panel and you can see the Group Details report with Hit Count, Response Time, User Count and Throughput charts for the selected group. Task Details Under each group you can access the Task Summary report. Here you can see all the details related to the selected task and its status. For tasks that have failed, you can see more details. Click the button 'View Failed Hits'. Failed Task Details Here you can see request by request break up of the failed task in form of a table. Each failed request has hyperlink associated with it which can be clicked to view complete details of that particular failed request. Additional Request Details You can view Task Details, Parameters, Request Headers, Response Headers, Sub Tasks and Validation results.
  • 74. Linking Projects Option Linking groups from multiple Projects For any Automated testing tool one of the important feature is the reusability of the existing scripts. AppPerfect provides the feature of linking exisiting scripts with the host script so that without re- recording common functionalites already implemented in existing scripts can be reused. Say for example you have login/logout functionality in your application. Now say for each functionality like adding new request, order processing etc. you need to first login to the application. So now instead of recording Login/logout groups in each of the script you can record login/logout groups in one script and later on link this script to all the scripts whereever login/logout is required. Now say, you need to test with different user names and passwords, so you need to do change just in one script having login/logout groups, all other scripts linking to this will automatically take the latest changes. The following are the advantages of Linking Projects : 1. Re-use of commonly recorded functionalites, so you do not need to re-record them in each script. Record once and reuse at all places. 2. In case change is done in the common functionality, it has to be done only in one script and all the scripts linked to it will automatically use the latest changes. Link project Settings can be accessed in the Editor tab, just select the Project Node and on the right hand side you will find the option to Replay Linked Projects/Groups Link Project UI has the following fields: Replay Linked Projects/Groups : Select this checkbox if you need to replay linked projects/groups Linked Projects/Groups Table : All the groups present in this table will replayed in case Replay Linked Projects/Groups checkbox is selected. The test is replayed using the Host Project settings. You can add new linked group, delete linked group, order the linked groups using move up/down buttons. Adding New Linked Group : By default host groups are already present in the Linked Groups table. You can add new linked group from foreign project by clicking "Add Group" Button. This will launch Link groups dialog. You can Browse the concerned project with which you need to link, it will show you all the groups present in the selected project in the tree table. Select the groups you need to link and click on Link Button. You will find all the selected groups added to Linked Projects/ Groups Table. All these groups will be replayed when the test is replayed, provided Replay Linked Projects/Groups checkbox is selected. You can link a group multiple times in case it has to be replayed multiple times. You can even link host groups itself by browsing the host script while adding linked groups.
  • 75. ANT Script Execution Option Exporting Project as ANT Script AppPerfect project can be exported as an ANT script allowing it to be integrated with your build process. You can export project as ANT script using tools > Export project as ANT Script... menu option The Export As ANT Script Dialog Box has the following fields: ANT Script Location: Enter the full path where you want application to generate required ANT scripts for the project. Application will generate two files one is standard ANT Script file that is "build. xml" and second is $Project_Name.xml file. The build.xml file just contains call to $Project_Name. xml file, this is helpful when you want to use ANT script with build process in that case you can just copy contents of build.xml to your build.xml file. Save Result: Specify whether to save result after the execution of project. Export Result: Specify whether to export result as HTML after the execution of project.
  • 76. Command Line Execution Option AppPerfect products can also be used in the non-UI mode through use of the command prompt. However, this functionality is useful only after creating and configuring a project to suit your requirements in the UI mode. After creating and saving your project, you can use the command prompt to run the Java Unit Test / Java Code Test / Web Test / App Test / Load test in the non-UI mode. The %project name%.bat/. sh file, is used to run the Java Unit Test / Java Code Test / Web Test / App Test / Load Test project. You can generate this file by exporting project as command line bat/sh file using menu option Tools - > Export Project As command line... There is not much difference between running project in the UI or the non-UI mode, as you can pass various parameters along with the command used. Note: For help on how to create a AppPerfect project in the UI mode, refer to Creating a new project chapter in the documentation. The command to be used to invoke product in non-ui mode from command line looks :- For Windows: q "%JAVA_HOME%binjavaw.exe" -classpath "%APPPERFECT_HOME%eclipsestartup.jar" org.eclipse.core.launcher.Main -clean -noupdate -application com.appperfect.teststudio. nonuiRunner -data "%WORKSPACE_LOCATION%" -projectfile "%PROJECT_FILE%" - producttype %PRODUCT_TYPE% For Linux q "$JAVA_HOME/bin/java" -classpath "$APPPERFECT_HOME/eclipse/startup.jar" org.eclipse. core.launcher.Main -clean -noupdate -application com.appperfect.teststudio.nonuiRunner - data "$WORKSPACE_LOCATION" -projectfile "$PROJECT_FILE" -producttype $PRODUCT_TYPE Note: Here JAVA_HOME, APPPERFECT_HOME, WORKSPACE_LOCATION, PROJECT_FILE and PRODUCT_TYPE needs to be replaced with corresponding values based on machine settings. Here "org.eclipse.core.launcher.Main" is the main class which will internally invoke the application passed and will hand over the control to that application. The main application class is "com. appperfect.teststudio.nonuiRunner" which will be responsible for executing the project passed as "- projectfile" parameter. The parameter "-data" is to specify the workspace location which should be used for executing the application and "-producttype" is a constant integer value used to indicate which product to run from the project file. The supported product type values are 1 for Java Code Test, 2 for Java Unit Test, 4 for Load Test, 5 for Web Test and 8 for App Test. To check the various parameters that can be passed as the command line arguments to the command open the exported command line batch file in Text Editor. It has all the supported
  • 77. parameters listed.
  • 78. IDE Integration IDE Integration is a highly useful feature in the AppPerfect applications. You can integrate the AppPerfect applications with any of these popular IDEs : Eclipse, NetBeans, IntelliJ Idea, JBuilder and JDeveloper. Once the product is installed, then any time later you can integrate with the IDE using Tools -> IDE Integration menu-item. Un-Integrating You can un-integrate the AppPerfect products from the IDE from the same menu-option. Click Tools -> IDE Integration and from the list of IDEs shown on this dialog, select the IDE from which you wish to un-integrate AppPerfect. You must close the IDE before un-integrating. Integrating q Eclipse 2.x, 3.x r Plugin Installation r Integration with Eclipse q NetBeans 4.0, 4.1 and 5.0 r Plugin Installation r Integration with NetBeans q IntelliJ Idea 3.0, 4.x, 5.0 & 5.1 r Plugin Installation r Integration with IntelliJ Idea q JBuilder 9 Personal, JBuilder X Foundation, JBuilder X Enterprise Edition r Plugin Installation r Integration with JBuilder q JDeveloper 10g r Plugin Installation r Integration with JDeveloper q IBM WebSphere Studio 5.1.x r Plugin Installation r Integration with WebSphere q IBM Rational Application Developer 6.0 r Plugin Installation r Integration with WebSphere Eclipse 2.x, 3.x
  • 79. Plugin Installation When you select the option to integrate AppPerfect with Eclipse the following steps are taken: 1. A link file "com.appperfect.<PRODUCT_NAME>.link" is created in <ECLIPSE_HOME>links folder. Integration with Eclipse Once the IDE integration has taken place, you will be able to access the AppPerfect menu in the following ways within Eclipse: 1. AppPerfect menu-item will be added within the Eclipse toolbar. Click it to launch any of the AppPerfect products. 2. AppPerfect products can also be accessed through context-sensitive pop-up menus. AppPerfect products will be available as part of the IDE once started. NetBeans 4.0, 4.1 and 5.0 Plugin Installation When you select the option to integrate AppPerfect with NetBeans the following steps are taken: 1. The plugins jars are placed in NETBEANS_HOMEide<version_number>modules folder. 2. The other required jars are placed in the NETBEANS_HOMEide<version_number>modulesext folder. 3. The config file "com-appperfect-<PRODUCT_NAME>.xml" is placed in the NETBEANS_HOME ide<version_number>configModules folder. Integration with NetBeans Once the IDE integration has taken place, you will be able to access the AppPerfect menu in the following ways within NetBeans: 1. AppPerfect menu-item will be added within the NetBeans toolbar. Click it to launch any of the AppPerfect products. 2. AppPerfect products can also be accessed through context-sensitive pop-up menus. AppPerfect product will start a new instance after gathering available details from the IDE.
  • 80. IntelliJ Idea 3.0, 4.x, 5.0 and 5.1 Plugin Installation When you select the option to integrate AppPerfect with IntelliJ Idea, the following steps are taken: 1. A folder named 'AppPerfect' is created in IDEA_HOMEplugins. 2. The plugins jar and other required jars are placed in the IDEA_HOMEpluginsappperfect folder. Integration with IntelliJ Idea Once the IDE integration has taken place, you will be able to access the AppPerfect menu in the following ways within IntelliJ Idea: 1. AppPerfect menu-item will be added within the IntelliJ toolbar. Click it to launch any of the AppPerfect products. 2. AppPerfect products can also be accessed through context-sensitive pop-up menus. AppPerfect product will start a new instance after gathering available details from the IDE. JBuilder 9 Personal, JBuilder X Foundation, JBuilder X Enterprise Edition Plugin Installation When you select the option to integrate AppPerfect with JBuilder, the following steps are taken: Step 1: The plugins jar and other required jars are placed in the JBUILDER_HOMElibext folder. Integration with JBuilder Once the IDE integration has taken place, you will be able to access the AppPerfect menu in the following ways within JBuilder: 1. AppPerfect menu-item will be added within the JBuilder toolbar. Click it to launch any of the AppPerfect products. 2. AppPerfect products can also be accessed through context-sensitive pop-up menus. AppPerfect product will start a new instance after gathering available details from the IDE. JDeveloper 10g
  • 81. Plugin Installation When you select the option to integrate AppPerfect with JDeveloper, the following steps are taken: Step 1: The plugins jar and other required jars are placed in the JDEVELOPER_HOMElibext folder. Integration with JDeveloper Once the IDE integration has taken place, you will be able to access the AppPerfect menu in the following ways within JDeveloper: 1. AppPerfect menu-item will be added within the JDeveloper toolbar. Click it to launch any of the AppPerfect products. 2. AppPerfect products can also be accessed through context-sensitive pop-up menus. AppPerfect product will start a new instance after gathering available details from the IDE. IBM WebSphere Studio 5.1.x Plugin Installation 1. A link file "com.appperfect.<PRODUCT_NAME>.link" is created in <ECLIPSE_HOME>links folder. Integration with WebSphere Once the IDE integration has taken place, you will be able to access the AppPerfect menu in the following ways within WebSphere: 1. AppPerfect menu-item will be added within the WebSphere toolbar. Click it to launch any of the AppPerfect products. 2. AppPerfect products can also be accessed through context-sensitive pop-up menus. AppPerfect products will be available as part of the IDE once started. IBM Rational Application Developer 6.0 Plugin Installation 1. A link file "com.appperfect.<PRODUCT_NAME>.link" is created in <ECLIPSE_HOME>links folder.
  • 82. Integration with WebSphere Once the IDE integration has taken place, you will be able to access the AppPerfect menu in the following ways within WebSphere: 1. AppPerfect menu-item will be added within the WebSphere toolbar. Click it to launch any of the AppPerfect products. 2. AppPerfect products can also be accessed through context-sensitive pop-up menus. AppPerfect products will be available as part of the IDE once started.
  • 83. UI Reference This chapter will cover the overview of all the UI components available in this product. When a test is opened you will see two frames. The left frame is the navigational frame while the right frame holds the panel for the selection made in the tree in the navigational frame. Some menu options will not be available depending on what has been selected in the left frame. There are three tabs shown in the left navigational frame: Editor Tab The left hand navigational frame shows the Editor tab with the test tree as soon as the recording is over. When a test has been recorded, selecting an element on the test tree makes the right frame to show the panel for settings for the element selected on the test tree. The test tree has a root node that is name of the test and one or many group nodes that represent the different groups in the test. The group node can have one or many task nodes. When the Test node, that is the parent node for the test tree, is selected the right frame shows the Project Settings and List of Groups in the test. When the Group node is selected on the test tree, the right frame shows the Group Settings and List of Tasks in the group. When an Task is selected on the test tree, the right frame shows the General Settings and the Parameter Settings for that particular Task. Status Tab This tab shows the status of a test running on that machine. Results Tab The Results tab on the navigational frame shows the reports tree. The Reports tab is not seen on the left frame when a new test is created or an existing test is opened. It can be seen only when a test is replayed. The Results tab is also seen when a test result file is opened using the Open Result option in the File menu. Menu Items File Menu Menu Option Description New... Starts the new project wizard Open... Opens an existing project Close Closes the current project Save Saves a project to the location where it was opened from or previously saved Save As... Allows you to save a project to a new location and/or rename the project Result Open... Opens a existing result Result Close Closes the existing result being viewed
  • 84. Result Save Saves the result of the project Result Save As... Allows to save the current results of the test to a new location and/or rename the result Makes a zip file of the results of the current project and attaches it to a new email using the Send Result To... default email client Print Prints the selected report Recent Project Files Displays a list of recently created files Recent Result Files Displays a list of recently accessed Result files. Exit Closes and exits the AppPerfect Load Test Edit Menu Menu Option Description Cut Standard cut operation on selected node. Copy Standard copy operation on selected node. Paste Standard paste operation. Delete Delete the selected node Remove All Remove all child nodes of the selected node Find Find the node in the editor tree Add Group Add new group to the editor tree Add Task Add new task to the editor tree Project Menu Menu Option Description Run Test Starts the test. All the test settings will be checked and if there are no errors then the test will start running. Run Selected Group Starts the test for the selected group. Stop Test Stops the test. This will stop a test and the required reports will be generated.
  • 85. Pause Test Pauses the test temporarily. Test can be restarted Start Recording Launches the Browser recorder. Verify Test Using Select this option to view each URL of your recorded test in AppPerfect's browser window Browser... Merge results with another Load Test project results. Provide the result file upon being Merge Results prompted Import groups Import groups recorded recorded Properties... Opens the project properties wizard that allows to set/change the project properties Preferences... Opens the common Load Test project wizard to set/change properties Tools Menu Menu Option Description Export Project As ANT Export your AppPerfect project as ANT script. Script Export Project As Export your AppPerfect project as Command line script file. Command Line Export view to ...HTML/ Export the current view to HTML/PDF/CSV format. PDF/CSV/XLS/XML IDE Integration... Opens the dialog box requesting selection of IDE to integrate with Options... Opens the options wizard that is used to set system properties Help Menu Menu Option Description Quick Help Shows context sensitive help Table of Contents Shows the entire help for the system Search Shows the entire help for the system with the search tab selected Technical Support Takes you to the AppPerfect Support page on the Internet Software Updates Automatically updates the application About AppPerfect LoadTest x.x.x Shows the information such as version, copyright related to AppPerfect LoadTest Toolbar Items
  • 86. Toolbar Option Description Brings up the new test wizard for the creation of a project Opens existing project Saves current project Starts the test. All the test settings will be checked and if there are no errors then the test will start running. Pauses the test temporarily and then can be restarted after some time Stops the test. This will stop a test and the required reports will be generated. Launches the Browser recorder Opens the project properties wizard Opens the common Load Test project wizard Exports the results in HTML format Options Help About Status Bar The status bar has five sections displayed as follows (from left to right): q View - Shows the edition of the AppPerfect Product: Standard or Professional. q Status - Shows the status of the application: Test Running and Test Completed. q Time - Shows time elapsed while running the test. q Date - Shows current system date.
  • 87. AppPerfect Load Test (AP LT) FAQ 1. What can I test with AppPerfect Load Test(AP LT)? 2. How specifically does AP LT help with load testing? 3. Does AP LT support Secure HTTP (https) protocol ? If so, how? 4. My application requires a login and then uses the session information for subsequent interaction. Does AP LT support such applications? If so, how? 5. How many virtual users does AP LT support? How many virtual users will my machine support? 6. How are tests recorded using a browser? How does the proxy server work? 7. How does AP LT calculate the response time for a given request? 8. What does browser simulation mean? Why should I care? 9. What are pass-through parameters? How do they work? 10. How do I monitor the machine on which the target application is running? 11. What does a "load strategy" mean ? What are the various load strategies available? 12. What is "think time"? How does it impact a test? 13. How do I generate reports and track trends? 14. How does AP LT determine if a request is a success or a failure? 15. I want to schedule AP LT to run at a set time in the future. How do I do that? 16. Can I run AP LT on multiple machines and simultaneously test the same target application? 17. Can I configure AP LT for monitoring CPU, Memory, Disk performance data from 2 target servers? 18. How do I relate the system monitoring data i.e. CPU, Memory, Network usage, and disk activity to the tasks in action groups? The purpose is to analyze data e.g. if there was a peak in disk activity, what task was being performed? 19. I configured a Load Test to run for 5 minutes. However it did not stop after 5 minutes, I had to stop the test manually after several minutes. Why is that? 20. I have downloaded the evaluation version of AppPerfect LoadTest. I am trying to execute the tasks mentioned in the Load Test tutorial using the bundled PetStore project, but no tasks are getting recorded under ActionGroup. Is recording supported in Evaluation version? 21. I tested AP LT with a web application with Oracle database in the backend. I faced a problem regarding the database getting full. Is there any facility to rollback changes in the database? 22. What are the differences between AP Pro vs. AP Std as far as the Load Test is concerned? 23. I'm getting an error again and again. I've tried everything, but I'm stuck. What should I do? What can I test with AppPerfect Load Test(AP LT)?
  • 88. You can load test applications based on the following three protocols: q HTTP q JDBC q Command Line Interface (CLI) How specifically does AP LT help with load testing? AP LT helps you easily record your test, help define parameters, executes the test and helps you analyze the results from your test. Does AP LT support Secure HTTP (https) protocol? If so, how? Yes, AP LT supports https load testing. To do this, you need to ensure your SSL certificate is issued with Thawte or VeriSign. If that is not the case, make you manually add your certificate to AP LT when asked for in the AP LT Project Properties dialog box. My application requires a login and then uses the session information for subsequent interaction. Does AP LT support such applications? If so, how? Yes, AP LT supports applications that require Basic authentication as well as those that require application authentication. If a session ID is returned by your application, you can specify the session ID's name as AP LT can re-use it in all requests it makes. How many virtual users does AP LT support? How many virtual users will my machine support? You can define up to 100 virtual users in the Professional edition. In the Standard (after the 30 day evaluation) edition 10 virtual users are supported. Your system's resources determine how many virtual users it will support. Assuming a 2.4 GHz or higher Pentium IV CPU, each virtual users should require about 0.75 MB of RAM. How are tests recorded using a browser ? How does the proxy server work? AP LT acts as a proxy server that sits between your Web browser and your server application. All traffic between the two get recorded by AP LT. How does AP LT calculate the response time for a given request? AP LT keeps track of the time the request was made and the complete response was received. This time interval is the response time for that request. What does browser simulation mean? Why should I care? There are subtle differences between MS IE and Mozilla/Firefox. Depending on your user base, it often makes sense to load test your application using these two profiles. AP LT has the ability to simulate low-level port connectivity behavior of each of these browsers for more accurate load
  • 89. testing. What are pass-through parameters? How do they work? Parameters that change DURING runtime are called pass-through parameters. These parameters are fully supported in AP LT. You only need to select the pass-through in data source drop down for the parameter name to inform AP LT that this is a pass-through parameter. Then the values that are provided for the pass-through parameter while replaying a recorded test, are picked at run time so that the behavior of the application can be correctly simulated. How do I monitor the machine on which the target application is running? Please go to System Monitoring perspective and add machine to monitor. What does a "load strategy" mean ? What are the various load strategies available? Load Strategy allows you to provide various combinations of user access with respect to time and number of hits. You can choose to loop users through a test, or allow users to access the application incrementally or in a burst etc. Please see the chapter Load Strategies for more details. What is "think time"? How does it impact a test? Think time is the time a user takes to click through to the next page from the current one. If you choose to record think time and provide a value for it, then the time out value of your test will be considered after considering the think time. For example, if you have provided think time value as: 10 seconds and time out value as: 20 seconds, then AP LT will wait for a total of 30 seconds before it times out a task. How do I generate reports and track trends? These features are part of AppPerfect Test Manager product. How does AP LT determine if a request is a success or a failure? Depending on the type of test, definition of successful or failed hit varies: q HTTP Test: AP LT checks for the response code to determine success or failure. For the most part, response codes 100 through 399 are considered success. Code 400 and above are considered failed requests. If additional validation has been specified, those are used to validate tests as failed or successful. q Database Test: Based on validations specified, those are used to validate tests as failed or successful. I want to schedule AP LT to run at a set time in the future. How do I do that? Scheduling of Load Test can be achieved using AppPerfect Test Manager product.
  • 90. Can I run AP LT on multiple machines and simultaneously test the same target application? Yes, it can be done by configuring tool to Run project simultaneously on multiple machines at Project -> Properties.. -> Machine Settings Can I configure AP LT for monitoring CPU, Memory, Disk performance data from 2 target servers? Yes, you can monitor as many machines as you want by configuring System monitoring at Project - > Properties.. -> Machine Settings. How do I relate the system monitoring data i.e. CPU, Memory, Network usage, and disk activity to the tasks in action groups? The purpose is to analyze data e.g. if there was a peak in disk activity, what task was being performed? The analysis of data needs to be done manually. Lets say you see peak in disk activity after 30 seconds from test start, now you need to look at each task detail and see what was the task getting hit at that time. You can select individual task details and look at Hit count chart and see which task was getting executed at that time. I configured a Load Test to run for 5 minutes. However it did not stop after 5 minutes, I had to stop the test manually after several minutes. Why is that? This is likey to happen in case you are using Loop Strategy for the test. Loop Strategy is independent of time. Each virtual user will loop through the entire test for the given number of loop counts. Please change the strategy to any other type to stop test in 5 minutes. I have downloaded the evaluation version of AppPerfect LoadTest. I am trying to execute the tasks mentioned in the Load Test tutorial using the bundled PetStore project, but no tasks are getting recorded under ActionGroup. Is recording supported in Evaluation version? Yes, recording is supported in Evaluation version as well. Please make sure the Proxy Settings are properly configured in the browser as AP LT uses the proxy server to record tests. Start recording in Load Test. Once the browser is launched, check the proxy settings of the browser (Tools -> Internet Options... Connections tab, LAN settings). Incase of Internet Explorer, check if "Bypass proxy settings for local address" option is selectd. If yes, then deselect that option. Similarly, if you are using Firefox or Netscape browser check if "localhost,127.0.0.1" is present in the "No proxy for" field of the Connection Settings dialog. Remove the same if present and then continue recording. It should work. I tested AP LT with a web application with Oracle database in the backend. I faced a problem regarding the database getting full. Is there any facility to rollback changes in the database? Since Load Testing simulates the real time environment, and while loadtesing all we do is fire all the http requests that were recorded. So if these requests are resulting in doing any database interaction at application side then this needs to be handled at application side itself. Since DB transaction could also result in peformance bottleneck so removing database transaction from the application side for LoadTesting is not correct solution. What you can do is one of the following::
  • 91. 1. The Best way to deal with this problem is also record tasks that would delete the entries that were added. So basically if you do some action on your webpage which results in addition of few details to database, so in case there is also front end available to delete those recorded entries from DB then record the tasks for that as well. This way Load Test will execute all the tasks resulting in addition and deletion of database entries, hence clearing the data automatically. 2. For testing purpose you can create a dummy database and set your application to use that instead of your production database. Or You can write scripts at you server side which would clear database after the Load testing is completed. What are the differences between AP Pro vs. AP Std as far as the Load Test is concerned? Please visit AppPerfect to view the table of differences between the two versions. I'm getting an error again and again. I've tried everything, but I'm stuck. What should I do? q Close the currently opened project if it is open. Stop and close the application if it is running. q Go to Tools ->Options-> Log Settings. Make sure the settings selected for all the products is: Debug (not Fatal). q Open the project. Perform the operations that are giving you the error. The moment you get the error, stop all operations and send us the following files: 1. All files present in <LoadTest_Home>logs folder. 2. Project file i.e. *.adt file of that project. 3. Build number of the application. (Help->About AppPerfect...)
  • 92. Load Testing an Web Application / Server This tutorial provides a brief introduction to the Load Test product using a set of hands-on practice exercises. This tutorial assumes you have successfully downloaded and installed AppPerfect Load Test on your machine with the default options. Apart from this pre-requisite, this tutorial is self contained. Instructions given below are Windows-specific; if you are using a non-Windows machine, please use equivalent commands/instructions. This document is divided into following sections 1. Creating Project 2. AppPerfect Load Test Within each section, multiple exercises are listed. Each exercise forms a logical unit which is expected to take no more than a few minutes to perform. All exercises use the PetStore demo application running inside Apache Tomcat. The modified PetStore application and Tomcat are both bundled with this product. All exercises assume you have installed the product in C:AppPerfectLoadTest folder and will be referred as LoadTest_HOME henceforth in tutorial. If you have installed the product in some other folder, modify the instructions below appropriately. This tutorial is not intended as a comprehensive training guide. Please refer to the product documentation for detailed information. However, this tutorial will give you a very good overview of the products and substantially improve your productivity with the product. Creating Project Exercise 1: Launch AppPerfect Load Test 1. Click on Start -> Programs ->AppPerfect Load Test x.x.x -> AppPerfect Load Test 2. On launching AppPerfect Load Test a Welcome page will be displayed. Go through the brief description given for product. NB: Welcome page is displayed only when Load Test x.x.x is launched and last time no project was opened. Exercise 2: Creating a Project 1. Launch the Project Wizard by clicking File ->New... menu option. The New Project wizard will be launched. 2. Keep the default project name and location for the purpose of this exercise. We don't have to provide "Notification" settings. Click on the OK button. 3. A confirmation message saying that the project is saved will be displayed. Click on the OK
  • 93. button. Now using this project we will create tests to demonstrate the functionalities of AppPerfect Load Test product. AppPerfect Load Test NB:Please follow the steps provided in the "Creating Project" section to first create a project, then proceed further. Exercise 1: Define a Load Test project 1. Once the project is successfully created another dialog - Define Project Properties dialog - will be displayed. 2. Keep the default settings as shown in this dialog i.e., Test Duration:1min, Run Type:Burst, Virtual Users:10. 3. Go through the description given for Burst run type at the bottom. 4. Review other settings in the Panel and click on the OK button to close this dialog. 5. Click through all the menu items to familiarize yourself with the available features and how to access them. Viewing through all menu items will give a reasonable overview of the application. 6. Click Help -> Table of Contents menu item to see AppPerfect Load Test product documentation 7. Open the Preferences dialog by selecting the menu option Tools -> Options... 8. Review the default settings for Load Test and click the OK button to close the dialog. Exercise 2: Recording a Test 1. Start tomcat server by selecting Start->Programs->AppPerfect Load Test x.x.x- >Documentation and Examples->Examples->Tomcat running Petstore->Start Server. 2. To start recording, click on Project -> Record test... in the menu bar.' 3. 'Record a test' dialog will be displayed. Select ActionGroup1 from the Group combo. Provide starting URL as "http://localhost:8396/petstore". In the authentication select "No Authentication". Click on 'Start recording' button to start recording test. 4. An instance of configured browser will be launched with the PetStore home page loaded. Click on enter the store link. This will populate the database and display the PetStore main page. Note that populating the database might take some time. 5. Click on each link on the left: Birds, Reptiles, Dogs, Cats, Fish 6. Order an item by clicking on: Birds -> Amazon Parrot -> Adult Male Amazon Parrot -> Add to cart 7. Modify the quantity and click on Update Cart button. 8. Check out by clicking on the Check Out link. 9. At the 'Sign in' page, default values are already provided. Click on Submit.
  • 94. 10. Sign out of PetStore by clicking on Sign-out at top right of screen. 11. Close browser by clicking on File -> Close in the browser window. 12. Click on the Stop button of "Record a test" dialog to stop the recording session. 13. Click on Close button to close the 'Record a test' dialog. 14. The URLs navigated will be displayed under ActionGroup1. 15. Click through each Tasks to view its details on the panel on the right. Exercise 3: Executing a test 1. To execute the test, click on Project -> Run from the menubar. 2. The focus will be shifted to Status tab. Here the current status of the test execution will be displayed. Various test metrics such as response time, virtual user count, etc. are continuously refreshed in the charts. 3. The test will run for 1 minute as specified when project was created. 4. Stop running tomcat server by selecting Start->Programs->AppPerfect Load Testx.x.x- >Documentation and Examples->Examples->Tomcat running Petstore->Stop Server. Exercise 4: View and analyze result 1. Once the test is completed, the test results will be displayed in the "Results" tab and result summary data is displayed in the main window on the right. 2. Since no error was detected during our test execution, the result of our test execution was "Successful". Additional details about hit count, etc. is also displayed. 3. View various result summaries by clicking on the items in the tree on the left in the Results tab
  • 95. Run Project Simultaneously on Multiple Machines This tutorial provides a brief introduction how to distribute load on multiple machines using AppPerfect Load Test using a set of hands-on practice exercises. This tutorial assumes you have successfully downloaded and installed AppPerfect Load Test on multiple machines with the default options. For this tutorial we will assume that you have installed product on three machines, MachineA, MachineB and MachineC. Apart from this pre-requisite, this tutorial is self contained. Instructions given below are Windows-specific; if you are using a non-Windows machine, please use equivalent commands/instructions. This document is divided into following sections 1. Creating Project 2. AppPerfect Load Test Within each section, multiple exercises are listed. Each exercise forms a logical unit which is expected to take no more than a few minutes to perform. All exercises use the PetStore demo application running inside Apache Tomcat. The modified PetStore application and Tomcat are both bundled with this product. All exercises assume you have installed the product in C:AppPerfectLoadTest folder and will be referred as LoadTest_HOME henceforth in tutorial. If you have installed the product in some other folder, modify the instructions below appropriately. This tutorial is not intended as a comprehensive training guide. Please refer to the product documentation for detailed information. However, this tutorial will give you a very good overview of the products and substantially improve your productivity with the product. Creating Project Exercise 1: Launch AppPerfect Load Test 1. Click on Start -> Programs ->AppPerfect Load Test x.x.x -> AppPerfect Load Test 2. On launching AppPerfect Load Test a Welcome page will be displayed. Go through the brief description given for product. NB: Welcome page is displayed only when Load Test x.x.x is launched and last time no project was opened. Exercise 2: Creating a Project 1. Launch the Project Wizard by clicking File ->New... menu option. The New Project wizard will be launched. 2. Keep the default project name and location for the purpose of this exercise. We don't have to provide "Notification" settings. Click on the OK button.
  • 96. 3. A confirmation message saying that the project is saved will be displayed. Click on the OK button. Now using this project we will create tests to demonstrate the functionalities of AppPerfect Load Test product. AppPerfect Load Test NB:Please follow the steps provided in the "Creating Project" section to first create a project, then proceed further. Exercise 1: Define a Load Test project 1. Once the project is successfully created another dialog - Define Project Properties dialog - will be displayed. 2. Keep the default settings as shown in this dialog i.e., Test Duration:1min, Run Type:Burst, Virtual Users:10. 3. Go through the description given for Burst run type at the bottom. 4. Select the Machine Settings tab and select the check box saying "Run project simultaneously on multiple machines". 5. Lets assume you are configuring this project on machineA, so add MachineB and MachineC to list here. Click on button "Add host information" and add MachineB & MachineC. Please note that Load Test service "APPLoadTest" should be running on remote machines to allow MachineA to connect to those machines. By default APPLoadTest service runs on port 8874. Please specify number of virtual users you want to run from MachineB and MachineC. You can edit/delete any machine in future by visiting project properties dialog, also its possible to ignore some machine during test execution. 6. Review other settings in the Panel and click on the OK button to close this dialog. 7. Click through all the menu items to familiarize yourself with the available features and how to access them. Viewing through all menu items will give a reasonable overview of the application. 8. Click Help -> Table of Contents menu item to see AppPerfect Load Test product documentation 9. Open the Preferences dialog by selecting the menu option Tools -> Options... 10. Review the default settings for Load Test and click the OK button to close the dialog. Exercise 2: Recording a Test 1. Start tomcat server by selecting Start->Programs->AppPerfect Load Test x.x.x- >Documentation and Examples->Examples->Tomcat running Petstore->Start Server. 2. To start recording, click on Project -> Record test... in the menu bar.' 3. 'Record a test' dialog will be displayed. Select ActionGroup1 from the Group combo. Provide starting URL as "http://<IP Address / HostName>:8396/petstore". Please note that it is very important to provide proper IP address or hostname in the URL as this test is going to
  • 97. run from multiple machines it should be able to resolve the URL from all machines. Do not provide IP as 127.0.0.1 or host as localhost in the URL. In the authentication select "No Authentication". Click on 'Start recording' button to start recording test. 4. An instance of configured browser will be launched with the PetStore home page loaded. Click on enter the store link. This will populate the database and display the PetStore main page. Note that populating the database might take some time. 5. Click on each link on the left: Birds, Reptiles, Dogs, Cats, Fish 6. Order an item by clicking on: Birds -> Amazon Parrot -> Adult Male Amazon Parrot -> Add to cart 7. Modify the quantity and click on Update Cart button. 8. Check out by clicking on the Check Out link. 9. At the 'Sign in' page, default values are already provided. Click on Submit. 10. Sign out of PetStore by clicking on Sign-out at top right of screen. 11. Close browser by clicking on File -> Close in the browser window. 12. Click on the Stop button of "Record a test" dialog to stop the recording session. 13. Click on Close button to close the 'Record a test' dialog. 14. The URLs navigated will be displayed under ActionGroup1. 15. Click through each Tasks to view its details on the panel on the right. Exercise 3: Executing a test 1. To execute the test, click on Project -> Run from the menubar. 2. Application will show a remote configuration dialog showing the status of project getting transferred and configured on alll machines. Once project is properly configured on all machines, the focus will be shifted to Status tab. 3. Here the current status of the test execution will be displayed. You can see status of all machines here. Various test metrics such as response time, virtual user count, etc. are continuously refreshed in the charts. 4. The test will run for 1 minute as specified when project was created. 5. Stop running tomcat server by selecting Start->Programs->AppPerfect Load Testx.x.x- >Documentation and Examples->Examples->Tomcat running Petstore->Stop Server. Exercise 4: View and analyze result 1. Once the test is completed, the test results will be displayed in the "Results" tab and result summary data is displayed in the main window on the right. Results for all machines will be shown under Machines node. 2. Since no error was detected during our test execution, the result of our test execution was "Successful". Additional details about hit count, etc. is also displayed. 3. View various result summaries by clicking on the items in the tree on the left in the Results tab
  • 98. Parameterizing A Load Test This tutorial provides a brief introduction to the parameterization of a Load test using a set of hands- on practice exercises. This tutorial assumes you have successfully downloaded and installed AppPerfect Load Test on your machine with the default options. Apart from this pre-requisite, this tutorial is self contained. Instructions given below are Windows-specific; if you are using a non- Windows machine, please use equivalent commands/instructions. This document is divided into following sections 1. Creating Project 2. AppPerfect Load Test Within each section, multiple exercises are listed. Each exercise forms a logical unit which is expected to take no more than a few minutes to perform. All exercises use the PetStore demo application running inside Apache Tomcat. The modified PetStore application and Tomcat are both bundled with this product. All exercises assume you have installed the product in C:AppPerfectLoadTest folder and will be referred as LoadTest_HOME henceforth in tutorial. If you have installed the product in some other folder, modify the instructions below appropriately. This tutorial is not intended as a comprehensive training guide. Please refer to the product documentation for detailed information. However, this tutorial will give you a very good overview of the products and substantially improve your productivity with the product. Creating Project Exercise 1: Launch AppPerfect Load Test 1. Click on Start -> Programs ->AppPerfect Load Test x.x.x -> AppPerfect Load Test 2. On launching AppPerfect Load Test a Welcome page will be displayed. Go through the brief description given for product. NB: Welcome page is displayed only when Load Test x.x.x is launched and last time no project was opened. Exercise 2: Creating a Project 1. Launch the Project Wizard by clicking File ->New... menu option. The New Project wizard will be launched. 2. Keep the default project name and location for the purpose of this exercise. We don't have to provide "Notification" settings. Click on the OK button. 3. A confirmation message saying that the project is saved will be displayed. Click on the OK
  • 99. button. Now using this project we will create tests to demonstrate the functionalities of AppPerfect Load Test product. AppPerfect Load Test NB:Please follow the steps provided in the "Creating Project" section to first create a project, then proceed further. Exercise 1: Define a Load Test project 1. Once the project is successfully created another dialog - Define Project Properties dialog - will be displayed. 2. Change the default settings as shown in this dialog as Test Duration:1min, Run Type:Loop, LoopCount:3, Virtual Users:1. 3. Go through the description given for Loop run type at the bottom. 4. Review other settings in the Panel and click on the OK button to close this dialog. 5. Click through all the menu items to familiarize yourself with the available features and how to access them. Viewing through all menu items will give a reasonable overview of the application. 6. Click Help -> Table of Contents menu item to see AppPerfect Load Test product documentation 7. Open the Preferences dialog by selecting the menu option Tools -> Options... 8. Review the default settings for Load Test and click the OK button to close the dialog. Exercise 2: Creating required parameters To demonstrate parameterization, we will consider the "Account" page of Petstore which has a login page that takes a user name and a password. For this we will be defining three different parameters values each for login and password to be used while replaying the test. 1. Start tomcat server by selecting Start->Programs->AppPerfect Load Test x.x.x- >Documentation and Examples->Examples->Tomcat running Petstore->Start Server. 2. In IE, enter the URL to load the petstore app. i.e. "http://localhost:8396/petstore" 3. Click on link "enter the store". 4. Click on link "Account". 5. Here, Under "No. I would like to sign up for an account.", create three user accounts. For this tutorial we'll assume the following three user accounts: r Account 1: username - john, password - smith. r Account 2: username - sam, password - bradley. r Account 3: username - pet, password - store.
  • 100. We shall be leaving default information for "Contact Information" on submitting the new username and password. Sign-out and repeat process to add all the usernames and passwords. 6. Finally sign-out and close the browser. Exercise 3: Recording a Test 1. To start recording, click on Project -> Record test... in the menu bar.' 2. 'Record a test' dialog will be displayed. Select ActionGroup1 from the Group combo. Provide starting URL as "http://localhost:8396/petstore". In the authentication select "Form based Authentication" and provide user name: "john" and password :"smith". Now Click on 'Start recording' button to start recording. 3. An instance of configured browser will be launched with the PetStore home page loaded. Click on enter the store link. This will populate the database and display the PetStore main page. Note that populating the database might take some time. 4. Order an item by clicking on: Birds -> Amazon Parrot -> Adult Male Amazon Parrot -> Add to cart 5. Check out by clicking on the Check Out link. 6. At the 'Sign in' page, under "Are You a returning customer - Yes.", enter username as john and password as smith. Click on Submit. 7. Sign out of PetStore by clicking on Sign-out at top right of screen. 8. Close browser by clicking on File -> Close in the browser window. 9. Click on the Stop Recording button of "Record a test" dialog to stop the recording session. 10. Click on Close button to close the 'Record a test' dialog. 11. The URLs navigated will be displayed under ActionGroup1. 12. Click through each Tasks to view its details on the panel on the right. Exercise 4: Configuring Parameters in Test 1. In the editor tree, select 'Parameters' to open the parameters settings table on the right hand side. 2. Here, click on 'Add Parameter' button to add a parameter. 3. In the 'Parameter Setting Dialog', enter 'userParam' as the parameter name. 4. Select 'Fixed Values - Fetch value from list of fixed values provided' as Data Source. 5. Choose 'Sequential' as parameter selection. 6. Under Add Value, enter john and click on the 'Add' button. 7. Under Add Value, enter sam and click on the 'Add' button. 8. Under Add Value, enter pet and click on the 'Add' button. 9. Click Ok. 10. Click on 'Add Parameter' button to add another parameter. 11. In the 'Parameter Setting Dialog', enter 'passParam' as the parameter name.
  • 101. 12. Select 'Fixed Values - Fetch value from list of fixed values provided' as Data Source. 13. Choose 'Sequential' as parameter selection. 14. Under Add Value, enter smith and click on the 'Add' button. 15. Under Add Value, enter bradley and click on the 'Add' button. 16. Under Add Value, enter shop(a wrong password as per the user account we created for username pet, the correct password was "store") and click on the 'Add' button. 17. Click Ok. 18. In the editor tree select the task which states something like 'Task N [/petstore/checkhimout. do]'. 19. Select parameters tab. 20. Click on the parameter name 'userName1' in the parameters table. 21. Click on the 'parameterize' button. 22. In the parameterization settings dialog, select userName1 under the name column in the parameter settings table. 23. On selection, in the value group, 'Constant' will be selected with the value john in the text box. 24. Select 'Parameterize' and from the combo box, select userParam. This will use the values of userParam as username on each iteration. 25. In the parameterization settings dialog, select passWord under the name column in the parameter settings table. 26. On selection, in the value group, 'Constant' will be selected with the value smith in the text box. 27. Select 'Parameterize' and from the combo box, select passParam. This will use the values of passParam as the password on each iteration. 28. Click Ok. Exercise 5: Executing a test 1. To execute the test, click on Project -> Run from the menubar. 2. The focus will be shifted to Status tab. Here the current status of the test execution will be displayed. Various test metrics such as response time, virtual user count, etc. are continuously refreshed in the charts. 3. The test will run for 3 loop counts as specified when project was created. 4. Stop running tomcat server by selecting Start->Programs->AppPerfect Load Testx.x.x- >Documentation and Examples->Examples->Tomcat running Petstore->Stop Server. Exercise 6: Checking Parameterization 1. Before excuting the test, open the Preferences dialog by selecting the menu option Tools -> Options... 2. Go to Log Settings and Select "Log Requests Fired" checkbox. Click on OK to save and close the dialog. 3. After the excution of test go to "LoadTest_HOME/logs" folder and look for "request.txt" file.
  • 102. 4. Open "request.txt" file in some editor and check the requests fired. Search for request "checkhimout.do" and check the parameters passed, you can see that during each run a different parameter value was passed to the server.
  • 103. Validating A Load Test This tutorial provides a brief introduction to the validation of a Load test using a set of hands-on practice exercises. This tutorial assumes you have successfully downloaded and installed AppPerfect Load Test on your machine with the default options. Apart from this pre-requisite, this tutorial is self contained. Instructions given below are Windows-specific; if you are using a non- Windows machine, please use equivalent commands/instructions. This document is divided into following sections 1. Creating Project 2. AppPerfect Load Test Within each section, multiple exercises are listed. Each exercise forms a logical unit which is expected to take no more than a few minutes to perform. All exercises use the PetStore demo application running inside Apache Tomcat. The modified PetStore application and Tomcat are both bundled with this product. All exercises assume you have installed the product in C:AppPerfectLoadTest folder and will be referred as LoadTest_HOME henceforth in tutorial. If you have installed the product in some other folder, modify the instructions below appropriately. This tutorial is not intended as a comprehensive training guide. Please refer to the product documentation for detailed information. However, this tutorial will give you a very good overview of the products and substantially improve your productivity with the product. Creating Project Exercise 1: Launch AppPerfect Load Test 1. Click on Start -> Programs ->AppPerfect Load Test x.x.x -> AppPerfect Load Test 2. On launching AppPerfect Load Test a Welcome page will be displayed. Go through the brief description given for product. NB: Welcome page is displayed only when Load Test x.x.x is launched and last time no project was opened. Exercise 2: Creating a Project 1. Launch the Project Wizard by clicking File ->New... menu option. The New Project wizard will be launched. 2. Keep the default project name and location for the purpose of this exercise. We don't have to provide "Notification" settings. Click on the OK button. 3. A confirmation message saying that the project is saved will be displayed. Click on the OK
  • 104. button. Now using this project we will create tests to demonstrate the functionalities of AppPerfect Load Test product. AppPerfect Load Test NB:Please follow the steps provided in the "Creating Project" section to first create a project, then proceed further. Exercise 1: Define a Load Test project 1. Once the project is successfully created another dialog - Define Project Properties dialog - will be displayed. 2. Change the default settings as shown in this dialog as Test Duration:1min, Run Type:Loop, LoopCount:2, Virtual Users:1. 3. Go through the description given for Loop run type at the bottom. 4. Review other settings in the Panel and click on the OK button to close this dialog. 5. Click through all the menu items to familiarize yourself with the available features and how to access them. Viewing through all menu items will give a reasonable overview of the application. 6. Click Help -> Table of Contents menu item to see AppPerfect Load Test product documentation 7. Open the Preferences dialog by selecting the menu option Tools -> Options... 8. Review the default settings for Load Test and click the OK button to close the dialog. Exercise 2: Recording a Test 1. Start tomcat server by selecting Start->Programs->AppPerfect Load Test x.x.x- >Documentation and Examples->Examples->Tomcat running Petstore->Start Server. 2. To start recording, click on Project -> Record test... in the menu bar.' 3. 'Record a test' dialog will be displayed. Select ActionGroup1 from the Group combo. Provide starting URL as "http://localhost:8396/petstore". In the authentication select "No Authentication". Click on 'Start recording' button to start recording test. 4. An instance of configured browser will be launched with the PetStore home page loaded. Click on enter the store link. This will populate the database and display the PetStore main page. Note that populating the database might take some time. 5. Order an item by clicking on: Birds -> Amazon Parrot -> Adult Male Amazon Parrot -> Add to cart 6. Check out by clicking on the Check Out link. 7. At the 'Sign in' page, default values are already provided. Click on Submit. 8. Sign out of PetStore by clicking on Sign-out at top right of screen. 9. Close browser by clicking on File -> Close in the browser window.
  • 105. 10. Click on the Stop button of "Record a test" dialog to stop the recording session. 11. Click on Close button to close the 'Record a test' dialog. 12. The URLs navigated will be displayed under ActionGroup1. 13. Click through each Tasks to view its details on the panel on the right. Exercise 3: Configuring Parameters in Test 1. In the editor tree, select 'Parameters' to open the parameters settings table on the right hand side. 2. Here, click on 'Add Parameter' button to add a parameter. 3. In the 'Parameter Setting Dialog', enter 'userParam' as the parameter name. 4. Select 'Fixed Values - Fetch value from list of fixed values provided' as Data Source. 5. Choose 'Sequential' as parameter selection. 6. Under Add Value, enter j2ee and click on the 'Add' button. 7. Under Add Value, enter john and click on the 'Add' button. 8. Click Ok. 9. In the editor tree select the task which states something like 'Task20 [/petstore/checkhimout. do]'. 10. Select 'Parameters' tab. 11. Click on the parameter name 'userName1' in the parameters table. 12. Click on the 'parameterize' button. 13. In the parameterization settings dialog, select 'userName1' under the name column in the parameter settings table. 14. On selection, in the value group, 'Constant' will be selected with the value j2ee in the text box. 15. Select 'Parameterize' and from the combo box, select userParam. This will use the values of userParam as username on each iteration. 16. Click Ok. Exercise 4: Configuring Text Validation 1. In the editor tree select the task which states something like 'Task21 [/petstore/mainscreen. do]' after the task 'Task20 [/petstore/checkhimout.do]'. 2. In the tree on the right hand side, right click and select 'Add Text Validation' in the pop-up menu. 3. This will bring up the 'Text Validation Settings' dialog. 4. Under description enter 'userNameText'. 5. Under 'Check for', select 'Exact match' and enter j2ee. 6. Click Ok. What this basically does is that when this page loads (on replaying), it will search the page for the text j2ee and if it is not found, the validation will fail. Since we have parameterized the username, on the 2nd iteration, the username passed will be john which does not exist. As a result of which, this page will not replayed as expected and the validation will fail.
  • 106. Exercise 5: Configuring Element Attribute Validation 1. In the editor tree select the task which states something like 'Task17 [/petstore/newLogin.jsp]. 2. Expand the right-hand side tree and select the element 'userName1' which will highlight the 'UserName' text box under 'Are you a returning customer - Yes'. 3. Right-click on this element and select 'Add Validation'. 4. This will bring up the 'Add Validation' dialog. Check 'Validate' for the row whose property name is 'value' and property value is 'j2ee'. 5. Click Ok. 6. Select the 'Validation' tab below. In the validation table, select the validation just added and click 'Parameterize..' button. 7. This will bring up the 'Parameterization Settings Dialog'. Here change the constant value from j2ee to john. 8. Click Ok. 9. What this basically does is that when this page loads (on replaying), it will confirm the value in the text box with john. Since in both our iterations, the initial value (when the page loads) will be j2ee, the validation will fail in both iterations. Exercise 6: Executing a test 1. To execute the test, click on Project -> Run from the menubar. 2. The focus will be shifted to Status tab. Here the current status of the test execution will be displayed. Various test metrics such as response time, virtual user count, etc. are continuously refreshed in the charts. 3. The test will run for 1 minute as specified when project was created. 4. Stop running tomcat server by selecting Start->Programs->AppPerfect Load Testx.x.x- >Documentation and Examples->Examples->Tomcat running Petstore->Stop Server. Exercise 7: View and analyze result 1. Once the test is completed, the test results will be displayed in the "Results" tab and result summary data is displayed in the main window on the right. 2. Since we configured the validation to fail, the result of our test execution was "Failed". Additional details about failed hits can be found by clicking "View Failed Hits" button in task detail results view.
  • 107. Team Server Or Repository Configuration Team Server is required to share AppPerfect projects across the team. AppPerfect provides support for Subversion(SVN) server for sharing projects across team. You need to download, install and configure SVN(Team) server manually. For Windows/Linux/Mac OSX: Please refer to following sections of document to download, install and configure SVN Server on your machine. q Manually Installing SVN Server q Manually Starting SVN Server q Manually Setting up Repository Once you have svn server installed and repository configured, you need to configure the AppPerfect client (AppPerfect Web Test / Load Test / App Test / Java Code Test / Java Unit Test / Java Profiler) so that client application can access the SVN server for sharing projects q Configuring AppPerfect client application to access SVN Server Once you have AppPerfect client configured with SVN Server settings, you can access following features of SVN Server using File -> Repository menu from AppPerfect Client. q Checkout Projects q Synchronize Workspace q Share Project q Synchronize Project q Synchronize Rules Manually Installing SVN Server Get the latest version of SVN server binary as per your platform from http://subversion.tigris.org/ project_packages.html. Follow the installation instructions for SVN server and install the server on the machine. Manually Starting SVN Server Once you have SVN server installed, we need to start same so that AppPerfect client application can access the same. To start SVN server, make SVN home as current directory and run the following command :
  • 108. On windows svnserve -d --foreground --listen-port 8747 --listen-host localhost On non-windows ./svnserve -d --foreground --listen-port 8747 --listen-host localhost In case port 8747 is occupied, you can use any other free port. Note : In case repository is created on different partition then the one from where server is started, then you need to start server with --root option. For eg., server is running from C: and you have SVN repository created on D: then start server using following commmand: svnserve -d --foreground --root D: --listen-port 8747 --listen-host localhost You can also use command line script files created in "svnserver" folder inside Test Manager home. Manually Setting up Repository Repository is the central location where all the projects and its revisions are stored and clients can access the same and synchronise the local copy of project with the one stored in the Repository, thus allowing multiple users in a SVN to share projects with each other. You need to follow following steps to set up a Repository q Creating SVN Repository q Configuring SVN Repository Creating SVN Repository You can create a repository using following command : On Windows:- svnadmin create %REPOSITORY_PATH% On Linux/Solris/Mac OSX:- ./svnadmin create $REPOSITORY_PATH Where REPOSITORY_PATH is the path on local machine where the projects will be stored for sharing. For example On Windows svnadmin create C:AppPerfectRepository This will create Repository in folder "C:AppPerfect". You will be required to provide path as / AppPerfect/Repository while configuring SVN Server in AppPerfect client applications. On Linux/Solris/Mac OSX /.svnadmin create /opt/AppPerfect/Repository This will create Repository in folder "/opt/AppPerfect". You will be required to provide path as /opt/ AppPerfect/Repository while configuring SVN Server in AppPerfect client applications. Configuring SVN Repository Once you have repository created, we need to configure it so that only authorised users can access it. To configure the repository we have a utility class com.appperfect.util. RepositoryConfigurationUpdater shipped inside apcommon.jar. Set classpath as shown below : set CLASSPATH=%CLASSPATH%;%ENTERPRISESERVER_HOME%/tomcat/webapps/
  • 109. AppEnterpriseServer/WEB-INF/lib/apcommon.jar; Once you have classpath set, run the following java command, make sure you have java binary in the PATH : On Windows:- java com.appperfect.util.RepositoryConfigurationUpdater %REPOSITORY_PATH% % SVN_USERNAME% %SVN_PASSWORD% Note : REPOSITORY_PATH would be location where we created Repository, for ex, F: AppRepository, Use back slash () as path separator and not forward slash. On Linux/Solris/Mac OSX:- java com.appperfect.util.RepositoryConfigurationUpdater $REPOSITORY_PATH $SVN_USERNAME $SVN_PASSWORD where REPOSITORY_PATH would be location where we created Repository, for ex, F: AppRepository SVN_USERNAME is the user who can access the Repository, for example, admin SVN_PASSWORD is the password required to access the Repository, for example, admin Configuring AppPerfect client application to access SVN Server Once you have repository setup you can access the same from AppPerfect products, You just need to provide the SVN configuration settings to AppPerfect client. Start the AppPerfect Product (AppPerfect Web Test / Load Test / App Test / Java Code Test / Java Unit Test / Java Profiler) and go to Tools -> Options -> Server Connection and Configure the Repository Settings. Provide the Machine IP/Host Name (where you have installed the SVN server), Port, Repository path and user details as per the settings you configured in earlier steps. Note : If repository is created at C:AppPerfectEnterpriseServerAppRepository then connection url will be of form : svn://127.0.0.1:8747/AppPerfect/EnterpriseServer/AppRepository. OR If repository is created at /opt/AppPerfect/EnterpriseServer/AppRepository then connection url will be of form : svn://127.0.0.1:8747/opt/AppPerfect/EnterpriseServer/AppRepository. So you need to provide the complete path for the repository here. Now you can share, synchronise, commit, update projects/workspace to the AppPerfect repository. Check out File -> Repository menu for the functionalities you can perform from AppPerfect client. Checkout Projects Using AppPerfect Client you can checkout projects on your local machine from SVN repository using File -> Repository -> Checkout Project... option. It will launch the checkout wizard, select the project you need to check out on local machine and follow the instructions in checkout wizard. Synchronize Workspace
  • 110. Using AppPerfect Client you can synchronize local copies of all projects in the workspace with the projects stored in SVN repository using File -> Repository -> Synchronize Workspace... option. It will launch the Syncrhonize dialog, you can compare the local changes with the one stored in repository and take appropriate action to commit or update. Share Project Using AppPerfect Client you can share local copy of the project with SVN repository using File -> Repository -> Share Current Project... option. For performing any commit or synchronize action you need to share the project first. Synchronize Project Using AppPerfect Client you can synchronize local copy of currently opened project with the project stored in SVN repository using File -> Repository -> Synchronize Current Project... option. It will launch the Syncrhonize dialog, you can compare the local changes with the one stored in repository and take appropriate action to commit or update. Synchronize Rules Using AppPerfect Java Code Test, you can synchronize local copy of system settings with the settings stored in SVN repository using File -> Repository -> Synchronize Rules... option. It will launch the Syncrhonize dialog, you can compare the local changes with the one stored in repository and take appropriate action to commit or update.
  • 111. AppPerfect™ Load Test v 10.5.0 Scripting User Guide Copyright (C) 2002-2009 AppPerfect Corporation. All rights reserved. AppPerfect is a trademark of AppPerfect Corporation. Java is a trademark of Sun Microsystems, Inc.
  • 112. AppPerfect Load Test Introduction AppPerfect Load Test helps you design and simulate usage traffic which can be used to test your application infrastructure for performance, reliability and scalability. AppPerfect Load Test targets the most commonly used application infrastructure: Web applications and databases. The overwhelming majority of software being developed today is designed to work with a Web- based (HTML) interface. AppPerfect Load Test helps design and simulate HTTP requests (URLs) which can be targeted at your Web application infrastructure (Web server, J2EE AppServer.). The software being developed today predominantly use databases as their data persistence mechanism. AppPerfect Load Test helps you design and simulate database queries (using JDBC) and target most commonly used databases. As server-based, multi-tiered and distributed applications continue to supplant desktop-based applications, it has become increasingly important for software developers to test the entire application infrastructure to ensure it performs within acceptable parameters. Application behavior while serving multiple users often varies drastically from the same application's behavior while serving a single user. This document helps you create the test by creating a Javascript file. Although it is possible to create/edit a test through UI, Scripting support provides user advanced features which are not possible through UI For e.g. writing a user-defined function to perform various actions in between execution of two task(s). Performing custom validations. AppPerfect Load Test provides extensive APIs for processing the DOM tree of the HTML response received after executing a task. User gets a control over execution of the test while it is being replayed. The document is targeted for advanced users having knowledge of JavaScript language and using Java APIs. A script variable "engine" represents the Load Test scripting engine is available in global scope. Need for AppPerfect Load Test Most developers face the following questions when designing a server-based multi-user system: q Do you know the number of concurrent users that your application can safely support? q Will your application scale as more users access it? q Do you know how long it would take a visitor to receive a page? q Do you know the load point where your server crashes? q Is your current hardware sufficient to meet your predicted demand? If no, what additional hardware would you need? AppPerfect Load Test is designed to answer these and other similar questions.
  • 113. AppPerfect Load Test Key Features AppPerfect Load Test offers you a variety of features for easing the burden of load testing and promoting a realistic test environment. q Browser recording: You can use the browser recording facility to create the tests as you would normally work with your application. There is no need to learn any proprietary scripting language. You can then edit and run the test fast and easily. All web browsers are supported for recording, including Internet Explorer, Netscape, Mozilla, and Firefox. q UI based editing of tests: The UI is easy to use and allows you to edit your existing test as well as add new URLs and parameters to the test. You can quickly modify your tests and easily build on the Test Cases as and when additional functionality is added to your products q Central Controller: You can run distribute load on multiple machines and can control the test from one central machine. You can specify number of virtual users each machine should run allowing you to control your test better. At the end of execution application will present the result of entire test as well as individual machines in the results. q Scripting Support: For advanced user AppPerfect Load Test provides scripting language support. The scripting language used is simple java script, users can view/edit the test using script editor provided. Users can customize a test as much as they want using java script. q Parameterized Tests: In real world scenario, for any Web-based application, the pages that are requested are not all static. In fact, most of the pages accept some parameters as input and then correspondingly show the appropriate customized content. Parameterized tests feed these parameters automatically to the request and thus help simulate a more realistic usage environment. q Five different run strategies supported: AppPerfect Load Test supports five different types of strategies, that help you determine the breaking point of your application, and how it recovers after being stressed to some level. Each of the strategies determines how the URLs are fired and what is the load applied on the server being tested. q Response Validation: You can validate the responses received for a URL request with the AppPerfect Load Test. You can customize what constitutes a valid or invalid response for an URL request. Response codes can be included to constitute valid or erroneous responses. q Support for basic authentication, cookies, SSL: With the AppPerfect Load Test, you can test URLs that require basic authentication as well as those using HTTPS by allowing the configuration of the SSL Provider. It also handles the sending of cookies with the appropriate requests and supports URL rewriting if your application uses it. Two way SSL authentication is also supported. q Support for Browser Simulation, Network bandwidth and IP addresses: With the AppPerfect Load Test, you can test simulate virtual user behave as browser. Browser simulation for Internet Explorer and Firefox is supported currently. You can limit bandwidth of virtual user for various speeds as 56K to unlimited. You can also configure to run each virtual user from a different IP address. q Importing of tests: AppPerfect Load Test can import a test that has been created using the AppPerfect Functional Tester. This makes it easy for a user to create a test instead of replicating the effort of creating a test, the test can be imported and a load test generated for the URLs in that test.
  • 114. q Informative reports and Custom report designer: The application provides reports that help you pin point failure points of the test. These reports are available through the UI and can be exported into 3 different formats: HTML, PDF and CSV. In addition, Test Status Reports help you monitor the progress of the test as it executes. Load Test also provides a utility called Analytics which is basically a custom report designer to help user design their own custom reports. Product comes with lot of system reports defined in Analytics to help user understand how they can design their own reports. q Trend Analysis: AppPerfect Load Test provides a utility called Trend Analytics to generate trend reports for load testing of your application. This utility takes multiple result files and generates trend charts and reports based on the data found. q Scheduling of tests: You can schedule your tests with the AppPerfect Load Test. You do not have to be physically present to start the test. The whole process is automated so you can schedule a test to run in the night and have a look at the results the next day and then correct any errors found by the test. q Notification of results: You can configure AppPerfect project to notify results using Email or custom notification mechanism. In case of Email notification you can specify whether you want results as attachement and AppPerfect will export the results as HTML file and send the same as attachement with the mail. q IDE Integration: AppPerfect Load Test supports IDE integration with most commonly used IDEs. This enhances ease-of-use and productivity. Currently supported IDEs are Eclipse, NetBeans, IntelliJ, JBuilder, JDeveloper and Workshop. q ANT Integration and Command line execution: AppPerfect Load Test supports ANT Integration and command line execution so you can load test your application by invoking product by running ANT script or by running bat/sh file. About AppPerfect Products AppPerfect offers following products for complete and comprehensive solution for testing and monitoring the performance of your application. These products that are designed to help you test your application throughout the development life-cycle. AppPerfect Java Unit Test: AppPerfect Java Unit Test is a feature-rich wrapper for the popular JUnit and HtmlUnit testing frameworks for non-web and web-based Java projects respectively. It provides the Java programmer with an easy to use and fully customizable unit-testing environment, which can be integrated with popular Java IDEs as well as the project's build process. AppPerfect Java Code Test: AppPerfect Java Code Test reads your software code and analyzes it for optimization, errors, coding conventions, complexity and style based on industry-standard rules. Over 750 pre-defined, high-value rules can be applied to your code. AppPerfect Java Code Test is an ideal tool to perform code reviews on an on-going basis to ensure high quality of code. AppPerfect Java Profiler:
  • 115. AppPerfect Java Profiler profiles a Java Virtual Machine to assist you in understanding the behavior of your application as it performs its functions. AppPerfect Java Profiler recognizes that your application does not operate in a vacuum and hence provides a unique blend of Java information combined with operating system information. AppPerfect App Test: AppPerfect App Test performs regression and functional testing of your Windows/Desktop applications. Performing manual functional testing by having a person sit and manually click away at the application is extremely expensive and error-prone. AppPerfect App Test provides the means to perform such labor-intensive activity in an automated manner. AppPerfect Web Test: AppPerfect Web Test performs regression and functional testing of your Web applications. Performing manual functional testing by having a person sit and manually click away at the application is extremely expensive and error-prone. AppPerfect Web Test provides the means to perform such labor-intensive activity in an automated manner. AppPerfect Load Test: AppPerfect Load Test is a stress/load testing tool that can simulate hundreds of virtual users from a single machine. Features supported include site recording, dynamic variable substitution, cookies support, session tracking, SSL support and run strategies. It can run tests based on a variety of strategies such as burst, incremental, exponential, quadratic or loop. It also provides you a comprehensive solution to monitor various attributes of various operating systems present in your application infrastructure. AppPerfect Test Manager: The AppPerfect Test Manager is central server with a Web-based UI for accessing various modules in the server. AppPerfect Test Manager consists of five main modules: Requirements Manager: This module is used to create requirement specifications around which your tests will be designed and executed. Functional, business, performance, technical and usability requirements should be defined here to ensure the tests cover all defined criteria. Test Manager: Once tests have been designed, the Test Manager can be used to manage the execution of your tests. Automatically running tests on a specific schedule, notification of test results, saving of test results, etc. can be defined in this module. Results Manager: Once results for your various tests have run a few iterations, the Results Manager can be used to manage the archived results. Trend Analysis of multiple results to detect key quality trends is a key feature of this module. Storage management can also be performed via this module.
  • 116. Issues Manager: As tests are run, issues such as defects, enhancements, modifications, etc. will occur. This module can be used to create and track such issues. This module is designed as a light- weight issues manager that seamlessly integrates with the rest of the server and is not intended to replace full-featured issues management system. License Manager: Floating/site licenses are managed using this module. This module acts as the central manager for issuing and reclaiming floating licenses for the AppPerfect products. AppPerfect Agentless Monitor: The AppPerfect Agentless Monitor is an agentless, Web-based monitoring solution. It helps you monitor your applications and the underlying system resources. The AppPerfect Agentless Monitor consists of: AppPerfect Monitor: A pure Web-based solution that helps you monitor your application infrastructure. Provides a rules engine to define alerts: a notification server for email and SMS notifications. Also includes a powerful report designer to create custom reports to analyze and understand the performance data. AppPerfect Monitors: A series of modules designed to support specific devices. AppPerfect Monitor does not use the traditional agents-based approach to monitoring. Apart from being expensive, agents-based approach is also highly complex and error-prone. AppPerfect Monitors are designed to impose negligible overhead on the monitored system. These monitors are superbly optimized programs providing the maximum amount of information while imposing the lowest possible overhead. Currently, the following devices are supported: q Java/J2EE App Servers (Tomcat, WebLogic, WebSphere, etc.) q Operating Systems Resources (Windows, Linux, Mac OS X) q Databases (Oracle, MySQL, MS SQL, DB2, Sybase) q Web Servers (Apache HTTP Server, MS IIS) q SNMP Monitors (v1 and v2) q Ping Monitor (Device heartbeat monitor) q Mail Server (MS Exchange) About AppPerfect Corporation AppPerfect Corporation is an independent software development company dedicated to providing the developer community with the best-in-class tools throughout the entire software life-cycle. Our aim is to be your primary vendor for most of your development- and deployment-tool needs. Our mission is to help you reduce your software development costs, increase your productivity and help improve the availability and scalability of your applications. Please visit us on the Web at www. AppPerfect.com for more information.
  • 117. Building a Web Project The steps to create a Web project are as under: q Project q Project Function Project If you are creating a Load Test project from scratch without visiting Load Test perspective for a project then you need to do the following: 1. Register an entry for LoadTest in the project file (*.awt). Open the project file present in the project location with an extension AWT and name same as project name e.g. NewProject. awt. Add an entry <Product id="com.appperfect.loadtester.readerwriter"> above the <Project> tag if such an entry is absent. 2. Creating a new script file with the name same as project and appending "_lt.js" to it. e.g. NewProject_lt.js 3. Defining global function calls and declaring project_function. Open the script file in an editor and add following entries to the file and save it: importPackage(Packages.com.appperfect.devcommon.script); importPackage(Packages.com.appperfect.loadtester.script); var engine; //Variable to store instance of ScriptEngine Instance function project_function() // script function for Load Test project NewProject { var loadtest = engine.createLoadTest(); } This will create a default LoadTest project. We will learn more about project_function in the next section. The import statements is to inform scripting engine to import & use various data structures / classes present in mentioned packages. function project_function( ) This function configures the Load Test as a whole. It configures the run strategy, no of group along with group settings. It also defines test parameters and configures virtual users. First task is to create the load testing project using following statement: var loadtest = engine.createLoadTest(); There is a restriction that the name of the project variable must be loadtest. The script file is parsed to keep script & UI in synchronization. Once the Load test is created we will configure it by calling various APIs on it.
  • 118. q Defining duration of the test. Duration of the test can be set based on time or based on total no. of hits. Time based test will terminate when the test runs for the defined duration of time. Duration of the test can be set using following APIs: 1. void setRunDurationInTime(int minutes); 2. void setRunDurationInTime(int hours, int minutes); 3. void setRunDurationInTime(int days, int hours, int minutes); e.g. loadtest.setRunDurationInTime(1/*minutes*/); configures the test to run for one minute. Hits based test runs till the no. of hits are achieved and then stops the test execution. This can be set using following API: 1. void setRunDurationInHits(int hitStrategy, int hitCount); where hit strategy can take value ILoadTest.HITS_PER_USER or ILoadTest.TOTAL_HITS. e.g. loadtest.setRunDurationInHits(ILoadTest.TOTAL_HITS, 25); configures the test to run till the total no. of hits reach 25. Please note that a test can be configured based on time or hits, not both. The last settings will over-write the previous settings. q Defining strategy of the test. Load Test support five different execution strategies viz; Burst, Loop, Incremental, Quadratic and Exponential. You should select a strategy to load test you server which matches as closely as the real life scenario. Each startegy can be selected using seperate API as follows: r void setBurstStrategy(int users); to set Burst strategy where in users virtual users will start executing the tasks from the start of the test. This strategy tests application for sudden loads. r void setLoopStrategy(int users, int loopCount); to set Loop strategy where in users will start executing the tasks and will execute each task loopCount no. of times. This strategy tests application for sequential load a fixed number of times. r void setIncrementalStrategy(int users, int increment, int maxUsers, int incrementInterval); to set Incremental strategy where in users will start executing the tasks and will execute each task till the end of the test. After every incrementInterval seconds incrementno of new users start executing the test. This continues till maxUsers users are executing the test. This strategy tests application to reach its breaking point when the load increases gradually. r void setExponentialStrategy(int users, int maxUsers, int incrementInterval); to set Exponential strategy where in users will start executing the tasks and will execute each task till the end of the test. After every incrementInterval seconds new users add to test exponentially and start executing the test. This continues till maxUsers users are executing the test. This strategy is also used to test the application to reach its breaking point. But here, the load increases in leaps. r void setQuadracticStrategy(int users, int increment, int incrementInterval); to set Quadratic strategy where in users will start executing the tasks and will execute each task till the end of the test. After every incrementInterval seconds either new increment users will start executing the tasks or increment users will stop executing the test as per the quadratic equation. This startegy tests application's recovery from a period of increasing loads. q Ramp up time. Use void setRampUpTime(int seconds); to set the ramp up time for setting
  • 119. the ramp up duration while starting the virtual users. q Time out is a duration in seconds which denotes the maximum amount of time application should wait for response after sending a request before terminating the request. AppPerfect LoadTest allows you to set time out value as per your application and processing speed of your server. Use void setTimeOut(int seconds); to set time out for the tasks in the test. q Think time is a duration in seconds which denotes the amount of time between sending next request after receiving the previous response. AppPerfect LoadTest allows you to record the think time during recording and then either ignore or use it during replaying. It also allows to set default think time for tasks which do not have any significant think time. Following APIs can be used to configure think time for the tasks in the test. r void setDefaultThinkTime(int seconds); r void setRecordThinkTime(boolean record); r void setIgnoreThinkTimeWhileReplaying(boolean ignore); q Task related settings. r Sometimes a task may fail due to some reason, before marking it to be failed we may be interested in re-trying the same task few more times after waiting for some time. This can be achieved by using void setRetryIfTaskFails(int retryCount, int delay); API. r If the test has large no. of tasks or a set of tasks is executed multiple times, user might be interested in finding 'n' no of tasks which took maximum time to fetch the response. This can be achieved by void collectTopTasks(int taskCount); API. q Browser simulation. Select the browser whose behaviour you wish to simulate. You can set the percentage of users that will be simulated for Internet Explorer and Mozilla Firefox. After one iteration of the test run, it is quite possible that some of the response may be cached for e.g. image files etc. This will affect next iteration and may not give real life simulation of task execution. Also decide whether you want to clear the browser cache after each iteration. This will affect the response time from your application.This can be achieved by following APIs: r void setSimulateIEBrowser(boolean simulate, int percentage); r void setSimulateMozillaBrowser(boolean simulate, int percentage, int connections); r void setClearCacheAfterEachIteration(boolean clear); The total percentage of IE browser & Mozilla browser should not exceed 100%. q Network bandwidth. Select the bandwidth settings you wish to simulate. By default 'throttling' is not applied to the test. If you want to limit the requests fired according to the bandwidth, then you can select the check box 'Throttle test based on Network Bandwidth'. You can then select the bandwidth settings. Default values provided are 56Kbps, 256 Kbps, 1Mps (1024Kbps) and 2Mbps(2048Kbps). If you choose 'Maximum bandwidth' then the maximum available bandwidth will be used per user. You can also choose 'Custom bandwidth' and provide custom per user bandwidth settings. This can be achieved by following APIs: r void setThrottleNetworkBandwith(boolean throttle); r void setNetworkBandwith(int bandwidth); where bandwidth should be one of the following values: s ILoadTest.NETWORK_BANDWIDTH_MAXIMUM for maximum bandwidth s ILoadTest.NETWORK_BANDWIDTH_56Kbps for 56 Kbps s ILoadTest.NETWORK_BANDWIDTH_256Kbps for 256 Kbps s ILoadTest.NETWORK_BANDWIDTH_1024Kbps for 1024 Kbps
  • 120. s ILoadTest.NETWORK_BANDWIDTH_2048Kbps for 2048 Kbps s ILoadTest.NETWORK_BANDWIDTH_CUSTOM for custom bandwidth r void setCustomNetworkBandwith(int bandwidth); q Load balancing. Some application servers are configured for load balancing where in requests from particular set of IP addresses is processed by one web server and another set of IP addresses is processed by another web server. In order to simulate this scenario you can enable load balancing and add different IP addresses to be used as client IP address. This can be achieved by following APIs: r void setLoadBalancing(boolean balance); r void addIPAddress(String ipAddress, boolean enable); q Load Distribution or Running test from multiple machines. At times it is not possible put enough stress on the server from one single client machine running LoadTest. It is possible to run same test parallely from multiple machines at a same time to put real stress on the server. The results of such a test is shown collectively from the central machine. In order to specify machines from which to execute the test use following APIs: r void setRunProjectOnMultipleMachines(boolean run); r void addRemoteMachine(String hostName, int servicePort, int virtualUserCount, boolean ignore); Remote machines added through this API should have same version of AppPerfect Load Test running on it and should have AppPerfect Load Test service running on the specified servicePort.
  • 121. Building a Database/JDBC Project The steps to create a Database/JDBC project are as under: q Defining database ID q Project Function q Other database operations Defining database ID For any interaction with a database of your interest it is very necessary to register the database along with its properties with AppPerfect LoadTest. While registering the database, a unique database Id needs to be passed as first parameter and any further database interaction through LoadTest should be performed by passing this unique database id. Database can be registered by calling String setDatabaseConnection( String uniqueDatabaseId, String connectionURL, String userName, String password, String driverClass, String classPath); API. e.g. var database = engine.setDatabaseConnection('Northwind', 'jdbc:oracle:thin:@localhost:1543: Northwind', 'scott','tiger', 'oracle.jdbc.driver.OracleDriver', 'C:DatabaseDriversojdbc14.jar'); This will register an Oracle database "Northwind" with database id Northwind and it will return the database vendor i.e. It will return "Oracle" If the vendor is not a well-know database vendor it will return "Other" function project_function( ) By default LoadTest is configured to test Web project. In addition to Web load testing, you can create a new group for testing Database/JDBC protocol. We will learn more about groups in next chapter, but in order to perform database load testing, you need to specify which database ID will be load tested. You can configure database id in Defining database ID section. The database ID can be specified using void setLoadTestDatabase(boolean test, String uniqueId); API. e.g. loadtest.setLoadTestDatabase(true, 'Northwind'); Other database operations Once a database ID is defined, database operations can be performed during execution of the test for various purpose like validating if a users table contains an entry of a user after a task of adding user was performed. AppPerfect LoadTest provides following APIs to perform database operations: 1. boolean isDatabaseConnectionValid(String uniqueDatabaseId); to check if database connection is valid 2. Object getValueFromDatabase(String uniqueDatabaseId, String query, int row, int column);
  • 122. to fetch a value present at row,column after executing a select query. e.g. var value = engine. getValueFromDatabase('Northwind', 'Select CategoryName from Categories', 2, 1); to get the value present in 2nd row 1st column of the ResultSet after executing 'Select CategoryName from Categories' query. 3. int getNumberOfDatabaseRows(String uniqueDatabaseId, String query); returns no of rows present in the resultset after executing the specified query 4. int getNumberOfDatabaseColumns(String uniqueDatabaseId, String query); returns the no of columns present in the resultset after executing the specified query 5. ResultSet getResultSet(String uniqueDatabaseId, String query); returns java.util.ResultSet whose APIs can be used to iterate through the complete ResultSet after executing the query 6. ResultSet executeSelectQuery(String uniqueDatabaseId, String query); returns java.util. ResultSet whose APIs can be used to iterate through the complete ResultSet after executing the query 7. boolean closeResultSet(ResultSet resultSet); to close the ResultSet which was created using above APIs. 8. int executeInsertUpdateQuery(String uniqueDatabaseId, String query); returns count of rows affected by Update, Insert or delete query. This API should be used carefully as changes the state of database. 9. String getLastError(); to get the last error occured during any database operation or SQL transaction
  • 123. Test Parameters Project Parameter are used in most modern applications to communicate data between the user and the application. AppPerfect offers extensive parameter-management. Parameter selection and testing with various parameter values is completely automated. Parameter values are passed either via the URL itself or via the HTTP header object. In the AppPerfect application, parameters are stored as name-value pairs, making it intuitive for application developers and testers. Then, depending on the number of iterations for your project, multiple parameter values can be tested, with options to select parameters sequentially or randomly. q Adding test parameter q Setting values of a parameter q Fetching values from SQL database q Fetching values from CSV file q Fetching values by performing mathematical operations q Passthrough test parameters Adding test parameter To add a test parameter to the project, you have to use void addTestParameter( String name, boolean randomSelection, boolean sameParameterValues); API. The name of the parameter should be unique. i.e. there cannot be 2 test parameters with the same name. You can specify is the application should select the values sequentially or randomly and you can also specify if application should choose unique values always i.e. no to repeat the values till all of them have been used. e.g. loadtest.addTestParameter('bird_name', false, true); adds a test parameter with the name bird_name to the project. This parameter then can be used in different tasks which will pick the values from it. Setting values of a parameter Once the test parameter is added to the project, and if you are aware of the set of values it should pick up the values from, you should use void setParameterValues(String parameterName, String [] values); API to set the set of values. e.g. var values = ['Parrot', 'Crow', 'Piegon', 'Finch']; loadtest.setParameterValues('bird_name', values); Fetching values from SQL database Quite often the set of values that a parameter can take is not know before hand and its value is available at runtime by querying a database. This can be achieved by setting the source of the test parameter as a database instead of specifying the values. You need to define a database ID prior to
  • 124. using this method which has been explained in previous chapter Defining database ID. Once the database ID is defined, you can use void setDatabaseDatasource( String parameterName, String databaseId, int whenToFetch, int noOfRows, String query); API to fetch the values from the database. The query should be a select query having only 1 column, If the ResultSet contains more than 1 column values from 1st column will be taken ignoring other columns. You can also specify when the application should fetch the values from the database by passing appropriate constant as the 3rd parameter. Possible values are: q IScriptTest.FETCH_VALUES_NOW to fetch values now q IScriptTest.FETCH_VALUES_RUNTIME_BEFORE_TEST_EXECUTION to fetch values before the execution begins q IScriptTest.FETCH_VALUES_RUNTIME_BEFORE_TASK_OR_EVENT_EXECUTION to fetch values before the execution of the task or event in which it is used q IScriptTest.FETCH_VALUES_RUNTIME_AFTER_TASK_OR_EVENT_EXECUTION to fetch values after the execution of the task or event in which it is used q IScriptTest.FETCH_VALUES_EVERYTIME to fetch values everytime this test parameter is used e.g. loadtest.setDatabaseDatasource('bird_name', 'Northwind', IScriptTest. FETCH_VALUES_RUNTIME_BEFORE_TEST_EXECUTION, 10, 'Select bird_name from birds'); Fetching values from CSV file Quite often the set of values that a parameter can take is not know before hand and its value is available at runtime by reading a CSV file. This can be achieved by setting the source of the test parameter as a CSV file instead of specifying the values. You can use void setCSVDatasource (String parameterName, String fileName, int columnIndex, int whenToFetch, boolean firstRowHeader, int noOfRows, String valueDelimiter, String stringDelimiter); API to fetch the values from the CSV fiile. You can also specify when the application should fetch the values from the database by passing appropriate constant as the 4th parameter. Possible values are: q IScriptTest.FETCH_VALUES_NOW to fetch values now q IScriptTest.FETCH_VALUES_RUNTIME_BEFORE_TEST_EXECUTION to fetch values before the execution begins q IScriptTest.FETCH_VALUES_RUNTIME_BEFORE_TASK_OR_EVENT_EXECUTION to fetch values before the execution of the task or event in which it is used q IScriptTest.FETCH_VALUES_RUNTIME_AFTER_TASK_OR_EVENT_EXECUTION to fetch values after the execution of the task or event in which it is used q IScriptTest.FETCH_VALUES_EVERYTIME to fetch values everytime this test parameter is used e.g. loadtest.setCSVDatasource('bird_name', 'C:birds.csv', 1, IScriptTest. FETCH_VALUES_RUNTIME_BEFORE_TEST_EXECUTION, true, 10, ',', '"'); Fetching values by performing mathematical operations
  • 125. AppPerfect LoadTest also provides an advanced data source where is values are not fetched from a persistence resource like database OR CSV file but are calculated using a defined formulae. This type of a datasource can be specified in two different ways viz; void setNumberCalculationDatasource (String parameterName, String prefix, String suffix, boolean autoNumber, int start, int end, boolean increment, int incrementBy, int resetCriteria, int lastValue); for numeric values and void setDateCalculationDatasource(String parameterName, String format, boolean todaysDate, String start, String end); for date related values. e.g. loadtest.setNumberCalculationDatasource('bird_name', 'Parrot', '', false, 1, 10, true, 1, 1, 1); loadtest.setDateCalculationDatasource('bird_purchase_date', 'MM-dd-yyyy', '01-01-2000', '12-31- 2004'); Passthrough test parameters Another category of parameters supported by AppPerfect LoadTest is that of "Passthrough". These parameters are such that its values are set by server and are sent to the client. For e.g. SessionID, hidden parameters in the form. By defining this type of a parameter, AppPerfect LoadTest will search in the previous response value of the parameter and use it for subsequent requests. This can be achieved by calling void setPassthroughDatasource(String parameterName, boolean searchInScript, boolean searchInHTML); API. You can also configure if the value of the parameter should be searched in javascript functions and/or in pure HTML elements. e.g. loadtest.setPassthroughDatasource('bird_type', false, true);
  • 126. Task groups in Web/Database Project A task group is a collection of tasks in a project. A task group can either contain web (HTTP/HTTPS) tasks or database (JDBC) tasks. A group in which web tasks can be added is created for HTTP protocol and a group in which database tasks can be added is created for JDBC protocol. A project also contains one StartingGroup and one EndingGroup which are created for HTTP protocol. Any number of Action groups belonging to HTTP and/or JDBC protocol can be added. In order to add a group for JDBC protocol, a project should be configured for Database load testing q Adding task group q Group execution strategy q Setting group properties q Setting HTTP group properties Adding task group A starting group can be added to the test by calling IHttpGroup addStartingGroup(); API. It returns a reference of web group. An ending group can be added to the test by calling IHttpGroup addEndingGroup(); API. It returns a reference of web group. As mentioned above Starting and Ending group are web groups. A test will have one and only one starting and ending group. Calling the API multiple times returns the reference of the same group. var group = loadtest.addStartingGroup(); // set starting group's properties here var group = loadtest.addEndingGroup(); // set ending group's properties here Now you can add any number of Action groups using IGroup addActionGroup(int protocol, String groupName); API. It returns a web or database group depending upon the protocol passed. A protocol can be of type IGroup.GROUP_HTTP or IGroup.GROUP_DATABASE. For e.g. var group = loadtest.addActionGroup(IGroup.GROUP_HTTP, 'ActionGroup1'); adds a web group with name ActionGroup1. var group = loadtest.addActionGroup(IGroup.GROUP_DATABASE, 'OracleDBGroup'); adds a database group with name OracleDBGroup. In order to keep the changes in UI and script in sync with each other, the name of the variable has to be 'group'. Group execution strategy
  • 127. Once the groups are created you need to specify how to execute the groups. If there are multiple action groups, should they be executed sequentially or simultaneously. You can also select if you want to execute Starting group only once at the begining and Ending group only once at the end and in between keep executing ActionGroup till the end of the test. This can be achieved using void setGroupRunStrategy(int strategy, int selection); API, where run strategy can be ILoadTest.SEQUENTIAL_GROUP_SELECTION or ILoadTest. SIMULTANEOUS_GROUP_SELECTION. And the selection can be ILoadTest. START_ACTION_END_REPEAT or ILoadTest.START_ACTION_REPEAT_END. e.g. loadtest.setGroupRunStrategy(ILoadTest.SIMULTANEOUS_GROUP_SELECTION, ILoadTest. START_ACTION_REPEAT_END); will run the action groups simultaneously and will run the Starting group only once at the begining and Ending group only once at the end and will keep repeating action groups till the duration of the test. Setting group properties Once a group is created you need to set various properties of the group, some of them are compulsory while others are optional and if not set will use default values. q void setIgnored(boolean ignored); API should be used to set whether you want to ignore the group during execution. group.setIgnored(true); will ignore the group during replaying. By default, group is not ignored. q void setRepeatCount(int count); API should be used to repeat a group count number of times while replaying. By default a group is replayed once. group.setRepeatCount(5); will repeat the same group 5 times. q void setRunVirtualUsers(int percentage); API should be used to set the %age of virtual users out of total virtual users should be executing this group. This API has an effect only when groups are executed simultaneously. Setting HTTP group properties A web (HTTP) group has additional properties that needs to be set in order to execute tasks in this group. A URL which should be executed when the execution of the group starts. This is calleds as starting URL and can be set using void setStartingURL(String url); API. For e.g. group.setStartingURL('http://localhost:8081/petstore'); sets the starting URL of the built-in Petstore web application present in the product. Quite often the web applications being tested are not simple applications and require different types of authentications during the execution of the test. AppPerfect LoadTest provides various APIs to set authentication credentials. By default a group doesn't require any authentication credentials. AppPerfect LoadTest support Form, Basic, Digest, NTLM types of authentication. To set the type of authentication use void setAuthenticationMechanism(int mechanism); API. Possible values for mechanism are:
  • 128. q IHttpGroup.NO_AUTHENTICATION q IHttpGroup.FORM_AUTHENTICATION q IHttpGroup.BASIC_AUTHENTICATION q IHttpGroup.DIGEST_AUTHENTICATION q IHttpGroup.NTLM_AUTHENTICATION User name for any type of authentication should be set by calling void setAuthenticationUserName (String name, boolean parameterised); API. If user name is parameterised then the second value to be passed in true and the first parameter is the name of the test parameter. If the user name is not parameterised then actual user name is passed as the first parameter. Password for any type of authentication should be set by calling void setAuthenticationPassword (String password, boolean parameterised); API. If password is parameterised then the second value to be passed in true and the first parameter is the name of the test parameter. If the password is not parameterised then actual password is passed as the first parameter. void setAuthenticationDomainName(String domain); API is called to set the Domain name if the authentication is of type IHttpGroup.NTLM_AUTHENTICATION. If the authentication is form based i.e. one of the tasks has a form containing fields for user name and password we need to register the task ID along with the user name and password parameter names with the group. e.g.: group.setAuthenticationMechanism(IHttpGroup.FORM_AUTHENTICATION); group.setContainsLoginTask(true); group.setLoginTaskID(2, 'username', 'pwd'); This will configure the group for form based authentication where in Task having ID 2 contains a login form having fields username & pwd for authenticating the user. Finally if the web or application server is configured for authenticating the client based on client certificates, you need to register client certificates with the group by calling following APIs: q void setUseClientSSLAuthentication(boolean flag); to set that group should use client SSL authentication q void addClientCertificate(String password, String certFilePath); to register a client certificate for a group
  • 129. Configuring tasks in a task group A task group is a collection of tasks. We will discuss how to create a task in a task group and also about configuring and setting task properties in this chapter. Please read Task groups chapter for further details on task groups. This chapter will cover: q Creating a web (HTTP/HTTPS) task q Creating a database (JDBC) task q Configuring task properties q Configuring Web task q Configuring Database task q Executing a task Creating a web (HTTP/HTTPS) task A web task is web request with either http for simple request or https for secured request. A request could be of GET or POST type. A web task for a GET request can be created using following APIs: q IScript createGetRequest(int id, String taskName, String protocol, String hostName, int port, String uri); to create a main task. q IScript createGetRequest(int id, String taskName, String protocol, String hostName, int port, String uri, boolean subtask); e.g. var request = engine.createGetRequest(1, 'Task1', 'http', 'localhost', '8081', '/petstore'); var subTask = engine.createGetRequest(2, 'Task2', 'http', 'localhost', '8081', '/petstore/images/ bird3.gif', true); A web task for a POST request can be created using following APIs: q IScript createPostRequest(int id, String taskName, String protocol, String hostName, int port, String uri); to create a main task. q IScript createPostRequest(int id, String taskName, String protocol, String hostName, int port, String uri, boolean subtask); e.g. var request = engine.createPostRequest(3, 'AccountInfo', 'http', 'localhost', '8081', '/petstore/ accinformation.jsp'); var subTask = engine.createPostRequest(4, 'Task4', 'http', 'localhost', '8081', '/petstore/images/ banner.gif', true); Creating a database (JDBC) task
  • 130. A database task can be created only in the group function for the database groups. A database request can be created using following API: q IScript createDatabaseQueryRequest(int id, String taskName); e.g. var request = loadtest.createDatabaseQueryRequest(10, 'SelectUserTask'); Configuring task properties Once a task is created you need to set various properties of the task, some of them are compulsory while others are optional and if not set will use default values. q void setIgnored(boolean ignored); API should be used to set whether you want to ignore the task during execution. request.setIgnored(true); will ignore the task during replaying. By default, task is not ignored. q void setThinkTime(int seconds); API should be used set think time for the task. Application will wait for this think time before executing the task. Default value of think time is 0. q void setTimeout(int seconds); API should be used set time out time for the task. Application will wait for timeout period for the response before terminating the request and defining the task as timedout. q String getParameterValue(String name, String value, String parameterName); API should be used to fetch value of a parameterised parameter during execution. Please refer to Test Parameters for more details on how to specify test parameters. The value of a test parameter can be fetched using this API and can be passed to task parameter as mentioned in the Configuring Web task and Configuring Database task sections. q String getParameterValue(String name, String value, String parameterName, boolean beforeExecution); API should be fetch value of a parameterised parameter during or before execution depending on the value of parameter beforeExecution. Configuring Web task A web / HTTP(s) task has additional properties that needs to be set in order to execute it properly. The various properties of the web task are defined below, some of these properties are compulsory while others are optional: q void setUseAuthentication(boolean useAuthentication); A task may require authentication credentials when sent to the server, this can be configured using this method. q void setExpectedResponseCode(int expectedResponseCode); When a task is executed, it is expected to have some response code. This is typically the recorded response code. The value set for expected response code is used to determine whether the task got executed successfully or not by comparing it with actual response code received during execution. q void setRecordedFileName(String recordedFileName); This is helpful for validation purpose
  • 131. to match the replayed response with the recorded one. This is also used to show the page in the UI. q void addParameter(String parameterName, String parameterValue, boolean parameterized); A task can have many request parameters. Each GET parameter needs to added using this method. A parameter added with this method is appended to the URL when the task is executed. If parameter is parameterised then the last value to be passed in true and the value should be fetched first using API String getParameterValue(String name, String value, String parameterName);. e.g.: If parameterised var value = request.getParameterValue('selection', 'Birds', 'cat_name'); request.addParameter('selection', value, true); OR If not parameterised request.addParameter('selection', 'Birds', false); q void addPostParameter(String parameterName, String parameterValue, boolean parameterized); When a form is submitted, all the form attributes are submitted as Post parameters. A parameter added with this method is sent as a part of the body of the request. If parameter is parameterised then the last value to be passed in true and the value should be fetched first using API String getParameterValue(String name, String value, String parameterName);. e.g.: If parameterised var value = request.getParameterValue('userName1', 'j2ee', 'username'); request.addPostParameter('userName1', value, true); OR If not parameterised request.addPostParameter('userName1', 'j2ee', false); q void addPostParameter(String parameterName, String parameterValue, boolean parameterized, boolean decode); First three parameters work same as mentioned in API void addPostParameter(String parameterName, String parameterValue, boolean parameterized);, the last parameter decode should be used if you don't want to decode the value passed. This is normally useful when value contains special characters like ' ' or '+' etc. and you don't want to decode the value. q void addMultiPartParameter(String parameterName, String parameterValue); A POST request could be sent into multiple parts to the server using MultiPart request. Parameters added to such a request should be added using this method. q void addMultiPartFileParameter(String contentType, String parameterName, String fileName); A POST request can be sent into multiple parts to the server using MultiPart request. Contents of a file can be sent to the server using this method. q void addMultiPartFileParameter(String contentType, String parameterName, String fileName); A POST request can be sent into multiple parts to the server using MultiPart request. Contents of a file can be sent to the server using this method. q void addHeader(String headerName, String headerValue); Each HTTP request sends a set of headers to the server, which helps the server understand the kind of request. This method is used to add a header to the request. q void addHeader(String headerName, String headerValue, boolean decode); First two parameters work same as mentioned in API void addHeader(String headerName, String headerValue);, the last parameter decode should be used if you don't want to decode the value passed. This is normally useful when value contains special characters like ' ' or '+' etc. and you don't want to decode the value.
  • 132. q void addPassThroughParameter(String name, String value, String parameterName, boolean getParameter); Add pass-through parameter so that its values can be fetched by parsing the previous response during exeuction q void addPassThroughParameter(String name, String value, String parameterName, boolean getParameter, int domIndex); First four parameters work same as mentioned in API void addPassThroughParameter(String name, String value, String parameterName, boolean getParameter);, the last parameter domIndex should be used if want to look for value of passthrough parameter in the JavaScript. q void addMultipartRequestEntity(); To add multipart request to Post method. This should be used along with add multi-part parameter APIs. q void addByteArrayRequestEntity(byte[] requestEntity); To add binary request entity to Post method. Here binary entity is passed a byte array to this method. This is usually used with Flash etc applications to send binary data to server. q void addAsSubTaskTo(int parentId); To add Sub Task to the parent task. Each main task can have many sub tasks like images, js files, css files etc. Each entity is fetched separately from the server during execution just like a normal browser does. e.g.: Code showing how to set various properties of a web task var request = engine.createPostRequest(8, 'Task8', 'http', 'localhost', 8081, '/petstore/ checkhimout.do'); request.setIgnored(false); request.setThinkTime(0); request.setTimeout(300); request.addHeader('Accept', 'image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/x- shockwave-flash, application/vnd.ms-excel, application/vnd.ms-powerpoint, application/msword, */*'); request.addHeader('Referer', 'http://localhost:8081/petstore/newLogin.jsp'); request.addHeader('Accept-Language', 'en-us'); request.addHeader('Content-Type', 'application/x-www-form-urlencoded'); request.addHeader('User-Agent', 'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.0.3705; .NET CLR 2.0.50727)'); request.addHeader('Pragma', 'no-cache'); request.addHeader('Cookie', 'JSESSIONID=290E2787352FA789AF96D693425F94C8'); var value = request.getParameterValue('userName1', 'j2ee', 'username'); request.addPostParameter('userName1', value, true); request.addPostParameter('passWord', 'j2ee', false); request.addPostParameter('submituser', 'Submit', false); request.setExpectedResponseCode(302); request.setUseAuthentication(false); request.setRecordedFileName('recorded/2006_12_11_10_49_15_62/ActionGroup1/Task8.html'); Configuring Database task Like web task JDBC / Database task also has additional properties that needs to be set in order to execute it properly. The various properties of the database task are defined below, some of these properties are compulsory while others are optional: q void setQuery(String query); This method sets the SQL query to be executed when the task
  • 133. is executed. You can parameterize query by putting parameter inside pair of "@". e.g. Select productName from products where productid=@PRODID@. You can then use API void replaceParameterInQuery(String parameterName, String parameterValue); to replace the actual value of PRODID during execution. q String loadQueryFromFile(String fileName); This method sets the file name from which the query is read and executed when the task is executed. Each file should contain one query. q void replaceParameterInQuery(String parameterName, String parameterValue); Application supports parameterized queries. A parameter in the query is replaced by its value using this method. e.g.: Code showing how to set v properties of a datbase task var request = engine.createDatabaseQueryRequest(13, 'Task13'); request.setIgnored(false); request.setThinkTime(0); request.setTimeout(300); request.setQuery('select productname from products where productid=@PRODID@'); request.replaceParameterInQuery('PRODID', '1'); Executing a task Following API is used to execute a task: q boolean execute(IScript request); to execute a task, this returns boolean value indicating whether application executed the task successfully or not. q void release(IScript request); to release the resources used by this task. Its very important to release resources at the end of execution of task for proper execution of task and to keep system resources usage of application under control. e.g.: var successful = engine.execute(request); if(! successful) { log('Task failed, Response code: '+ engine.getResponseCode() + ' with reason for failure: ' + engine.getReasonForFailure()); } else { log('Task succeeded, Response code: '+ engine.getResponseCode()); //Validations may be added here. } engine.release(request);
  • 134. Validating a task response To determine whether a task has executed successfully or not you need to validate the data received in the response. Normally for web tasks response code received is used to determine the status of task like 200 response code means success but this may not be true in all cases, like your application handles exceptions and sends error response in place of exception as response then in that case the response code received is 200 but its a failed task. To overcome this problem you can add futher validations to make 100% sure that task has executed successfully. This chapter will cover: q Validating a Web task q Validating a Database task Validating a Web task A web task is web request with either http for simple request or https for secured request. When a web task is executed we get WebResponse, you can validate this WebResponse using following APIs. You can also write your custom functions apart from following standard functions provided to do custom validation and can set the status of task based on that. q WebResponse getWebResponse(); Once the task is executed, this method returns the contents of the response received. This can be null whenthere is no response from the server, typically when the request is re-directed to some other URL or the server, requests for authentication information etc. q boolean isValidationSuccessful(); Once the task is executed, this method returns the status of the validation carried out. q void setValidationSuccessful(boolean success); Once the task is executed, this method can be used to set the status of validation. q IValidationResult getValidationResult(); Once the task is executed, detailed validation result can be fetched using this method. q boolean assertNodeText(String description, String nodePath, String text); Once the task is executed, text of the node in the DOM tree of the response data can be validated. q boolean assertNodeAttributeValue(String description, String nodePath, String attributeName, String attributeValue); Once the task is executed, attributes of the node in the DOM tree of the response data can be validated. q boolean assertInDatabase(String description, String databaseId, String query); Once the task is executed, database can be validated by firing the specified SELECT query. q boolean assertTodaysDate(String description, String dateFormat, String prefix, String suffix); Once the task is executed, response can be validated to contain today's date in specified format. q boolean assertTodaysDate(String description, String dateFormat); Once the task is executed, response can be validated to contain today's date in predefined format. q boolean assertText(String description, String[] txt, boolean bCaseSensitive, boolean
  • 135. contains, boolean bAll, boolean checkForExistance, boolean regularExpression, String prefix, String suffix); Once the task is executed, response can be validated for presence/ absence of some text along with other attributes for fine-tuning the search. q boolean assertText(String description, String txt, boolean bCaseSensitive, boolean checkForExistance, boolean regularExpression, String prefix, String suffix); Once the task is executed, response can be validated for presence/absence of some text along with other attributes for fine-tuning the search. q boolean assertText(String description, String[] txt, boolean bCaseSensitive, boolean contains, boolean bAll, boolean checkForExistance, boolean regularExpression); Once the task is executed, response can be validated for presence/absence of some text along with other attributes for fine-tuning the search. q boolean assertText(String description, String txt, boolean bCaseSensitive, boolean checkForExistance, boolean regularExpression); Once the task is executed, response can be validated for presence/absence of some text along with other attributes for fine-tuning the search. q boolean assertPage(String description); Once the task is executed, the response page can be validated using this method. q boolean assertLinkCount(String description, int count); Once the task is executed, no of links in the response can be validated using this method. q boolean assertFormCount(String description, int count); Once the task is executed, no of forms in the response can be validated using this method. q boolean assertImageCount(String description, int count); Once the task is executed, no of images in the response can be validated using this method. q boolean assertInputElementCount(String description, int count); Once the task is executed, no of input elements in the response can be validated using this method. q boolean assertPageSize(String description, long sizeInBytes); Once the task is executed, size of the response can be validated using this method. Validating a Database task A database task can be created only in the group function for the database groups. A database request is basically a query fired on a database. The response of query is usaully ResultSet if its a Select query. You can then validate this resultset to make sure that task got executed successfully. q boolean assertRowCount(int count); Once the task is executed, this method can be used to validate the no of rows present in the result set. q boolean assertColumnNames(String[] colNames, boolean inOrder); Once the task is executed, this method can be used to validate the columns present in the result set. q boolean assertColumn(String colName, String dataType, String value); Once the task is executed, this method can be used to validate the column present in the result set. It validates the column name, its data type and value at the current row. q boolean assertColumn(String colName, String dataType, String[] values); Once the task is executed, this method can be used to validate the column present in the result set. It validates the column name, its data type and values in all the rows. q boolean assertRow(int rowIndex, String[] dataTypes, String[] values); Once the task is
  • 136. executed, this method can be used to validate the all the columns present in the result set at the specified row. It validates the data type and values in all the columns.