AppPerfect™ Web Test v 10.5.0 Guide
Copyright (C) 2002-2016 AppPerfect Corporation. All rights reserved. AppPerfect is a trademark of AppPerfect Corporation. Java is a trademark of Sun Microsystems, Inc.
AppPerfect Software License Agreement IMPORTANT: READ THIS AGREEMENT CAREFULLY BEFORE YOU INSTALL, COPY, 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, ing or using the SOFTWARE, You agree to be bound by the of this ASLA. If You do not agree with all the of this ASLA, AppPerfect is unwilling to license the SOFTWARE to You. In such an event, You may not install, copy, or use the SOFTWARE and You must return to AppPerfect the complete SOFTWARE package, including the disks and printed materials or if you ed 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 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 . 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, ing 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 and conditions of this ASLA. 1.4 No Copies. Except as expressly allowed by the 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.
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 , 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 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
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 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 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.
6.6 Attorneys' Fees. If any legal action is necessary to enforce the 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 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. ● ● ● ● ● ● ● ● ● ● ● ● ● ● ●
Apache Ant (http://ant.apache.org/) Apache BCEL Library (http://jakarta.apache.org/bcel/index.html) Apache Commons Library (http://jakarta.apache.org/commons) Apache Jakarta ORO (http://jakarta.apache.org/oro/index.html) Apache Log4J (http://jakarta.apache.org/log4j) Apache POI Excel Library (http://jakarta.apache.org/poi/index.html) Apache Struts Framework (http://jakarta.apache.org/struts) Apache Tomcat JSP/Servlet Engine (http://jakarta.apache.org/tomcat) Apache Xerces XML Library (http://xml.apache.org/xerces2-j/index.html) Apache Xalan XML Library (http://xalan.apache.org/) Direct Web Remoting (http://getahead.org/dwr) Eclipse.org (http://www.eclipse.org) Hibernate (http://www.hibernate.org/) HSQL Database Engine (http://hsqldb.sourceforge.net/) HTML Parser (http://htmlparser.sourceforge.net)
● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ●
HtmlUnit (http://htmlunit.sourceforge.net/) Impression Math Expression Java parser (http://impression.sourceforge.net/) iText PDF Library (http://sourceforge.net/projects/itext/) JavaAssist (http://www.jboss.org/products/javassist) Java Communications API (http://java.sun.com/products/javacomm/) jregex - regular expressions for Java (http://sourceforge.net/projects/jregex) JUnit (http://www.junit.org/index.html) JCraft JSch (http://www.jcraft.com/jsch/index.html) Quartz Scheduler (http://www.quartzscheduler.org/) Remote Tea ONC/RPC for Java (http://www.plt.rwth-aachen.de/ks/english/remotetea.html) Rhino (http://www.mozilla.org/rhino/) SmsJ SMS library for the Java platform (http://sourceforge.net/projects/smsj/) Spring Framework (http://www.springframework.org) StrutsTestCase for JUnit (http://strutstestcase.sourceforge.net/) Subclipse plug-in for Subversion (http://subclipse.tigris.org/) Subversion Server (http://subversion.tigris.org/)
Introduction The Internet has become the de facto standard means by which most people interact with a vast majority of software application. This move away from desktop computing to server-side computing with HTML as the front-end technology has created a whole new class of applications to be built and delivered to customers. However, it has also created a new set of challenges in of developing and testing these applications. It is now assumed your customer may be sitting thousands of miles away and working in a language you are not familiar with. A second aspect of modern software development methodology is to start testing the software early and often. Most software developers do not follow the cascading model of development whereby testing only starts after development ends. Further, developers are being increasingly encouraged to create vast arrays of unit tests to ensure quality.
Need for Web Test All software is designed and developed to meet and satisfy certain "functional" needs. A functional need may be technical, business, or process. A key component of testing a software is to ensure that it functionally does what it is supposed to do. Functional Testing is the process by which expected behavior of an application is tested. Most software undergo changes over a period of time. These changes may occur during initial development of the software, or after the release of the software. Any change to the software carries a potential of errors or bugs being introduced. Regression Testing is the process of frequently retesting a software to ensure known existing behavior or functionality is not impacted. By impacted, we mean either modified or broken. If behavior is modified, the developer or tester must ensure that it is expected. Otherwise, it is called a "Regression". As the size and complexity of applications have grown over the years, it has become increasingly difficult to ensure functional compliance and to ensure no regressions over time. Even a small size project can generate excessive permutations and combinations of test cases that are too great for a human to test consistently and continually. Hence, it is critical to find a testing system which can be automated. The AppPerfect Web Test was created to assist s with such challenges. Since the mechanics of Functional Testing and Regression Testing are similar, they can be addressed with a single testing tool. AppPerfect Web Test provides for "recording" a test once and then "replaying" it when desired without additional manual intervention in an automated manner.
AppPerfect Web Test Key Features
AppPerfect Web Test is a comprehensive Web application testing solution that provides all the features you need, to ensure the reliability of your business-critical applications. ●
●
●
●
●
●
●
●
●
●
●
Technologies : AppPerfect Web Test s testing applications based on .NET, ASP, Servlets/JSP, CGI, SSL and most other server-side Web technologies. It also s advanced Web technologies such as AJAX, Flash and Java Applets. 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. Recording s JavaScript dialogs, File Chooser dialogs, Menus, toolbar etc apart from normal HTML elements. Recording is Component-based and not co-ordinate based allowing to replay test even when browser is moved or element position changes. Web Test s recording from multiple instances of browser simultaneously. Multiple Browsers ed: Recording/Replaying is ed on most commonly used browsers like Internet Explorer, Mozilla Firefox and Safari. 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 Reduced testing time: As the tests for AppPerfect Web Test are fully automated, you can save a substantial amount of time and resources that would be spent on trying to test the system manually. Also errors that might be overlooked during manual testing are caught by the AppPerfect Web Test and there is no bias in the reporting of errors. AppPerfect Web Test helps you improve the quality of your Web Applications and drastically reduces the time it would take to get your product out into the market. Scripting : For advanced AppPerfect Web Test provides scripting language . The scripting language used is simple java script, s can view/edit the test using script editor provided. s can customize a test as much as they want using java script. Parameterize 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. Parameterize tests feed these parameters automatically to the request and thus help simulate a more realistic usage environment. AppPerfect can read values from text files, databases etc. Response Validation: You can validate the responses received for a URL request with AppPerfect Web Test. You can customize what constitutes a valid or invalid response for an URL request. for basic authentication, cookies, SSL: With the AppPerfect Web 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 s URL rewriting if your application uses it. Two way SSL authentication is also ed. Execution without launching browser: AppPerfect Web Test provides for running tests without launching browser. Events on all HTML elements is ed in this mode. Limitation of this mode is that it cannot run window events like events on Applets, Flash, javascript dialogs, Toolbar buttons, Menu bar etc. Remote Execution of tests with Central Controller: AppPerfect Web Test provides for creation of test on one machine and execution of same remotely on multiple
●
●
●
●
●
●
●
●
machines simultaneously. This way you can run functional test from multiple machines and can control the functional test from one central machine. At the end of execution application will present the functional testing result of entire functional test as well as individual machines. This requires AppPerfect Web Test to be installed on remote machines. Object Spy: AppPerfect Web Test provides functionality to Spy on any HTML element in the page and fetch its properties. This makes it easier to add any new HTML element to your existing functional test and build on the Test Cases as and when additional functionality is added to your product Importing of tests / groups: AppPerfect Web Test can import a test that has been created using the AppPerfect Load Test. This makes it easy for a to create a test instead of replicating the effort of creating a test. One can also import already recorded groups from one test to another. Informative reports: 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 different formats: HTML, PDF, CSV, XLS and XML. Trend Analysis: AppPerfect Test Manager provides lot of trend reports for trend analysis of your application. This utility takes multiple result files and generates trend charts and reports based on the data found. You need AppPerfect Test Manager for trend analysis Scheduling of tests: You can schedule your tests with AppPerfect Test Manager. 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. You need AppPerfect Test Manager for scheduling tests. 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 attachment and AppPerfect will export the results as HTML file and send the same as attachment with the mail. IDE Integration: AppPerfect Web Test s IDE integration with most commonly used IDEs. This enhances ease-of-use and productivity. Currently ed IDEs are Eclipse, NetBeans, IntelliJ, JBuilder, JDeveloper, BEA Workshop, IBM RAD, IBM Websphere Studio etc,. ANT Integration and Command line execution: AppPerfect Web Test s ANT Integration and command line execution so you can functional test your web 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: 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 s from a single machine. Features ed include site recording, dynamic variable substitution, cookies , session tracking, SSL 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. 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 lightweight 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 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 ed: ● ● ● ●
Java/J2EE App Servers (Tomcat, WebLogic, WebSphere, etc.) Operating Systems Resources (Windows, Linux, Mac OS X) Databases (Oracle, MySQL, MS SQL, DB2, Sybase) Web Servers (Apache HTTP Server, MS IIS)
● ● ●
SNMP Monitors (v1 and v2) Ping Monitor (Device heartbeat monitor) 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.
Getting Started This chapter covers information relating to the minimum system requirements, getting product , starting the AppPerfect Web Test, selecting the type of project to be created and overview of how to access the documentation provided with the AppPerfect Web Test and also how to access Help while using the AppPerfect Web Test.
Minimum System Requirements Minimum system requirements for installing AppPerfect Web Test product are listed below: ●
Operating Systems: Microsoft Windows 2000/XP/2003/Vista, Linux x86, Mac OS X
●
RAM: 512 MB
●
U: 1 GHz
●
Disk Space: 130 MB
●
Browser: Internet Explorer 5.x or higher, Mozilla Firefox, Safari
NOTES: The preferred screen area or resolution for the AppPerfect products is 1024 x 768 pixels.
Startup Instructions You can start the AppPerfect Web Test in any of the following ways: For Windows Shortcut: Follow this path: Start -> Programs -> AppPerfect Web Test x.x.x -> AppPerfect Web Test Installation Folder: Follow these steps: 1. You have to browse to the location where you have installed AppPerfect Web Test 2. From the %WebTest_Home%\eclipse folder, run WebTest.exe For Other Operating Systems
Shortcut: 1. In the path provided while installing, you can see the AppPerfect_WebTest_x.x.x shortcuts folder. 2. An executable link file: AppPerfect_WebTest_x.x.x is provided there. Run it. Installation Folder: 1. Go to AppPerfect Web Test home folder 2. Run the file $WebTestHome/eclipse/WebTest Inside AppPerfect Web Test You can read a brief overview of AppPerfect Web Test in the Welcome screen. Now you can start using AppPerfect Web Test to test your Web applications.
ed Products AppPerfect Web Test s : ●
Operating Systems: Microsoft Windows 2000/XP/2003/Vista, Linux x86, Mac OS X
●
Browser: Internet Explorer 5.x or higher, Mozilla Firefox, Safari
●
Databases: All databases that have JDBC drivers and JDBC specifications
●
● ●
AppServers: 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; 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 IDE: Eclipse 2.1.x/3.0, NetBeans 4.0/4.1/5.0, IBM WSAD 5.1.x, IBM RAD 6.0, IntelliJ 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 Web Test x.x.x>Documentation and Examples in Windows, or go to /AppPerfect_WebTest_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-handside frame. The documentation is also available in PDF format online and can be accessed as follows: Using the shortcut: Click Start ->Programs -> AppPerfect Web Test x.x.x -> Documentation and Examples > Print Manuals in Windows or /AppPerfect_WebTest_x.x.x/Documentation and Examples/Print Manuals in Linux. 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 in AppPerfect Web Test.
Getting Product If you need additional assistance with our products, please AppPerfect at the email address specific to your query: Sales: sales(at)AppPerfect.com : (at)AppPerfect.com Online Technical (FAQs, Tips, Tutorials, Docs): AppPerfect Web 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: (at)AppPerfect.com
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' 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 dia AppPerfect product, otherwise, the Notifications feature will not work.
Project Properties Once a new project is defined using the New Project wizard, certain additional settings specific to Web Test are needed to configure and run your test. This dialog box can also be accessed from the menu: Project -> Properties Editor... You can configure following settings : ●
Run Settings
●
Remote Execution Settings
Run Settings Record Think Time: At times, s find it necessary to record the time duration that occurred between a response is received and the next input. An example would be to record the time taken between a page received and when the clicks on a link on the received page. This duration is called Think Time. The working assumption is after a page is received, it typically takes a some time to read and process the information on that page. AppPerfect can record this think time while recording and use the same think time while replaying. ●
Default Think Time: If you do not wish to record think time, you can set a default think time for all requests. By default, this value is set to 1 second.
Customize Recording: AppPerfect is set to record the most commonly used elements and events of your Web page. However, if you find certain elements or events of your Web pages are not being recorded, click the Customize Recording... button and ensure those elements/events are configured correctly. If necessary, you can also define your own elements and events. Refer to System Configuration for more details. Number of iterations: Specify how many iterations of the recorded test AppPerfect should replay. This is typically used when you want to test multiple values of parameters. You can run test for either fixed number of iterations or can run it for iterations calculated based on combination of parameters provided. Timeout (sec): Specify for how much time AppPerfect should keep retrying for successful replaying of an URL or element before marking it as failure. This is important for cases where URL navigation or application initialisation takes long time. Default recorded timeout period is 30 seconds. You can configure the timeout period here and select the option to use this timeout value for all tasks in the test. Treat timed out tasks as failed tasks Select this option if you want application to mark timed out task as failed task in the results.
Ignore Think Time during replaying: By default application ignores the think time between each of the step while replaying the test. In case your application takes long time to initialize or takes long time to navigate or load the page, you can uncheck this option, So that application waits for specified think time before executing each of the step in the test, Save successful response details on disk: By default application just saves the failed responses on disk. In case you need to save all responses during execution then select this option. HTML source of the response will be saved on disk in this case. Responses will be saved in replay folder at project location Save response page as image and show these images in result views: By default application saves the responses as HTML source, but many a times these html pages may not display data fine when offline or in case data is generated dynamically or on execution of some dynamic scripts. In such cases you may select to save response as image, where application takes screenshot of the page and shows same in the result views. This is helpful in getting the exact view of the page during replaying. Clear cookies: On occasion, you may want to clear cookies before replaying test to avoid any preconfigured sessions, in such cases, you can use this option. This option is valid only in case browser used is Internet Explorer. Clear History: On occasion, you may want to clear history before replaying test, in such cases, you can use this option. This option is valid only in case browser used is Internet Explorer. Clear Cache: On occasion, you may want to clear cache to new images, clear stored values for fields etc., in such cases, you can use this option. This option is valid only in case browser used is Internet Explorer.
Remote Execution Settings Run project simultaneously on multiple machines: Select this option in case you need to execute test on multiple machines simultaneously. This way you can run functional test from multiple machines and can control the functional test from one central machine. At the end of execution application will present the functional testing result of entire functional test as well as individual machines. This requires AppPerfect Web 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 8854 and can be accessed as http://HOST_NAME:8854/AppService. 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.
Additional Web Test Properties In addition to the above, there are a few other properties specific to the Web Test that can optionally be set through Tools -> Options... -> Web Test
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. ●
AppPerfect
●
Browsers, JDKs & DBs
●
Custom Certificates
●
Custom Script Settings
●
Web Test
●
Licenses
●
Log Settings
●
Proxy Settings
●
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. 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. Name: Shows the name of the configured in AppPerfect Test Manager. Multiple s can be configured with AppPerfect Test Manager and each client AppPerfect product can use unique name to submit results/ projects to Test Manager. This name is used as identifier and is helpful in generating based reports in Test Manager. In case connection to Test Manager is not configured Or if there is only single 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 Web Test.
Update Schedule Application can be configured to check for new updates/release of the AppPerfect product. On finding one application notifies the 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 s recording/replaying of test on multiple browsers including Internet Explorer, Firefox and Safari Here you can configure browser which application should use to perform recording/replaying. The one selected as default is used for recording/replaying 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, Name, 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.
Custom Certificates In case your application uses a custom SSL certificate (i.e. certificate not provided by Verisign or 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 ing 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.
Web Test General Settings If error occurs during test run: Select the option that best suits your requirement for errors. You can configure to stop test run, ignore error and continue with next task or group, you can also configure to prompt for action in case error occurs and can also retry the execution of the erroneous task during runtime. Auto Detect mouse-over events on elements having mouse-over event handlers: By default, application does not record mouse-over events on elements which does not have mouse-over event selected. If you have a web page which uses mouse-over event to do certain action, for example, in DHTML menu bars, where on mouse-over, menu opens into sub-menus, then you should select this check box. If this checkbox is selected then during recording application tries to find the mouse over event handlers on the fly and records the mouse over event for the element which has mouse over event handler associated with it. Use low level apis to replay mouse events on HTML elements: This option is valid only in case you are using Internet Explorer browser on Windows. By default application uses Web HTML apis to replay mouse events, but in some cases you may have underlying event handlers execute only if mouse cursor is hovered over the target element, like opening of a drop down menu or validation of form on mousedown/mouseup etc. In such cases you should select this option for replaying mouse events on HTML elements. In this case application uses Low level mouse events during execution of events and moves cursor to centre of target HTML element while replaying.
Use Accessibility to record window events: Events on window elements can be recorded in two ways, One by using Window's accessibility framework and recording accessible path to the UI element and other by using standard window enumeration to find the window component. Windows accessiblity provides more control over the nested UI elements in the UI heirarchy and this option should be used for recording on flash/flex or any custom controls. But this requires that the target custom control should implement the standard Accessible framework. All the window controls implements the accessible framework. This option should not be used in case the UI elements in your application changes its position in the UI heirarchy resulting in change of accessible path during each run. Save all frames: By default application only saves those frames or pages on which event is recorded and does not save all the containing frames in the target web page. In case you need application to save all the subframes in your application then select this option. Useful in case you need to add validation on subframes in your application. Perform strict attributes comparision to find element during replaying: During replaying application uses a search algorithm to find the desired html element on the target web page. By default application first tries to find the element at recorded element position also know as "tagIndex" for ex. 5th link or 6th input textbox. It then compares the recorded attributes/properties of the element against the one it finds from element at recorded tag index. Now if some of the attributes does not match then application by default tries to find the matching element with maximum number of matching attributes in the vicinity of the recorded tag position. This is to automatically handle cases where attributes of element changes dynamically during each run or where element position changes during each run. To change this default behaviour of searching element in the web page you can configure to "Perform strict attributes comparision to find element during replaying", where application will find the element only at recorded tag position and will strictly compare all the attributes of the element and in case it fails to match any attribute will report it as a failure. You should use this option in case you have static Web application where attributes and tag position of elements are not changing dynamically. Record drag/drop event if mouse is dragged by more than N pixel: By default application records drag/drop event for window components only if mouse is dragged by more then 10 pixels. In case you need to increase/decrease this range, same can be edited here. Dynamically changing attributes: Elements on your Web page may have certain attributes that change dynamically for certain events, for example, the 'src' attribute of the 'img' element changing dynamically on mouseover. In this case, you should add this attribute to the list of 'Dynamically changing attributes' because otherwise the replayed test is likely to fail as there will be a mismatch in the recorded and replayed element. 'Src' and 'oSrc' attributes are already added to this list by default. You can add more by clicking the add button. All the attributes added to this list will be marked as ignored while recording the test.
Web Elements All the Web or HTML elements that can be recorded by AppPerfect Web Test are configured here.
You can select the ones you need for testing your web application. You can also add new elements and modify/delete the existing ones from here. AppPerfect is set to record the most commonly used elements and events on your Web page. However, if you find certain elements or events on your Web pages are not getting recorded, then first check if you have that specific HTML element configured here and has the corresponding event enabled for same. If you find that element is not present then you should add new HTML element having the same tag name as the html element you need to record and enable the events you need it to listen to. You can either check the HTML source of your web page to find the Tag name of the element or can use AppPerfect's Object Spy feature to find the tag name of the element.
Window Elements This list of elements is valid only in case you are using Internet Explorer browser on Windows to record the test. All the Window elements that can be recorded by AppPerfect Web Test can be configured here. You can select the ones you need for testing custom control like flash/flex/ javascript dialogs/Applet etc on your web application. You can also add new window elements and modify/delete the existing ones from here. AppPerfect is set to record the most commonly used window elements and events on your Web page including applets/flash/flex/javascript dialogs/ Menus/Toolsbar etc.. However, if you find certain elements or events on your Web pages are not getting recorded, then first check if you have that specific Window element configured here and has the corresponding event enabled for same. If you find that window element is not present then you should add new Window element having the same native class name as the window element you need to record and enable the events you need it to listen to. You can find the native window class name of the window element by using AppPerfect's Object Spy feature.
Licenses 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.
Proxy Settings General Settings
In case you are using Internet Explorer as the browser to record and replay and are not recording script for AppPerfect Load Test simultaneously then you do not need to configure these settings. Application provide the feature to simultaneously record script for AppPerfect Load Test while you are recording your Web Test. Also in case you are using Mozilla Firefox or Safari on MAC OSx or any other browser then you require to configure your proxy server settings to properly record and replay test. Refer to Proxy Recording chapter for more details. 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 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 Web Test product also installs a product service which listens to requests from other Web Test product installations on remote machines while performing remote execution. This service by default runs on port 8854 and can be accessed as http://HOST_NAME:8854/AppService
Repository Settings AppPerfect Repository Settings is required to share AppPerfect projects across the team. AppPerfect provides 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
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 ed 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 ed 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 : ●
●
Recording Load Test / Generating Test Cases with Java Unit Test / Recording memory leak scenarios with Java Profiler 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 ed 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 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 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 ●
●
●
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. Select the checkbox to "Use Proxy server..." and Provide proxy server address as localhost and proxy port as 8690. the option "By proxy for local addresses" must be turned OFF 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 ●
●
●
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. 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" 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
●
●
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 The "No proxy for" option must not contain "localhost" or "127.0.0.1" or your target server address
Recording a Web Test Once test settings and system settings are configured, you can start "recording a test". A test is recorded by capturing the events and actions you perform on your browser. Recorded tests can be replayed as many times and as often as needed. Each event and action that has been recorded is replayed as if you were manually performing the actions yourself. Replaying happens without your intervention, thus saving you time and resources. The other important features of AppPerfect Web Test that will enhance your recorded tests are: ● ● ● ●
●
Comprehensive Parameter handling Detailed Validations Intuitive UI Highly Visual and detailed Results of a Test Replay with charts and tables for at-a-glance understanding Ability to export results to HTML and PDF formats
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 Web Test records Web test in either of following ways depending on the browser used: ●
●
Using COM technology (if the browser is Internet Explorer v5.5 and higher AND operating system is Windows) Using Proxy Recording in case of Non-IE browsers like Firefox and Safari
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: Transactions are used in case you are simultaneously recording Load Test script. 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 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 Load Test Script simultaneously AppPerfect recording of Web Test and Load Test scripts simultaneously. In case this option is selected application also records Load Test script in the project. You can later on open this project in AppPerfect Load Test product and execute the load test. For recording Load Test, application uses Proxy recording.
Filters In case Load Test script is simultaneously recorded then application will exclude or include load test 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. All the actions you peform with your application will be recorded in the project.
Running a Web Test and Viewing Results Once the test is recorded it can be replayed and the reports can be generated for analysis. Following are the details on how a recorded test is replayed. Overview: ●
Replaying a Test
●
Viewing Test Results ❍
Project Summary
❍
Machine Summary
❍
Iteration Summary
❍
Group Summary
❍
Browser Summary
❍
URL Summary
❍
Event Summary
Replaying a Test You can replay test using one of the following option: ●
Toolbar:Clicking the Start button from the toolbar..
●
Menu option: Selecting Project -> Run from menubar.
When you replay a test, application launches the default browser configured at Tools -> Options...-> Browsers, JDKs & DBs and first recorded URL is fired. The progress of the Web Test can be seen in the Status tab where the currently executing URL/Event is highlighted. Application replays each step in the browser in the sequence it was recorded. While the test is replaying, you can pause it for a while by clicking Pause. You can stop the test anytime while replaying by clicking Stop button.. When there are multiple groups in the test, there are a few things to note: ● ● ●
All groups will be replayed by default. You can choose to 'Ignore' a group by selecting the 'Ignore Group' checkbox. You can run only the selected group by selecting 'Run Selected' from the Project menu option.
Once the test completes replaying, results of the execution can be seen in the Results tab.
Viewing Test Results In the Web Test Status tab you can see the progress of replaying of the test through the test tree. Each node in the test tree is visited as and when that particular URL is visited or a particular event is replayed. Once the replay is over, the results can be seen in the Results tab on the navigation frame. The Results tab shows the results tree. The frame on the right-hand side will show the result at a: ■
Project level: You can see the Project Summary which is an overall result for the project including a combined view of all the machines on which test is executed. ■
Machine level: In case you are executing test on multiple machines simultaneously then you can see summary of execution of project on each machine. When running test on single machine application shows machine as localhost. ■
Iteration level: You can see the Iteration Summary which shows the results for the selected Iteration within the project. ■
Group level: You can see the Group Summary which shows the results for the selected Group within an Iteration. ■
Browser level: This is the result for the selected Browser within the selected Group within an Iteration. ■
URL level : This is the result for the selected URL within the selected Browser .. group and iteration. ■
Event level: This is the result for the selected Event.
Project Summary Project Summary shows the overall results of the test. The right hand side frame shows following : 1. Machine Summary: This section graphically represents the status of all the Machines on which the project was executed. A table also shows the same status data in a table, which is used to draw the pie-chart. 2. Machine Replay Status Table: This section shows details of the Machines. All the Machines on which the project has run, are shown in this table along with their status (whether failed or succeeded or Not Played or Stopped) and the Machine names are hyperlinked to the details of that Machine.
Machine Summary Machine Summary shows the overall results of execution of test on single machine. The right hand side frame shows following :
1. Iteration Summary: This section graphically represents the status of all the Iterations for which the project has run. A table also shows the same status data in a table, which is used to draw the pie-chart. 2. Iteration Replay Status Table: This section shows details of the Iterations. All the Iterations for which the project has run, are shown in this table along with their status (whether failed or succeeded or Not Played or Stopped) and the Iteration names are hyperlinked to the details of that Iteration.
Iteration Summary The Iteration Summary shows results for that iteration in of the success or failure status of the groups replayed within the iteration. The right hand side frame shows following: 1. Group Summary: A pie chart shows the success or failure status of Groups in the selected Iteration. A table accompanies the pie chart. 2. Group Replay Status Table: This table lists the groups in the iteration. You can click a group name to view its detailed status - the Group Summary.
Group Summary The Group Summary shows results for the selected Group. The right hand side frame shows following: 1. Group Summary: This section has two pie charts. The URL chart shows the status of the URLs replayed in this group and the Events Chart shows the status of the Events within the URLs of this group. 2. Browser Replay Status table: This table lists the Browsers with their status. You can click a browser Title to access its details - the Browser Summary.
Browser Summary The Browser Summary shows results for the selected Browser. The right hand side frame shows following: 1. URL Replay Status table: This table lists the URLs with their status. You can click a URL Title to access its details - the URL results. 2. Web Browser Control: This control shows the page loaded in browser during replaying
URL Summary The URL Summary shows results for the selected URL. The right hand side frame shows following tabs:
1. Status tab: This tab shows details of the URL that was replayed including its Start and End time, its status - successful or failed and reason for failure if failed. 2. URL_Event tab: This tab lists all the Events/Subframes under the URL with status for each. You can click the event/subframe to see its details. 3. Validations tab: If you have validations configured for this URL, you can see the results of the same here. This view will show the validation tree for each type of validation along with the status (Successful or Failed). In case of failed validations you can click on individual Page/Element/Text/Date Validation etc to check its furthur details. 4. Web Browser Control: The web control at bottom shows the page saved during replaying
Event Summary The Event Summary shows results for the selected event. The right hand side frame shows following: 1. Status tab: This tab shows details of the Event that was replayed including its status successful or failed and reason for failure if failed. 2. Web Browser Control: The web control at bottom shows the page saved during replaying
Auto-Update Web Test Most software undergo changes over a period of time. These changes may occur during initial development of the software, or after the release of the software. Web application goes through the changes most frequently. So a Web test recorded for any prior version of web application may not work for the new version if the pages have changed or if the element's position in the page have changed. To overcome these problems and to avoid re-recording of test all over again, AppPerfect Web Test provides Auto-Update test Feature, where an earlier recorded test will be automatically updated to suit the new version of application wherever possible without any efforts to re-record the test all over again.
Auto-Updating a Test You can automatically update complete test or just a selected group. To auto-update a test, first open it in Web Test. ●
●
Toolbar:You can auto update a test by clicking the Auto-Update Test button from the toolbar.. Menu option: From the menu bar you can auto update a test like this: Project -> AutoUpdate Test
When you auto-update a test, application launches the default browser configured at Tools -> Options...-> Browsers, JDKs & DBs and first recorded URL is fired. Now Web Test keep replacing the new response pages with the recorded ones. To automatically update the tag index of web element, Web Test tries to find the element on new page using the recorded attributes. In case it finds the element, it replaces the older tag index with the new tag index and continues by playing event on that element. In case AppPerfect Web Test is not able to find the element with matching attributes, you will be prompted to do the corresponding event manually, so that AppPerfect can continue with next element or page. In this case, you will need to manually update the tag index and other attributes for this element using the Editor tab once the Auto-Update is over. To manually update the elements which were not updated by AppPerfect, select the concerned element in the Editor tab, and on the right hand side Details tab, click on Object Spy.. button. Refer to Object Spy section on how you can spy the element and import its attributes. While the test is auto-updating, you can pause it for a while by clicking Pause. You can stop the auto-update anytime by clicking Stop button.. When there are multiple groups in the test, there are a few things to note:
●
All groups will be auto-updated by default. You can choose to Auto-Update just selected group by selecting 'Auto-Update Selected' from the Project menu item.
●
You can also select the group in the Editor tree and right click and select "Auto-Update
●
Group" option to update just the selected group.
Object Spy AppPerfect Web Test provides for Object Spy feature where you can spy on any web or window element in the page and fetch its attributes/properties. Object Spy is useful while manually updating or adding new element to the existing test script and is also useful while identifying and adding new Web or Windows Element to list of ed elements during System Configuration. In case you are using Internet Explorer you need to open your application manually with Internet Explorer browser, in case you are using Safari or Firefox, application launches the browser with starting URL in your test. Select the menu option Project -> Object Spy.. It will launch a toolbar with option to Start spy. Click on start spy button and now click on the Web or window element which you need to spy in your application. It should highlight the element in page with green rectangle. At this point you can stop spy and view the element's properties/attributes. In case you find that certain events in the test are not getting recorded and you need to configure and add new Web or Windows Element to the list of ed elements at Tools -> Options -> Web Test -> Web/Window Elements, Check out the tag name/native class attribute. Once you identify the tag / native class of element you can add same to list of ed elements at Tools -> Options -> Web Test -> Web/Window Elements. Once you add the element to the list of ed elements and configure the required events for same you should be able to record events on it fine. Object Spy is also available while adding new element/event to the test manually. To add new event select the URL node in the Editor tree for which you need to add new Event. Right click and select the option to Add Event.. You will find a button to access Object Spy feature there to get the attributes of new element. Object Spy is also useful in updating existing attributes of the element in case application has changed since the test was recorded.
Editing Web Test You can edit the recorded test using Editor UI. The Editor UI shows you a hierarchical list of the elements of your recorded test: ●
Project
●
Parameters
●
Groups
●
Browser
●
URL
●
Event
Project On selecting the Project node in the Editor tree you can see following on the right hand side tab:
Host Settings For each unique host used in the test there is a host setting entry in this table. Each browser and url 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 URL or browser. 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 Settings 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 exisiting 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: In a project the tasks are stored in logical groups. This enables s to better organize the test. A test can have one or more groups. All the groups in the test are shown in this table. You can : ● ● ●
Add a Group : To add new group to the test. Delete a Group : To delete a group from the test. Ignore any or all the groups (if you will ignore all the groups, you will not be able to run the
●
test). Re-order groups : To move groups in the test and change order for their execution.
Parameters An important aspect of deg a good test is to define parameters correctly. Most modern applications use some kind of parameterization scheme to communicate data between the end and the Web application. When a Web Test is recorded via a browser, all parameters that are encountered for the recorded URLs 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. After recording, all Browsers/URLs/Events are stored in the Group for which recording was done. Behavior of the various groups can be configured by clicking the group node in the Editor tree and setting its properties on the right side of the window. Following properties can be set:
Group Details Group Name: This is the unique identifier associated with a group. Each group in the test should have a unique name. Starting URL: This is the starting URL which is used when recording tasks in this group. While recording application launches new browser with this starting URL. Launch New Browser: Should be selected in case you want application to launch new browser when execution of this group begins. In case there are multiple groups recorded in the test, then you can reuse the Browsers created in earlier groups by keeping this option unchecked. In such cases you should use same Browser identifier across multiple groups. Ignore Group: To decide whether the group should be ignored while executing test. Set Proxy while replaying: Should be kept selected if test was recorded with Internet Explorer and there was simultaneous recording for Load Test done. 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 Settings: In case your application requires Authentication then same should be configured here. Refer to Authentication Schemes for details on various authentication mechanisms that can be configured with AppPerfect.
Browser Settings Browsers Table: Each group can have multiple browsers recorded in it. All the recorded browsers in the test are shown in this table. You can : ● ● ●
Add a Browser : To add new browser task to the test Delete a Browser : To delete the selected browser Re-order Browsers : To rearrange browsers in the test.
To move a Browser/URL/Event from one group to another, click right mouse button on that Browser/ URL/Event, 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. The default group that is recorded is called ActionGroup1. Right click it to access the following: ●
Run Selected Group : To run selected group.
●
Auto-Update Group: To auto-update selected group
●
Cut/Copy/Paste : You can cut/copy/paste the groups in the test. Remove All : To remove or clear all recorded tasks in the group. Add Browser Manually : To add new browser task to the test manually. Add Browser Using Recording : To add new tasks to the group using Browser recording. Add Group : To add new Group to the test Delete Group : To delete group from the test Move Up/Down : To reorder groups in the test. Import Groups recorded... : For all the recordings you do with AppPerfect Web Test, application creates a .record file on the disk under project location. You can import groups from same project or from other projects using this option. You need to provide the path for the .record file present at the project location from where you need to import. Script Editor
●
Properties
● ● ● ● ● ● ● ●
Browser Within a Group, several browser instances may be recorded depending on if you have opened new browser windows while recording the test. Behavior of the various browsers can be configured by clicking the browser node in the Editor tree and setting its properties on the right side of the window. In the right hand side you can view the first page recorded in the browser and the
following tabs:
Details Browser title: This is the unique identifier associated with a browser. Each browser in the test should have a browser title associated with it. During execution application uses this title to check if new browser should be created or if there is already a browser open with given title and can be reused. Timeout: This is the maximum time application waits before marking the browser task as timedout during execution. Host Name: This is the host settings associated with the page loaded in the browser. While creating new browser application uses this host in the url to launch the browser. Think Time: This is the time application waits before creating a new browser during execution. This think time is used only in case you have "Ignore think time during replaying" unchecked at Project -> Properties.. Path: This is the url path associated with the page loaded in the browser.
URL/Event Here you can see the list of all the URLs/Events accessed within the browser while recording. You can ignore, delete or reorder URLs/Events here. Multiple urls/events can be selected at a time and can be deleted or reordered. You can set breakpoints at any of the URLs/Events. While replaying the test, these breakpoints will be taken into consideration and application will prompt you for action like if you need to Continue replaying or Stop test etc.. when this breakpoint is reached Right click a browser node to access the following: ● ● ● ● ● ● ●
● ● ●
Cut/Copy/Paste : You can cut/copy/paste the browsers in the group. Remove All : To remove or clear all recorded urls/events in the browser. Add Browser Manually : To add new browser task to the group manually. Add Browser Using Recording : To add new browser to the group using Browser recording. Delete Browser : To delete browser from the test Add URL Manually : To add new URL to the browser manually. Add URLs/Events using recording : To add new tasks to the browser using Browser recording. Add Event : To add new event to the browser manually. Move Up/Down : To reorder browsers in the test. Import Groups recorded... : For all the recordings you do with AppPerfect Web Test, application creates a .record file on the disk under project location. You can import groups
●
from same project or from other projects using this option. You need to provide the path for the .record file present at the project location from where you need to import. Script Editor
●
Properties
●
Replay till this point and record thereafter : When you do browser recording application launches new browser with starting URL. Using this option you ask application to first replay test till selected task and then continue recording. This way you can record in the middle of the test using browser recording.
URL Each browser will have several URLs recorded. In the right hand you can view the following tabs:
Details Title: This is the title of the page as seen in the browser title bar. Timeout: This is the maximum time application waits for page before marking the url task as timedout during execution. Ignore parameter validation: By default application does not compare the URL parameters in recorded and replayed urls. In case you need to do this validation you should uncheck this option. Set Breakpoint: You can set breakpoints at the selcted URL. While replaying the test, these breakpoints will be taken into consideration and application will prompt you for action like if you need to Continue replaying or Stop test etc.. when this breakpoint is reached. Think Time: This is the time application waits before fetching the response from the browser. This think time is used only in case you have "Ignore think time during replaying" unchecked at Project -> Properties.. Host Name: This is the host settings associated with the url. Fire URL: By default application does not fire the urls on its own. It assumes the events to navigate the pages in the browser. In case you need to fire any URL explicilty then you can select this option. In case this option is selcted application will fire the url in browser after constructing the same using the host name, path and url parameters. Path: This is the url path associated with the page. Ignore URL: To ignore the url during replaying.
Benchmark Page: This shows the path for the recorded page stored on the disk. The web page you see in the browser control at top is shown using this path. You can add validation to the URL only if there is a page stored for the url. In case your application page has changed since the test was recorded, you should set the benchmark page to new version of the page.
Parameters If there are parameters associated with the selected URL, you can see them here. You can parameterize these parameters. For more details refer to the chapter on Parameters.
URL / Event Here you can see the list of all the URLs/Events recorded within the selected URL. You can ignore, delete or reorder URLs/Events here. Multiple urls/events can be selected at a time and can be deleted or reordered. You can set breakpoints at any of the URLs/Events. While replaying the test, these breakpoints will be taken into consideration and application will prompt you for action like if you need to Continue replaying or Stop test etc.. when this breakpoint is reached
Validation 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. You can add validations to URL page here. To add new validation right click the desired DOM tree node of the Standard DOM tree you can see above these tabs. It will show the following options : ● ● ● ● ●
●
● ●
● ● ●
Expand All / Collapse All : To expand/collpase the dom nodes in the tree. Find... : To search for particular node in the tree View Source : To view the HTML source of the recorded page. Change Benchmark Page : To change the path of the stored page 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. 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. Validate HTML Source : To compare or validate complete HTML source of the page. 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. Edit Validation : To edit already existing validation. Delete Validation : To delete any existing validation Add Text Validation : To add Text validation, that is to find if a particular text or value is present on the page. Validation s both cases sensitive and case insensitive search.
●
●
You can also parameterise the value to find and can also use regular expressions to search. Add Date Validation : To add Date validation where you can compare the date value present on page against today's date in different formats. 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. You can right click the URL node to access the following features for URL: ● ● ● ●
● ●
Cut/Copy/Paste : You can cut/copy/paste the URLs in the group. Remove All : To remove or clear all recorded frames/events in the selected URL. Add URL Manually : To add new URL to the browser manually. Add URLs/Events using recording : To add new URLs/Events to the browser using Browser recording. Delete URL : To delete URL from the test Parameterize: To parameterize URL parameters. For more details refer to the chapter on Parameters.
●
Add Event : To add new event to the URL manually. Move Up/Down : To reorder URLs in the test. Show DOM tree : If selected DOM tree of the stored response is shown on the right hand side tab. Import Groups recorded... : For all the recordings you do with AppPerfect Web Test, application creates a .record file on the disk under project location. You can import groups from same project or from other projects using this option. You need to provide the path for the .record file present at the project location from where you need to import. Script Editor
●
Properties
● ● ●
●
●
Replay till this point and record thereafter : When you do browser recording application launches new browser with starting URL. Using this option you ask application to first replay test till selected task and then continue recording. This way you can record in the middle of the test using browser recording.
Event Each browser/URL will have several events recorded. In the right hand you can view the following tabs:
Details Title: This is the title of the recorded event which is helpful in identifying the event.
Timeout: This is the maximum time application waits for event to reply successfully before marking the event as timedout during execution. Search element using exact match of attribute values: While finding elements having href and src attributes, application does not match the complete string but just checks for the occurence of these attributes in the substring while doing comparision. This is done because href and src attributes generally are created dynamically or have parameters which changes dynamically. You can select this option in case you need exact comparision for these attributes while finding element during execution. Set Breakpoint: You can set breakpoint for the selected event. While replaying the test, these breakpoints will be taken into consideration and application will prompt you for action like if you need to Continue replaying or Stop test etc.. when this breakpoint is reached. Think Time: This is the time application waits before replaying this event. This think time is used only in case you have "Ignore think time during replaying" unchecked at Project -> Properties.. Element: This is the name of the element on which event was recorded. The element name is picked from the elements configured at Tools -> Options -> Web Test -> Web/Window elements. Element Class: This is the tag name or native class of the element on which event was recorded. Ignore Event: To ignore the event during replaying. Event: Drop down showing all the events which are ed on this element. This drop down as the recorded event selected. In case you need to change the recorded event for the element you can change it here by selecting the required event. You can see the event arguments for the selected event in the table below. You can edit the event arguments or parameterize the same. Object Spy: In case you need to update attributes for the element you can use Object Spy to do so,.
Attributes You can see all the recorded attributes/properties for the element here. These attributes are used while searching the element during replaying. You can parameterize and edit attributes here. You can right click the Event node to access the following features for Event: ● ●
● ● ●
Cut/Copy/Paste : You can cut/copy/paste the Event using this option. Add URLs/Events using recording : To add new URLs/Events to the browser using Browser recording. Add Event : To add new event to the test manually. Delete Event : To delete event from the test Parameterize Attributes: To parameterize Element attributes. For more details refer to the
chapter on Parameters.
●
Move Up/Down : To reorder events in the test. Import Groups recorded... : For all the recordings you do with AppPerfect Web Test, application creates a .record file on the disk under project location. You can import groups from same project or from other projects using this option. You need to provide the path for the .record file present at the project location from where you need to import. Script Editor
●
Properties
● ●
●
Replay till this point and record thereafter : When you do browser recording application launches new browser with starting URL. Using this option you ask application to first replay test till selected task and then continue recording. This way you can record in the middle of the test using browser recording.
Parameters Parameter are used in most modern applications to communicate data between the and the application. AppPerfect offers extensive parameter-management. Parameter selection and hence testing with various parameter values is completely automated. Parameter values are ed 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 ed in AppPerfect Web 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 Web 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.
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 Web 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 page which takes a name and a . You need to test this page to ensure valid s (of various categories) are accepted and invalid s (incorrect name/) are rejected. To test this page, what you essentially want to do is connect a series of names and s to the page. This process of defining multiple values for elements is called Parameterization. While it is possible to manually go to the page and enter each of the name/ 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.
Element/Event Parameterization AppPerfect Web Test records attributes for the HTML/Window element on which event was
recorded. It also records the event arguments which should be used to replay events, like "text" argument containing the value with which set/type events should be executed. You can parameterise Atributes as well as event arguments. Multiple parameter values can be defined for a recorded element. If the test is run for multiple iterations you will also need to specify the mechanism that the AppPerfect Web Test must use to pick from the list of possible values. Random and Sequential are two ed ordering in which values can be selected.
URL 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 page. In a real world scenario, you might have dozens if not more ed s, each with their own and other information such as locale, timezone. For such a scenario, the URL could be: http://machine:port/application/.jsp?=name&=pwd&timezone=pst In the URL above, "" and "" are parameters that are accepted by the ".jsp" URL. The "name" and "pwd" are parameter values that the may have entered in the . jsp form page and clicked on the Submit button. Most modern Web sites use this kind of mechanism of ing parameters and values through the URL. One of the most common objects ed as a URL parameter is a "session id". AppPerfect Web Test recognizes the wide spread use of parameters and provides extensive 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. ●
●
●
Select the URL 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'. You can also parameterize recorded attributes of element. Just select any element/event in the Editor tree and select Attributes tab on right hand side window and parameterize the Attribute using the "Parameterize" button provided. You can also parameterize arguments in event apis. Just select concerned event in the Editor tree and on right hand side Details tab look for Event arguments if any and parameterize the same using the "Parameterize" button provided. Say for example in case you need to run test with differnt input values for set/type events, then you can parameterize the "text" argument in this case.
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: Data Source: You can choose the data source from one of the following : ●
Fixed Values
●
Import from Database
●
Import from CSV File
●
Calculated Values
●
-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 Web Test. In case this dropdown is empty, you need to configure a Database with AppPerfect Web 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. 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 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.
-Through Values -Through parameters are those whose value will be picked from the response of previous URL while replaying the test. You can set -through parameters in the Parameters view by selecting the "-Through Values" from the data source combo box. An example of -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 as that session might have expired. For a situation like this, you need to set the '-through Values' option for the parameter.
Authentication Schemes AppPerfect products 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 ed.
Form Based Authentication: This authentication scheme means is authenticated using name, parameters entered in the input elements present in a HTML form. In this kind of authentication scheme 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 name and 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 name and , 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 ().
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 T connection rather than the individual HTTP interactions. On Microsoft Windows platforms, NTLM authentication attempts to acquire the credentials from the system without prompting the 's authenticator object. If these credentials are not accepted by the server then the 's authenticator will be called. Because the Authenticator class was defined prior to NTLM being ed, it was not possible to add 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 name by prefixing the domain name followed by a back-slash '\' before the name. With this method, existing applications that use the Authenticator class do not need to be modified, so long as s 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.
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 name, authetication to identify the client.
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 ed : ●
Page validation
●
Text validation
●
Attribute validation
●
Date validation
●
Database Query validation
●
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 : ● ● ●
Size of the page Count of elements on the page 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 "" 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 "" should be done.
This validation will be successful only if you have "AppPerfect Team" present on the page. 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 Web 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 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. Please refer to Customizing Test Script chapter for more details.
Customizing Test Script AppPerfect Web 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 : ●
Editing in Script Editor
●
Adding Custom Code to Test Script
●
Adding Custom validation ❍
Adding custom URL Validation
❍
Adding Custom Database validation
●
Fetching value from response and ing it to Event argument
●
Script documentation
Editing in Script Editor You can view and edit the script in script editor provided in the Web 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 Web Test is running. By default AppPerfect Web Test runs with the JRE present at $WebTest_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. 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 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 URL 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 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. Refer to the code snipped below parsing the web response to find the product Table and validating if the product table has "Web Test" listed in it : function executeUrl_2() // script function for AppPerfect Product Page { var url = engine.createURL(2, 'http', 'www.appperfect.com', 80, '/', false); url.setIgnored(false); url.setThinkTime(1); url.setIgnoreParam(true); url.setTimeout(30); url.setBreakPoint(false); url.setFireURL(false); url.setTitle('AppPerfect'); url.setBenchmarkFile('recorded/2009_3_21_1_40_52_37/ActionGroup1/URL_2.html'); var successful = engine.executeURL(url); if(! successful) { log('URL Failed'); } else { //log('URL is Successful'); //Validations may be added here.
//Custom Validation code starts here var validationSuccess = false; var htmlPage = url.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 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 == 'Web Test') { validationSuccess = true; break; } } } } if(!validationSuccess) { url.setTaskSuccessful(false); url.setReasonForFailure("Table data validation failed, could not find Web Test product in table."); } //Custom Validation code Ends here } engine.release(); }
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 Web Test" present in the table. To add such validation you edit script code as follows : function executeUrl_2() // script function for AppPerfect Product Page { var url = engine.createURL(2, 'http', 'www.appperfect.com', 80, '/', false);
url.setIgnored(false); url.setThinkTime(1); url.setIgnoreParam(true); url.setTimeout(30); url.setBreakPoint(false); url.setFireURL(false); url.setTitle('AppPerfect'); url.setBenchmarkFile('recorded/2009_3_21_1_40_52_37/ActionGroup1/URL_2.html'); var successful = engine.executeURL(url); if(! successful) { log('URL Failed'); } else { //log('URL is Successful'); //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 == "Web Test") { validationSuccess = true; break; } } engine.closeResultSet(resultset); if(!validationSuccess) { url.setTaskSuccessful(false); url.setReasonForFailure("Custom validation Failed: Product Web Test not present in database."); } //Custom Validation code Ends here } engine.release(); }
Fetching value from response and ing 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. You will have a "set" event recorded on Input text field in the text. The following code demonstrates ing the value fetched from table to the set event on input text field : 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 response. var parameterValue; Now we will parse the URL and initialise parameterValue with the value we need to to the event. function executeUrl_2() // script function for AppPerfect Product Page { var url = engine.createURL(2, 'http', 'www.appperfect.com', 80, '/', false); url.setIgnored(false); url.setThinkTime(1); url.setIgnoreParam(true); url.setTimeout(30); url.setBreakPoint(false); url.setFireURL(false); url.setTitle('AppPerfect'); url.setBenchmarkFile('recorded/2009_3_21_1_40_52_37/ActionGroup1/URL_2.html'); var successful = engine.executeURL(url); if(! successful) { log('URL Failed'); } else { //log('URL is Successful'); //Validations may be added here. //Function to parse the response starts here var htmlPage = url.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 to the set event parameterValue = cellElement.getNodeValue(); } //Function to parse the response Ends here } engine.release(); }
We have parsed the response and have initialised the global variable parameterValue with requried value. Now we will this value to set event argument. function executeEvent_3() // script function for set on WebInputElement q : AppPerfect { var element = engine.createWebInputElement(3, 2); element.setIgnored(false); element.setThinkTime(2); element.setTimeout(30); element.setExactMatchForAttributesComparision(false); element.setBreakPoint(false); element.setTitle('set on WebInputElement q : AppPerfect'); element.addAttribute('autocomplete', 'off', false, false, ''); element.addAttribute('maxlength', '2048', false, false, ''); element.addAttribute('name', 'q', false, false, ''); element.addAttribute('size', '55', false, false, ''); element.addAttribute('title', 'Product Search', false, false, ''); element.addAttribute('tagIndex', '1', false, false, ''); //ing parameterValue to the set event argument element.set(parameterValue); engine.release(); }
Script documentation Refer to Scripting documentation for more details on scripting apis ed. While editing the script in script editor, you can open the API documentation using Help -> Java Documentation...as well
Troubleshooting Test Failures Web tests could fail because of improper System Configuration or because of change in target application since test was recorded. Find below details on how you can troubleshoot common Recording Failures and Replaying Failures.
Recording Failure Common problems faces during recording are as follows : ●
Unable to record events on some elements in the page
●
Unable to record mouse hover events
●
URL Validation fails with Invalid URL message on Starting Recording
●
Unable to see page fine in the Browser once browser launches during recording
●
Unable to record any event on application while using Safari or Firefox Browser
●
Unable to record on flash applications when using Safari or Firefox Browser
●
Unable to record Tab keypress events
●
Application does not record subframes in the test
Unable to record events on some elements in the page: In case you find that certain events in the test are not getting recorded then you need to configure and add new Web or Windows Element to the list of ed elements at Tools -> Options -> Web Test -> Web/Window Elements, First find out the tag name/native class attribute of that element using Object Spy. Once you identify the tag / native class of element you can add same to list of ed elements at Tools -> Options -> Web Test -> Web/Window Elements. Once you add the element to the list of ed elements and configure the required events for same you should be able to record events on it fine.
Unable to record mouse hover events: By default, application does not record mouse-over events on elements. If you have a web page which uses mouse-over event to do certain action, for example, in DHTML menu bars, where on mouse-over, menu opens into sub-menus, then you should have option "Auto Detect mouse-over events on elements having mouse-over event handlers" selected at Tools -> Options -> Web Test -> General Settings. If this checkbox is selected then during recording application tries to find the mouse over event handlers on the fly and records the mouse over event for the element which has mouse over event handler associated with it. In case the target element does not have mouseover handler and you still want to record mouse over event on that then you need to check the list of ed elements at Tools -> Options -> Web Test -> Web/Window Elements and see if
mouse hover event is enabled for that particular element.
URL Validation fails with Invalid URL message on Starting Recording: Application tries to validate starting URL before starting recording. This validation could fail because of one of the following reasons : ●
●
●
●
The url provided is incorrect or target server is down. So first check if you can access your application fine outside of AppPerfect using the starting URL provided. Also make sure that you provide complete url including the protocol, for ex. http://www.AppPerfect.com Make sure that if you are using some proxy to access your application then same is configured at Tools -> Options -> Proxy Settings -> Target Proxy Server Settings In case your application requires Authentication then make sure that you have configured same under Authentication Settings in AppPerfect Recorder dialog. Make sure that firewall on machine is not blocking the access to target application.
Unable to see page fine in the Browser once browser launches during recording This generally happens when application uses local Proxy for Recording on non IE browser or while recording Load Test script simultaneously. Common reason of this is because of not being able to set proxy fine in the Target browser. In such cases you may need to set proxy manually in the browser. Refer to Proxy Recording chapter for details on the proxy settings configuration in browser. Also make sure that firewall is not blocking the port used to launch the local proxy and this port is not used by any other application on machine. By default application uses port 8690 for starting local proxy. Another reason when this could happen is when you are trying to test application deployed on local server in which case you are using localhost in the starting URL. In such cases make sure to use IP of the machine in the starting url. So instead of using http://localhost:port/xyz you should use http:// machine-ip:port/xyz as starting url where machine-ip is the IP address of the machine where target application is running.
Unable to record any event on application while using Safari or Firefox Browser While recording Web Test for Firefox or Safari or any non-IE browser, application starts a local proxy server and sets same in the browser. So first check that proxy is getting set fine in browser. Refer to Proxy Recording chapter for details on the proxy settings configuration in browser. Once proxy is set in browser this local proxy server injects each response with recorder javascript. This recorder javascript takes care of recording the events on web application. So if your application has javascript errors and if for some reason the page does not completely load in the browser then application will fail to record any event as the recorder script will be unable to load in that case. So make sure that your application runs without script errors when run normally outside of AppPerfect.
Unable to record on flash applications when using Safari or Firefox Browser
Flash application recording is ed only with Internet Explorer on windows. In general all the window specific components are ed only when recorded on windows platform using Internet Explorer. In case you need to test Flash applications in Safari or Firefox browser on Windows platform, you can use AppPerfect App Test product for same.
Unable to record Tab keypress events While recording keypress events on Web elements application records set api for any alphanumeric input on text elements. The non alphanumeric keys like Tab keys are not recorded by default. In general recording of these events are not required and hence is disabled. You can enable recording for non-alphanumeric keys like Tab keys by selecting "type" event for each of the Web Element at Tools -> Options -> Web Test -> Web Elements.
Application does not record subframes in the test By default application does not record all the subframes in the page and only records those frames on which events are recorded. To save all subframes in page you should select the "Save All Frames" option at Tools -> Options -> Web Test -> General Settings.
Replaying Failure Common problems faces during replaying are as follows : ●
Unable to find element on the page and test fails with time out errors
●
URL Validation fails with Invalid URL message on starting Replaying
●
Replaying event on wrong element in page
●
Test stops in between without completing execution
●
Unable to see page fine in the Browser once browser launches during replaying
●
Replayer does not wait for target application to load completely in browser
●
Script handlers on page are not triggered on replaying event
Unable to find element on the page and test fails with time out errors: During replaying application uses a search algorithm to find the desired html element on the target web page. Application first tries to find the element at recorded element position also know as "tagIndex" It then compares the recorded attributes/properties of the element against the one it finds from element at recorded tag index. Now if some of the attributes does not match then application tries to find the matching element with maximum number of matching attributes in the vicinity of the recorded tag position. In case if application cannot find any element with matching attributes then report the event as failure. In such cases check that the recorded attributes are not changing during each run. If they are changing then you need to ignore same which can be done by selecting the Event in the Editor tree and ignoring the changing attributes on right hand side Attributes tab. You
can refer to Results view and see the reason for failure for the event to find which attributes did not match for the element during replaying Another common reason for this failure is that application did not wait for enough time to complete page initialisation and hence required element is not available when application tries to replay on same. In such cases you should replay test with "Ignore think time during replaying" deselected at Project -> Properties.. and providing appropriate think time for each of the step. Also the failure could be genuine in case target application has changed since the test was recorded. So in case if the element's properties have changed since the test was recorded then you need to update the properties as explained in Object Spychapter.
URL Validation fails with Invalid URL message on starting Replaying: Application tries to validate starting URL before starting replaying. This validation could fail because of one of the following reasons : ●
●
●
●
The target server is down. So first check if you can access your application fine outside of AppPerfect using the starting URL provided. Make sure that if you are using some proxy to access your application then same is configured at Tools -> Options -> Proxy Settings -> Target Proxy Server Settings In case your application requires Authentication then make sure that you have configured same under Authentication Settings for the Group. Make sure that firewall on machine is not blocking the access to target application.
Replaying event on wrong element in page This could happen if there are multiple elements on the page having same attributes and element's position is changing during each run. In such cases application may end up matching attributes for different element and replay on that. So all the elements on the page should have unique properties like id or name so that AppPerfect can identify the elements uniquely during test run. Another reason for this could be that the unique attribute for the element which could identify the element is changing. In such cases you can ignore that attribute and then replay the test with "Perform strict attributes comparision to find element during replaying" option selected at Tools -> Options -> Web Test.
Test stops in between without completing execution Test could stop in between in case there are problems with the recorded script. This could happen if in case you have done any editing to the script to add custom code. In such cases application generally terminates script logging errors in the log files. Check the log files at $WebTest_Home/ logs folder and see if you find test stopping because of script error. In case test stops due to scripting error then log file will show you the exact line number in script from where the script was
terminated. Open Script Editor using Project -> Script Editor and go to that line number and see what is wrong with the script code. In case you have done any editing to the script to add custom code then make sure that you have followed all steps correctly as mentioned in Adding Custom Code to Test Script chapter.
Unable to see page fine in the Browser once browser launches during replaying This generally happens when application uses local Proxy for Replaying on non IE browser. Common reason of this is because of not being able to set proxy fine in the Target browser. In such cases you may need to set proxy manually in the browser. Refer to Proxy Recording chapter for details on the proxy settings configuration in browser. Also make sure that firewall is not blocking the port used to launch the local proxy and this port is not used by any other application on machine. By default application uses port 8690 for starting local proxy.
Replayer does not wait for target application to load completely in browser If application does not wait for enough time to complete page initialisation in such cases you should replay test with "Ignore think time during replaying" de-selected at Project -> Properties.. and providing appropriate think time for each of the step. In this case application will wait for specified think time before replaying each of the step.
Script handlers on page are not triggered on replaying event By default application uses Web HTML apis to replay mouse events, but in some cases you may have underlying event handlers execute only if mouse cursor is hovered over the target element, like opening of a drop down menu or validation of form on mousedown/mouseup etc. In such cases you should replay test with "Use low level apis to replay mouse events on HTML elements" option selected at Tools -> Options -> Web Test. In this case application uses Low level mouse events during execution of events and moves cursor to centre of target HTML element while replaying.
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 rerecording common functionalites already implemented in existing scripts can be reused. Say for example you have / functionality in your application. Now say for each functionality like adding new request, order processing etc. you need to first to the application. So now instead of recording / groups in each of the script you can record / groups in one script and later on link this script to all the scripts whereever / is required. Now say, you need to test with different names and s, so you need to do change just in one script having / 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.
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.
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 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: ●
"%JAVA_HOME%\bin\javaw.exe" -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%
For Linux ●
"$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 ed 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 ed 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 ed 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 ed as the command line arguments to the
command open the exported command line batch file in Text Editor. It has all the ed parameters listed.
Team Server Or Repository Configuration Team Server is required to share AppPerfect projects across the team. AppPerfect provides for Subversion(SVN) server for sharing projects across team. You need to , install and configure SVN(Team) server manually. For Windows/Linux/Mac OSX: Please refer to following sections of document to , install and configure SVN Server on your machine. ● ● ●
Manually Installing SVN Server Manually Starting SVN Server 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 ●
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. ● ● ● ● ●
Checkout Projects Synchronize Workspace Share Project Synchronize Project 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 :
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 s in a SVN to share projects with each other. You need to follow following steps to set up a Repository ● ●
Creating SVN Repository Configuring SVN Repository
Creating SVN Repository You can create a repository using following command : On Windows:svn create %REPOSITORY_PATH% On Linux/Solris/Mac OSX:./svn create $REPOSITORY_PATH Where REPOSITORY_PATH is the path on local machine where the projects will be stored for sharing. For example On Windows svn create C:\AppPerfect\Repository 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 /.svn 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 s 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/
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_NAME% %SVN_% 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_NAME $SVN_ where REPOSITORY_PATH would be location where we created Repository, for ex, F: \AppRepository SVN_NAME is the who can access the Repository, for example, SVN_ is the required to access the Repository, for example,
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 details as per the settings you configured in earlier steps. Note : If repository is created at C:\AppPerfect\EnterpriseServer\AppRepository 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
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.
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 ●
●
●
●
●
●
●
Eclipse 2.x, 3.x ❍
Plugin Installation
❍
Integration with Eclipse
NetBeans 4.0, 4.1 and 5.0 ❍
Plugin Installation
❍
Integration with NetBeans
IntelliJ Idea 3.0, 4.x, 5.0 & 5.1 ❍
Plugin Installation
❍
Integration with IntelliJ Idea
JBuilder 9 Personal, JBuilder X Foundation, JBuilder X Enterprise Edition ❍
Plugin Installation
❍
Integration with JBuilder
JDeveloper 10g ❍
Plugin Installation
❍
Integration with JDeveloper
IBM WebSphere Studio 5.1.x ❍
Plugin Installation
❍
Integration with WebSphere
IBM Rational Application Developer 6.0 ❍
Plugin Installation
❍
Integration with WebSphere
Eclipse 2.x, 3.x Plugin Installation When you select the option to integrate AppPerfect with Eclipse the following steps are taken: 1. A link file "com.appperfect.
.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_HOME\ide
\modules folder. 2. The other required jars are placed in the NETBEANS_HOME\ide
\modules\ext folder. 3. The config file "com-appperfect-
.xml" is placed in the NETBEANS_HOME \ide
\config\Modules 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.
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_HOME\plugins. 2. The plugins jar and other required jars are placed in the IDEA_HOME\plugins\appperfect 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_HOME\lib\ext 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 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_HOME\lib\ext 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.
.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.
.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.
UI Reference This chapter gives an overview of the various components in the UI of AppPerfect Web Test. In the AppPerfect Web Test project area there are two panes: the left hand navigational frame and the right hand frame that holds the for the selection made on the navigational frame. The right frame gives the details of the selection on the left frame. For example, consider that the Editor Tab has been selected on the left frame. The right frame will show the General Settings and Attribute Settings for the element selected on the tree. There are two 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 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 various types of node such as URL, sub-URL, event, and element. 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 URLs in the group. When an URL is selected on the test tree, the right frame shows the General Settings and the Parameter Settings for that particular URL. When an event is selected on the test tree, the right frame shows the General Settings and the Attributes Settings for that particular event. When an element that is related to text such as a text area, text set, selected on the test tree, the right frame shows the General Settings, the Attributes Settings, and the Value Settings for that particular element. Results Tab Once a test is complete the reports generated for that test are shown in this 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 ❍
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 In TestManager... : Saves a project in TestManager.
❍
Rename... : Rename currently open project
❍
Result > Open... : Opens a existing result
❍
Result > Open from TestManager... : Opens a result from TestManager
❍
Result > Close : Closes the existing result being viewed
❍
Result > Save : Saves the result of the project in "results" folder
❍
Result > In TestManager... : Saves the result of the project in TestManager
❍
Result > Export Complete Result... : Export complete result to selected format
❍
●
●
❍
Print : Prints the selected result view
❍
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 Web Test
Edit Menu ❍
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 ❍
Run : Starts replaying a recorded test
❍
Run Selected : Starts replaying the selected groups
❍
Stop : Stops replaying the test
❍
Pause : Pauses the test
❍
Auto-update Test : Automatically update the test
❍
Auto-update Selected : Automatically update the selected groups
❍
Record a test... : Starts recording the test
❍
Import Groups Recorded : Import groups recorded from other projects
❍
Script Editor : Open Script Editor
❍
❍ ●
Send Result To... : Makes a zip file of the results of the current project and attaches it to a new email using the default email client
Properties.... : Opens the project properties wizard that allows to set/change the project properties Preferences... : Opens the common Web Test project wizard to set/change properties
Tools Menu ❍
Export Project As Command Line... : Export your Web Test project as Command
●
❍
line script file Export Project As ANT Script... : Export your Web Test project as ANT script
❍
Export view to : Export current view to various formats
❍
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 ❍
Table of Contents : Shows the entire help for the system
❍
Search : Shows the entire help for the system with the search tab selected
❍
Quick Help : Shows context sensitive help
❍
Technical : Takes you to the AppPerfect page on the Internet
❍
Forums : Takes you to the AppPerfect forums on the Internet
❍
About AppPerfect Web Test : Shows the information such as version, copyright related to AppPerfect Web Test
Toolbar Items ●
- 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 Web Test project wizard
●
- Opens the options wizard that is used to set system properties
●
- Shows context sensitive help
Status Bar ● ● ●
●
View - Shows the edition of the AppPerfect Product: Evaluation, Standard or Professional. Status - Shows the status - Recording in Progress, Replaying in Progress or Reports Ready. Time - Shows time elapsed since recording started while recording is in progress. Shows time elapsed since replaying started when replaying is in progress. Date - Shows the current date and time.
AppPerfect Web Test FAQ 1. What are the key features of the AppPerfect Web Test? 2. What kinds of applications can be tested using AppPerfect Web Test? 3. What are the different types of errors that can be detected using AppPerfect Web Test? 4. How are parameters created and handled? 5. What are dynamic parameters? How do they work? 6. My dynamic menus are not being recorded and replayed. What do I do? 7. I want to run multiple iterations of my test, each with a different set of parameter values. How do I do that? 8. I want to check for certain value in one of the elements of the returned page to validate that the request was correctly processed. How do I add such validation? 9. I'm getting an error again and again. I've tried everything, but I'm stuck. What should I do? What are the key features of the AppPerfect Web Test? AppPerfect Web Test records all your actions in the Web browser and replays them at a later point without your intervention. AppPerfect Web Test is used for functional and regression testing on a continuous basis. What kinds of applications can be tested using AppPerfect Web Test? Most application that have a Web/html front end can be tested using AppPerfect Web Test. Commonly tested applications are based on Java/JSP/Servlet, ASP, PHP, AJAX . In addition, applications using Java applets and Macromedia Flash are also ed. What are the different types of errors that can be detected using AppPerfect Web Test? The following types of errors can be detected: 1. Whether the recorded test is replayed successfully. 2. Web Test detects any changes in the page content. (DOM Validation (Entire page validation)/ Element validation/ Text validation) 3. 4. 5. 6.
URL validation URL Parameter validation Event Validation (Whether the recorded events gets replayed or not) Iteration-wise reponse validation (You can use Parametratization to different set of values for each iteration)
How are parameters created and handled?
Most Web applications are dynamic in nature and work interactively with the 's data. data is communicated to the application by means of parameters. Parameters can either by ed via a URL or as part of the Http header of the request. AppPerfect provides extensive for defining and using parameters. Once a test is recorded, AppPerfect stores all parameters into the project as a property/value pair. Click on the "Parameters" node in the Editor to manage parameters. What are dynamic parameters? How do they work? A dynamic parameter is a parameter whose value is not know at test design time. An example of a dynamic parameter is a session ID. A unique session ID is generated once you to your server. AppPerfect s defining such dynamic parameter and tying its value to either a returned value in the http header or in the URL. My dynamic menus are not being recorded and replayed. What do I do? Most dynamic menus are implemented using the "MouseOver" event in JavaScript. By default, this event is NOT recorded. You must manually select recording this event by selecting Tools -> Options -> Web Test -> Auto Detect mouse-over events on elements having mouse-over event handlers. I want to run multiple iterations of my test, each with a different set of parameter values. How do I do that? These are the following ways in which you can access the Parameter Setting Wizard. ●
●
●
Select the URL 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'. You can also parameterize recorded attributes of element. Just select any element/event in the Editor tree and select Attributes tab on right hand side window and parameterize the Attribute using the "Parameterize" button provided. You can also parameterize arguments in event apis. Just select concerned event in the Editor tree and on right hand side Details tab look for Event arguments if any and parameterize the same using the "Parameterize" button provided. Say for example in case you need to run test with differnt input values for set/type events, then you can parameterize the "text" argument in this case.
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. I want to check for certain value in one of the elements of the returned page to validate that the request was correctly processed. How do I add such validation? In the Editor view, click on the desired page. Click on the "Validation" tab. Add validation by
selecting the desired element in DOM tree. I'm getting an error again and again. I've tried everything, but I'm stuck. What should I do? ● ●
●
Close the currently opened project if it is open. Stop and close the application if it is running. Go to Tools ->Options-> Log Settings. Make sure the settings selected for all the products is: Debug (not Fatal). 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 <WebTest_Home>\logs folder. 2. Project file i.e. *.adt file of that project. 3. Build number of the application. (Help->About AppPerfect...)
AppPerfect Scripting AppPerfect Software License Agreement Introduction Creating a Web Project Configuring a Database Configuring Test Parameters Creating Task Groups in Web Project Creating tasks in a Web task group Validating a task response
AppPerfect™ Web Test v 10.5.0 Scripting 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.
Functional Testing an Web Application This tutorial provides a brief introduction to the AppPerfect Web Test product using a set of handson practice exercises. This tutorial assumes you have successfully ed and installed AppPerfect Web Test on your machine with the default options. Apart from this pre-requisite, this tutorial is self contained. This document is divided into following sections 1. Creating Project 2. AppPerfect Web 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:\AppPerfect\WebTest folder and will be referred as WebTest_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 Web Test 1. Click on Start -> Programs ->AppPerfect Web Test x.x.x -> AppPerfect Web Test 2. On launching AppPerfect Web Test a Welcome page will be displayed. Go through the brief description given for product.
Exercise 2: Creating Project 1. Launch the Define New Project dialog 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 button.
Now using this project we will create tests to demonstrate the functionalities of AppPerfect Web Test product.
AppPerfect Web Test NB:Please follow the steps provided in the "Creating Project" section to first create a project, then proceed further.
Exercise 1: Define a Web Test project 1. Once the common project is successfully created another dialog - Define Project Properties dialog - will be displayed. 2. The dialog shows various options which can be configured for the project, leave them default and click on OK button. 3. 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. 4. Click Help -> Table of Contents menu item to see AppPerfect Web Test product documentation 5. Open the Preferences dialog by selecting the menu option Tools -> Options... 6. Review the default settings for Web Test and click the OK button to close the dialog.
Exercise 2: Recording a Test 1. Start tomcat server by selecting Start->Programs->AppPerfect Web 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. 'AppPerfect Recorder' dialog will be displayed. Select the browser with which you need to record from the Browser drop down. Select ActionGroup1 from the Group combo. Provide starting URL as "http://localhost:8392/petstore". In the authentication drop down select "HTML Form based " and provide name: "j2ee" and :"j2ee". Now Click on 'Start recording' button. 4. An instance of selected 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 "AppPerfect Recorder" dialog to stop the recording session. 13. Click on Close button to close the 'AppPerfect Recorder' dialog. 14. In the AppPerfect Web Test window, look at the tree on the left. Each action you performed has been recorded. 15. Click on any of the recorded action on the left. The page associated with that action is displayed along with the actual element highlighted on the right hand side.
Exercise 3: Creating required parameters 1. In the editor tree, select 'Parameters' node. 2. On right hand side, click on 'Add Parameter' button to add a parameter. 3. In the 'Parameter Setting Dialog', enter 'sampleParam' as the parameter name. 4. Select 'Fixed Values' as Data Source. 5. 6. 7. 8. 9. 10. 11. 12. 13. 14. 15. 16.
Choose 'Sequential' as parameter selection. Under Add Value, enter 2 and click on the 'Add' button. Under Add Value, enter 3 and click on the 'Add' button. Click Ok. In the editor tree select the event which states something like (set on WebInputField 27:). In the details tab Click on the "text" argument in the Event Arguments table. Click on the 'parameterize' button. In the parameterization settings dialog, select "text" under the name column in the parameter settings table. 'Constant Value' will be selected with the value 27 in the text box. Select 'Parameterize' and from the combo box, select sampleParam. This will use the values of sampleParam as item quantity on each iteration. Click Ok. Now if the test is replayed for two iterations then each time different value will be picked for Item quantity.
Exercise 4: Adding page validations 1. Select the URL "Items" in the Editor tab. 2. Right click on the DOM Tree on the right and select the option 'Validate HTML source'. 3. This will validate all the elements & content of the web page when the test is replayed and report any validation error if there is any mismatch found in the recorded and replayed web page.
Exercise 5: Executing a test 1. Go to Project -> Properties.... menu to open Web Test project properties dialog. Change the
'No. of iterations' value to 2 and click OK. 2. To start replay of the recorded test, click on Project -> Run from the menu bar. 3. An instance of default browser configured at Tools -> Options -> Browsers is launched and each of the recorded events is replayed. No manual intervention is required during test replay, unless an error is encountered. 4. Note that two different values are picked for Item quantity for each iterations. 5. Stop running tomcat server by selecting Start->Programs->AppPerfect Web Testx.x.x>Documentation and Examples->Examples->Tomcat running Petstore->Stop Server.
Exercise 6: View and analyze results 1. After replay, results are displayed in Results tab. 2. Click on Results tab. Test results details are displayed on the right. Click on individual items in the tree on the left to view details on specific actions. 3. Browse and examine the different views that are displayed on selecting the various nodes in the navigation tree. 4. Select the ActionGroup node. This report gives a summary of the successful, failed, timedout & not played URLs & Events. 5. Select the URL Item and click on the Validation Results tab on the right. Here you will find the details of the successful / failed validations.
Parameterizing A Web Test This tutorial provides a brief introduction to the AppPerfect Web Test product using a set of handson practice exercises. This tutorial assumes you have successfully ed and installed AppPerfect Web Test on your machine with the default options. Apart from this pre-requisite, this tutorial is self contained. This document is divided into following sections 1. Creating Common Project 2. AppPerfect Web 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:\AppPerfect\WebTest folder and will be referred as WebTest_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 Web Test 1. Click on Start -> Programs ->AppPerfect Web Test x.x.x -> AppPerfect Web Test 2. On launching AppPerfect Web Test a Welcome page will be displayed. Go through the brief description given for product. NB: Welcome page is displayed only when Web Test x.x.x is launched and last time no project was opened.
Exercise 2: Creating a Project 1. Launch the Define New Project dialog 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
button. Now using this project we will create tests to demonstrate the functionalities of AppPerfect Web Test product.
AppPerfect Web Test NB:Please follow the steps provided in the "Creating Project" section to first create a project, then proceed further.
Exercise 1: Define a Web Test project 1. Once the project is successfully created another dialog - Define Project Properties dialog will be displayed. 2. The dialog shows various options which can be configured for the project, in "Where N=", specify 3 for three iterations since we shall be demonstrating the test using two parameters each having three parameters values using unique values for each test. Click on OK button. 3. 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. 4. Click Help -> Table of Contents menu item to see AppPerfect Web Test product documentation 5. Open the Preferences dialog by selecting the menu option Tools -> Options... 6. Review the default settings for Web Test and click the OK button to close the dialog.
Exercise 2: Creating required parameters To demonstrate parameterization, we will consider the "" page of Petstore which has a page that takes a name and a . For this we will be defining three different parameters values each for and to be used while replaying the test. 1. Start tomcat server by selecting Start->Programs->AppPerfect WebTest x.x.x>Documentation and Examples->Examples->Tomcat running Petstore->Start Server. 2. Start web browser and enter the URL to load the petstore app. i.e. "http://localhost:8392/ petstore" 3. Click on link "enter the store". 4. Click on link "". 5. Here, Under "No. I would like to sign up for an .", create three s. For this tutorial we'll assume the following three s: ❍ 1: name - john, - smith. ❍ 2: name - sam, - bradley. ❍ 3: name - pet, - store.
We shall be leaving default information for " Information" on submitting the new name and . Sign-out and repeat process to add all the names and s. 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. 'AppPerfect Recorder' dialog will be displayed. Select the browser with which you need to record from the Browser drop down. Select ActionGroup1 from the Group combo. Provide starting URL as "http://localhost:8392/petstore". In the authentication select "HTML Form based " and provide name: "john" and :"smith". Now Click on 'Start recording' button. 3. An instance of selected 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. 5. 6. 7. 8.
In IE click on link "Birds" to see list of products available in "Birds" category. Click on link "Amazon Parrot" to see details of this product. Click on "Add to Cart" to add Amazon Parrot. Check out by clicking on the Check Out link. Here, under "Are You a returning customer - Yes.", enter name as john and as smith. Click Submit. 9. Sign out of PetStore by clicking on Sign-out at top right of screen. 10. Close browser by clicking on File -> Close in the browser window. 11. 12. 13. 14.
Click on the Stop button of "AppPerfect Recorder" dialog to stop the recording session. Click on Close button to close the 'AppPerfect Recorder' dialog. Save project by selecting File->Save menu. In the AppPerfect Web Test window, look at the tree on the left. Each action you performed has been recorded. 15. Click on any of the recorded action on the left. The page associated with that action is displayed along with the actual element highlighted.
Exercise 4: Configuring Parameters in Test 1. In the editor tree, select 'Parameters' node 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 'Param' as the parameter name. 4. Select 'Fixed Values' as Data Source. 5. Choose 'Sequential' as parameter selection. 6. Under Add Value, enter john and click on the 'Add' button.
7. 8. 9. 10. 11. 12. 13. 14. 15. 16. 17. 18. 19. 20. 21. 22. 23. 24. 25.
26. 27. 28. 29. 30. 31.
Under Add Value, enter sam and click on the 'Add' button. Under Add Value, enter pet and click on the 'Add' button. Click Ok. Click on 'Add Parameter' button to add another parameter. In the 'Parameter Setting Dialog', enter 'Param' as the parameter name. Select 'Fixed Values' as Data Source. Choose 'Sequential' as parameter selection. Under Add Value, enter smith and click on the 'Add' button. Under Add Value, enter bradley and click on the 'Add' button. Under Add Value, enter shop(a wrong as per the we created for name pet, the correct was "store") and click on the 'Add' button. Click Ok. In the editor tree select the event which states something like 'set on WebInputElement Name1 : john'. In the details tab Click on the "text" argument in the Event Arguments table. Click on the 'parameterize' button. In the parameterization settings dialog, select "text" under the name column in the parameter settings table. On selection, in the value group, 'Constant' will be selected with the value john in the text box. Select 'Parameterize' and from the combo box, select Param. This will use the values of Param as name on each iteration. Click Ok. In the editor tree select the event which states something like 'set on WebElement : c21pdGg='. Its the second event below the event which states 'set on WebInputElement Name1 :john'. In the details tab Click on the "text" argument in the Event Arguments table. Click on the 'parameterize' button. In the parameterization settings dialog, select text under the name column in the parameter settings table. On selection, in the value group, 'Constant' will be selected with the value smith in the text box. Select 'Parameterize' and from the combo box, select Param. This will use the values of Param as the on each iteration. Click Ok.
Exercise 5: Executing a test - Watching the parameters in action. 1. To execute the test, click on Project -> Run from the menubar. 2. You can see the AppPerfect Web Test iterate through each recorded url/event and for the name and events, the parameter values will be substituted accordingly. 3. After 3 iterations Web Testing will stop and it will switch to Results view. In Result view you can analyze the final result.
4. Stop running tomcat server by selecting Start->Programs->AppPerfect Web Testx.x.x>Documentation and Examples->Examples->Tomcat running Petstore->Stop Server.
Validating A Web Test This tutorial provides a brief introduction to the AppPerfect Web Test product using a set of handson practice exercises. This tutorial assumes you have successfully ed and installed AppPerfect Web Test on your machine with the default options. Apart from this pre-requisite, this tutorial is self contained. This document is divided into following sections 1. Creating Project 2. AppPerfect Web 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:\AppPerfect\WebTest folder and will be referred as WebTest_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 Web Test 1. Click on Start -> Programs ->AppPerfect Web Test x.x.x -> AppPerfect Web Test 2. On launching AppPerfect Web Test a Welcome page will be displayed. Go through the brief description given for product. NB: Welcome page is displayed only when Web Test x.x.x is launched and last time no project was opened.
Exercise 2: Creating a Project 1. Launch the Define new Project dialog 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
button. Now using this project we will create tests to demonstrate the functionalities of AppPerfect Web Test product.
AppPerfect Web Test NB:Please follow the steps provided in the "Creating Project" section to first create a project, then proceed further.
Exercise 1: Define a Web Test project 1. Once the project is successfully created another dialog - Define Project Properties dialog will be displayed. 2. The dialog shows various options which can be configured for the project, in "Where N=", specify 2 for two iterations. Click on OK button. 3. 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. 4. Click Help -> Table of Contents menu item to see AppPerfect Web Test product documentation 5. Open the Preferences dialog by selecting the menu option Tools -> Options... 6. Review the default settings for Web Test and click the OK button to close the dialog.
Exercise 2: Recording a Test 1. Start tomcat server by selecting Start->Programs->AppPerfect WebTest 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. 'AppPerfect Recorder' dialog will be displayed. Select the browser with which you need to record from the Browser drop down. Select ActionGroup1 from the Group combo. Provide starting URL as "http://localhost:8392/petstore". In the authentication drop down select "HTML Form based " and provide name: "j2ee" and :"j2ee". Now Click on 'Start recording' button. 4. An instance of selected 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. 6. 7. 8. 9.
Click on link "Birds" to see list of products available in "Birds" category. Click on link "Amazon Parrot" to see details of this product. Click on "Add to Cart" to add Amazon Parrot. Check out by clicking on the Check Out link. Here, under "Are You a returning customer - Yes.", enter name as j2ee and as j2ee. Click 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. 13. 14. 15.
Click on the Stop button of "AppPerfect Recorder" dialog to stop the recording session. Click on Close button to close the 'AppPerfect Recorder' dialog. Save project by selecting File->Save menu. In the AppPerfect Web Test window, look at the tree on the left. Each action you performed has been recorded. 16. Click on any of the recorded action on the left. The page associated with that action is displayed along with the actual element highlighted.
Exercise 3: Configuring Parameters in Test 1. In the editor tree, select 'Parameters' node 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 'Param' as the parameter name. 4. Select 'Fixed Values' 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 event which states something like 'set on WebInputElement Name1 : j2ee'.. 10. In the details tab click on the "text" argument in the Event Arguments table. 11. Click on the 'parameterize' button. 12. In the parameterization settings dialog, select "text" under the name column in the parameter settings table. 13. On selection, in the value group, 'Constant' will be selected with the value j2ee in the text box. 14. Select 'Parameterize' and from the combo box, select Param. This will use the values of Param as name on each iteration. 15. Click Ok.
Exercise 4: Configuring Text Validation 1. In the editor tree select the task which states something like 'Welcome to the BluePrints Petstore'. 2. In the DOM tree on the right hand side, right click and select 'Add Text Validation' in the popup menu. 3. This will bring up the 'Text Validation Settings' dialog. 4. Under description enter 'NameText'. 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 name, on the 2nd iteration, the name ed will be john which does not exist. As a result of which, this page will not replayed as expected and the validation will fail.
Exercise 5: Configuring Element Attribute Validation 1. In the editor tree select the task which states something like 'Sign-on' 2. Expand the right-hand side tree and select the element 'Name1' which will highlight the 'Name' 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 Vaidation' 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. You can see the AppPerfect Web Test iterate through each recorded url/event and for the name and events, the parameter values will be substituted accordingly. 3. After 2 iterations Web Testing will stop and it will switch to Results view. In Result view you can analyze the final result. 4. Stop running tomcat server by selecting Start->Programs->AppPerfect Web Testx.x.x>Documentation and Examples->Examples->Tomcat running Petstore->Stop Server.
Introduction The Internet has become the de facto standard means by which most people interact with a vast majority of software application. This move away from desktop computing to server-side computing with HTML as the front-end technology has created a whole new class of applications to be built and delivered to customers. However, it has also created a new set of challenges in of developing and testing these applications. It is now assumed your customer may be sitting thousands of miles away and working in a language you are not familiar with. A second aspect of modern software development methodology is to start testing the software early and often. Most software developers do not follow the cascading model of development whereby testing only starts after development ends. Further, developers are being increasingly encouraged to create vast arrays of unit tests to ensure quality.
Need for Web Test All software is designed and developed to meet and satisfy certain "functional" needs. A functional need may be technical, business, or process. A key component of testing a software is to ensure that it functionally does what it is supposed to do. Functional Testing is the process by which expected behavior of an application is tested. Most software undergo changes over a period of time. These changes may occur during initial development of the software, or after the release of the software. Any change to the software carries a potential of errors or bugs being introduced. Regression Testing is the process of frequently retesting a software to ensure known existing behavior or functionality is not impacted. By impacted, we mean either modified or broken. If behavior is modified, the developer or tester must ensure that it is expected. Otherwise, it is called a "Regression". As the size and complexity of applications have grown over the years, it has become increasingly difficult to ensure functional compliance and to ensure no regressions over time. Even a small size project can generate excessive permutations and combinations of test cases that are too great for a human to test consistently and continually. Hence, it is critical to find a testing system which can be automated. The AppPerfect Web Test was created to assist s with such challenges. Since the mechanics of Functional Testing and Regression Testing are similar, they can be addressed with a single testing tool. AppPerfect Web Test provides for "recording" a test once and then "replaying" it when desired without additional manual intervention in an automated manner.
AppPerfect Web Test Key Features
AppPerfect Web Test is a comprehensive Web application testing solution that provides all the features you need, to ensure the reliability of your business-critical applications. ●
●
●
●
●
●
●
●
●
●
●
Technologies : AppPerfect Web Test s testing applications based on .NET, ASP, Servlets/JSP, CGI, SSL and most other server-side Web technologies. It also s advanced Web technologies such as AJAX, Flash and Java Applets. 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. Recording s JavaScript dialogs, File Chooser dialogs, Menus, toolbar etc apart from normal HTML elements. Recording is Component-based and not co-ordinate based allowing to replay test even when browser is moved or element position changes. Web Test s recording from multiple instances of browser simultaneously. Multiple Browsers ed: Recording/Replaying is ed on most commonly used browsers like Internet Explorer, Mozilla Firefox and Safari. 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 Reduced testing time: As the tests for AppPerfect Web Test are fully automated, you can save a substantial amount of time and resources that would be spent on trying to test the system manually. Also errors that might be overlooked during manual testing are caught by the AppPerfect Web Test and there is no bias in the reporting of errors. AppPerfect Web Test helps you improve the quality of your Web Applications and drastically reduces the time it would take to get your product out into the market. Scripting : For advanced AppPerfect Web Test provides scripting language . The scripting language used is simple java script, s can view/edit the test using script editor provided. s can customize a test as much as they want using java script. Parameterize 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. Parameterize tests feed these parameters automatically to the request and thus help simulate a more realistic usage environment. AppPerfect can read values from text files, databases etc. Response Validation: You can validate the responses received for a URL request with AppPerfect Web Test. You can customize what constitutes a valid or invalid response for an URL request. for basic authentication, cookies, SSL: With the AppPerfect Web 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 s URL rewriting if your application uses it. Two way SSL authentication is also ed. Execution without launching browser: AppPerfect Web Test provides for running tests without launching browser. Events on all HTML elements is ed in this mode. Limitation of this mode is that it cannot run window events like events on Applets, Flash, javascript dialogs, Toolbar buttons, Menu bar etc. Remote Execution of tests with Central Controller: AppPerfect Web Test provides for creation of test on one machine and execution of same remotely on multiple
●
●
●
●
●
●
●
●
machines simultaneously. This way you can run functional test from multiple machines and can control the functional test from one central machine. At the end of execution application will present the functional testing result of entire functional test as well as individual machines. This requires AppPerfect Web Test to be installed on remote machines. Object Spy: AppPerfect Web Test provides functionality to Spy on any HTML element in the page and fetch its properties. This makes it easier to add any new HTML element to your existing functional test and build on the Test Cases as and when additional functionality is added to your product Importing of tests / groups: AppPerfect Web Test can import a test that has been created using the AppPerfect Load Test. This makes it easy for a to create a test instead of replicating the effort of creating a test. One can also import already recorded groups from one test to another. Informative reports: 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 different formats: HTML, PDF, CSV, XLS and XML. Trend Analysis: AppPerfect Test Manager provides lot of trend reports for trend analysis of your application. This utility takes multiple result files and generates trend charts and reports based on the data found. You need AppPerfect Test Manager for trend analysis Scheduling of tests: You can schedule your tests with AppPerfect Test Manager. 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. You need AppPerfect Test Manager for scheduling tests. 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 attachment and AppPerfect will export the results as HTML file and send the same as attachment with the mail. IDE Integration: AppPerfect Web Test s IDE integration with most commonly used IDEs. This enhances ease-of-use and productivity. Currently ed IDEs are Eclipse, NetBeans, IntelliJ, JBuilder, JDeveloper, BEA Workshop, IBM RAD, IBM Websphere Studio etc,. ANT Integration and Command line execution: AppPerfect Web Test s ANT Integration and command line execution so you can functional test your web 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: 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 s from a single machine. Features ed include site recording, dynamic variable substitution, cookies , session tracking, SSL 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. 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 lightweight 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 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 ed: ● ● ● ●
Java/J2EE App Servers (Tomcat, WebLogic, WebSphere, etc.) Operating Systems Resources (Windows, Linux, Mac OS X) Databases (Oracle, MySQL, MS SQL, DB2, Sybase) Web Servers (Apache HTTP Server, MS IIS)
● ● ●
SNMP Monitors (v1 and v2) Ping Monitor (Device heartbeat monitor) 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.
Building a Web Project The steps to create a Web project are as under: ●
Project
●
Project Function
Project If you are creating a Web Test project from scratch without visiting Web Test perspective for a project then you need to do the following: 1. an entry for Web Test 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
above the
tag if such an entry is absent. 2. Creating a new script file with the name same as project and appending "_ft.js" to it. for e.g. NewProject_ft.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.functionaltester.script); var engine; //Variable to store instance of ScriptEngine Instance function project_function() // script function for Web Test project NewProject { var webtest = engine.createWebTest(); } This will create a default Web Test project. We will learn more about project_function in the next section.
function project_function( ) This function configures the Functional Test as a whole. It configures the run settings, no of group along with group settings. It also defines test parameters. First task is to create the project using following statement: var webtest = engine.createWebTest(); There is a restriction that the name of the project variable should be webtest. The script file is parsed to keep script & UI in synchronization. Once the Functional test is created we will configure it by calling various APIs on it. ●
Think time is a duration in seconds which denotes the amount of wait time between each
●
●
task while replaying. Depending upon processing of the request at the server end it can be a significant value which if ignored may result in task timed out during replaying. AppPerfect Web Test 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. ❍ void setDefaultThinkTime(int seconds); ❍ void setRecordThinkTime(boolean record); ❍ void setIgnoreThinkTimeWhileReplaying(boolean ignore); Time Out : To mark a task as timed out if it was unable to fetch a response or was unable to find the desired element after specified duration we need to set time out duration. This can be done by using void setTimeOut(int seconds); API. Cache settings : 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. The cache can be cleared before each iteration or before start of replaying by calling following APIs. void clearBrowserPrivateData(int when); where 'when' should be one of the following values: ■ IWebTest.CLEAR_AT_START_OF_TEST for clearing at start of replaying ■ IWebTest.CLEAR_AT_START_OF_EVERY_ITERATION for clearing at start of each iteration ❍ void clearBrowserCache(boolean clear); ❍ void clearBrowserHistory(boolean clear); ❍ void clearCookies(boolean clear); Save Successful responses : By default only failed task responses and images are saved, In case you need to also save successful responses use void setSaveSuccessfulResponseDetails(boolean save); API. ❍
●
●
●
Iteration settings : By default test replays for single iteration. To set number of iterations for test use void setNoOfIterations(int iterations); API. In case you need to run test for all the possible paramter combination then use void setIterateTestForAllParameterCombinations (boolean all); API. Replaying in Non-UI mode : To replay test without launching browser, use void setReplayTestInNonUIMode(boolean replayInNonUI); API.
Configuring Database The steps to configure and a Database Connection with Web Test are as under: ●
Defining database ID
●
Other database operations
Defining database ID For any interaction with a database of your interest it is very necessary to the database along with its properties with AppPerfect Web Test. While ing the database, a unique database Id needs to be ed as first parameter and any further database interaction through Web Test should be performed by ing this unique database id. Database can be ed by calling String setDatabaseConnection( String uniqueDatabaseId, String connectionURL, String Name, String , String driverClass, String classPath); API. For e.g. var database = engine.setDatabaseConnection('Northwind', 'jdbc:oracle:thin:@localhost:1543: Northwind', 'scott','tiger', 'oracle.jdbc.driver.OracleDriver', 'C:\DatabaseDrivers\ojdbc14.jar'); This will 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"
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 s table contains an entry of a after a task of adding was performed. AppPerfect Web Test 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); to fetch a value present at row,column after executing a select query. for e.g. var value = engine.getValeuFromDatabase('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 result set after executing the specified query 4. int getNumberOfDatabaseColumns(String uniqueDatabaseId, String query); returns the no of columns present in the result set 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
Test Parameters Project Parameter are used in most modern applications to communicate data between the and the application. AppPerfect offers extensive parameter-management. Parameter selection and hence testing with various parameter values is completely automated. Parameter values are ed 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. ●
Adding test parameter
●
Setting values of a parameter
●
Fetching values from SQL database
●
Fetching values from CSV file
●
Fetching values by performing mathematical operations
●
through 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. For e.g. webtest.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. For e.g. var values = ['Parrot', 'Crow', 'Piegon', 'Finch']; webtest.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 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 ing appropriate constant as the 3rd parameter. Possible values are: ● ●
●
●
●
IScriptTest.FETCH_VALUES_NOW to fetch values now IScriptTest.FETCH_VALUES_RUNTIME_BEFORE_TEST_EXECUTION to fetch values before the execution begins 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 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 IScriptTest.FETCH_VALUES_EVERYTIME to fetch values everytime this test parameter is used
For e.g. webtest.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 ing appropriate constant as the 4th parameter. Possible values are: ● ●
●
●
●
IScriptTest.FETCH_VALUES_NOW to fetch values now IScriptTest.FETCH_VALUES_RUNTIME_BEFORE_TEST_EXECUTION to fetch values before the execution begins 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 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 IScriptTest.FETCH_VALUES_EVERYTIME to fetch values everytime this test parameter is used
For e.g. webtest.setCSVDatasource('bird_name', 'C:\birds.csv', 1, IScriptTest.
FETCH_VALUES_RUNTIME_BEFORE_TEST_EXECUTION, true, 10, ',', '"');
Fetching values by performing mathematical operations AppPerfect Web Test 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. For e.g. webtest.setNumberCalculationDatasource('bird_name', 'Parrot', '', false, 1, 10, true, 1, 1, 1); webtest.setDateCalculationDatasource('bird_purchase_date', 'MM-dd-yyyy', '01-01-2000', '12-312004');
through test parameters Another category of parameters ed by AppPerfect Web Test is that of "through". 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 Web Test will search in the previous response value of the parameter and use it for subsequent requests. This can be achieved by calling void setthroughDatasource(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. For e.g. webtest.setthroughDatasource('bird_type', false, true);
Task groups in Web Project A task group is a collection of task in a project. A task group can either contain browser element, url (HTTP/HTTPS) tasks, web HTML elements or window elements. ●
Adding task group
●
Setting group properties
Adding task group An Action group can be added to the test using IWebGroup addActionGroup(String groupName, String startingURL, int repeatCount, boolean ignore); API. It returns a web group. Ignore paramter should be set to true if you want to ignore the group during execution. Multiple action groups can be added to test by calling the same API again with different parameters. For e.g. var group = webtest.addActionGroup('ActionGroup1', 'http://localhost:8081/petstore', 1, false); adds a web group with name ActionGroup1 and starting URL http://localhost:8081/petstore. In order to keep the changes in UI and script in sync with each other, the name of the variable has to be 'group'.
Setting group properties Once a group is created you need to set various properties of the group in order to execute tasks in this group. Quite often the web applications being tested are not simple applications and require different types of authentications during the execution of the test. AppPerfect Web Test provides various APIs to set authentication credentials. By default a group doesn't require any authentication credentials. AppPerfect Web Test Form, Basic, Digest, NTLM types of authentication. To set the type of authentication use void setAuthenticationMechanism(int mechanism); API. Possible values for mechanism are: ● ● ● ● ●
IWebGroup.NO_AUTHENTICATION IWebGroup.FORM_AUTHENTICATION IWebGroup.BASIC_AUTHENTICATION IWebGroup.DIGEST_AUTHENTICATION IWebGroup.NTLM_AUTHENTICATION
name for any type of authentication should be set by calling void setAuthenticationName (String name, boolean parameterised); API. If name is parameterised then the second value to be ed in true and the first parameter is the name of the test parameter. If the name is not parameterised then actual name is ed as the first parameter.
for any type of authentication should be set by calling void setAuthentication (String , boolean parameterised); API. If is parameterised then the second value to be ed in true and the first parameter is the name of the test parameter. If the is not parameterised then actual is ed as the first parameter. void setAuthenticationDomainName(String domain); API is called to set the Domain name if the authentication is of type IWebGroup.DIGEST_AUTHENTICATION. Finally if the web or application server is configured for authenticating the client based on client certificates, you need to client certificates witht eh group by calling following APIs: ●
●
void setUseClientSSLAuthentication(boolean flag); to set that group should use client SSL authentication void addClientCertificate(String , String certFilePath); to a client certificate for a group
Configuring tasks in a Web task group A task group is a collection of tasks. A task group can either contain browser task, url task, web/ HTML element or Window element task. 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 in Web Project chapter for further details on task groups. This chapter will cover all the tasks ed in Web Test: ●
Browser task
●
URL task
●
Web/HTML element task
●
Window element task
Browser task A browser task is equivalent to a web browser session. Following operations are possible for a Browser instance. ●
Creation of a Browser task
●
Configuring properties for a Browser task
●
Execution of a Browser task
●
Release of a Browser task
Creation of a Browser task Browser task can be created using createBrowser API of IScriptEngine interface. The return value is an instance of IBrowser interface. ●
IBrowser createBrowser(int id, String sTitle, String sURL); where, 'id' is the Task Id. It should be unique across the test. ❍ 'sTitle' is the unique title of the browser which is used to identify browser. ❍ 'sURL' is url with which the Browser should be opened ex. http://localhost:8080/ petstore For ex. var browser = engine.createBrowser(1, 'Browser_1', 'http://localhost:8080/petstore'); will create a browser instance with task id 1, title Browser_1 and starting URL http:// localhost:8080/petstore ❍
In order to keep the changes in UI and script in sync with each other, the name of the variable has to be 'browser'
Configuring properties for a Browser task Once a task is created, all its properties like think time, title, timeout period etc. can be initialised to proper values using appropriate apis exposed by individual tasks. Following APIs are ed by IBrowser interface for configuring properties of a Browser task. ●
void setThinkTime(int iThinkTime); where, 'iThinkTime' is wait time in no. of seconds for which the engine should wait before the task is actually executed. For ex. browser.setThinkTime(10); will set think time to 10 seconds. ❍
Execution of a Browser task Once a task is initialised it should be executed to fetch and process the results. Script engine takes the responsibility to execute a Browser task. It can be done using following API of IScriptEngine interface. ●
boolean executeBrowser(IBrowser browser); where, ❍
'browser' is IBrowser task instance, which we got from Creation of a Browser task
returns true if task was executed successfully, returns false if there is any failure during execution For ex. var successful = engine.executeBrowser(browser); will execute a Browser task. ❍
Release of a Browser task Once a task is executed it is must to call release method to release all the opened resources. It takes care to release all the internal objects like ResultSet, Connection etc. if any. Also this method takes care of saving the response/images if any to disk. This method should be always called in the end after the execution of each task. It can be done using following API of IScriptEngine interface ●
void release(); For ex. engine.release(); will release a Browser task.
URL task A URL task represents reponse for any HTTP/HTTPS request. It basically represents the response page shown in the web browser as a result of firing any request. Following operations are possible for a URL instance. ●
Creation of a URL task
●
Configuring properties for a URL task
●
Execution of a URL task
●
Release of a URL task
Creation of a URL task URL task can be created using createURL API of IScriptEngine interface. The return value is an instance of IUrl interface. ●
IUrl createURL(int id, String sURL, boolean bSubFrame); where, 'id' is the Task Id. It should be unique across the test. ❍ 'sURL' is url of the task ex. http://localhost:8080/petstore. ❍ 'bSubFrame' whether its a sub frame or top level page. Possible values are true for subframe and false for top level page For ex. var url = engine.createURL(2, 'http://localhost:8080/petstore', false); will create a top level url instance with task id 2, and URL http://localhost:8080/petstore ❍
In order to keep the changes in UI and script in sync with each other, the name of the variable has to be 'url'
Configuring properties for a URL task Once a task is created, all its properties like think time, title, timeout period etc. can be initialised to proper values using appropriate apis exposed by individual tasks. Following APIs are ed by IUrl interface for configuring properties of a URL task. ●
void setTimeOut(int iTimeOut); where,
●
'iTimeOut' in no of seconds for the task to complete its execution. Few urls may take long time to respond, sometimes forever, due to various reason like server is not responding, network failure etc. This could affect the test execution which will never complete. One can come out of this situation by specifying the no of seconds after which the task execution will be aborted and its status will be marked as timed out. For ex. url.setTimeOut(20); will set time out period to 20 seconds. void setIgnored(boolean bIgnore); where, ❍
'bIgnore' whether task should be ignored during execution. Possible values are true if task should be ignored, false otherwise. For ex. url.setIgnored(false); will ignore execution of task. ❍
●
void setBenchmarkFile(String sFileName); This is helpful for validation purpose to match the replayed response with the recorded one. where, 'sFileName' is relative file path of the response when this task was recorded. Path is relative to the project location. For ex. url.setBenchmarkFile('recorded/2006_12_1_13_39_1_50/ActionGroup1/URL_2. html'); void setTitle(String sTitle); where, ❍
●
❍
'sTitle' title of the page
●
For ex. url.setTitle('AppPerfect'); void setIgnoreParam(boolean bIgnore); This API is used to decide if URL parameters comparision should be ignored during execution. where, 'bIgnore' is true if the parameters comparision should be ignored; false otherwise For ex. url.setIgnoreParam(true); will ignore URL parameters comparision during execution. ❍
●
void setBreakPoint(boolean bBreakPoint); In case breakpoint is set, test will wait for 's interruption before moving forward. where, ❍
●
'bBreakPoint' is true if breakpoint should be set; false otherwise.
For ex. url.setBreakPoint(false); will clear breakpoint. void setFireURL(boolean bFireURL); This method should be called in case url is to be fired explicitly. where, 'bFireURL' is true if url should be fired explicitly; false otherwise. For ex. url.setFireURL(false); will not fire url explicitly. void addParameter(String name, String value); A URL can have many request parameters. Each GET parameter needs to be added using this method. A parameter added using this method is appended to the URL when the URL is fired explicitly. where, ❍
●
'name' is name of the request parameter ❍ 'value' is value of the request parameter For ex. url.addParameter('name', 'AppPerfect'); ❍
If parameter is parameterised then the value for same should be fetched using following API of IScriptEngine ●
String getParameterValue(String name, String value, String parameterName, boolean beforeExecution); where, ❍ ❍ ❍ ❍
'name' is name of the parameter 'value' is recorded value of the parameter 'parameterName' is name of the test parameter 'bBeforeExecution' to indicate whether the test parameter should be populated before the execution of the task
returns resultant value of parameterisation For ex. var arg0 = engine.getParameterValue('name', 'AppPerfect', 'testparam1', true); ❍
Execution of a URL task Once a task is initialised it should be executed to fetch and process the results. Script engine takes the responsibility to execute a URL task. It can be done using following API of IScriptEngine interface. ●
boolean executeURL(IUrl url); where, ❍
'url' is IUrl task instance, which we got from Creation of a URL task
❍
returns true if task was executed successfully, returns false if there is any failure
during execution For ex. var successful = engine.executeURL(url); will execute a URL task.
Release of a URL task Once a task is executed it is must to call release method to release all the opened resources. It takes care to release all the internal objects like ResultSet, Connection etc. if any. Also this method takes care of saving the response/images if any to disk. This method should be always called in the end after the execution of each task. It can be done using following API of IScriptEngine interface ●
void release(); For ex. engine.release(); will release URL task.
Web/HTML element task A Web/HTML element represents any HTML element in the DOM. For furthur details on ed elements and APIs go though the points mentioned below : ●
Types of Web Element
●
Configuring properties for a Web element Task
●
Execution of a Web element task
●
Release of a Web element task
Types of Web Element Following types of web elements are ed in Web Test. Out of them, WebObject is generic element and can be used to represent any element not in the list. Please go through following elements for futhur details related to creation of each type of element and events ed on them. ●
WebObject
●
WebArea
●
WebButton
●
WebCheckBox
●
WebComboBox
●
WebDivElement
●
WebEdit
●
WebFile
●
WebHiddenField
●
WebImage
●
WebInputElement
●
WebInputButton
●
WebInputImage
●
WebLink
●
WebList
●
WebListItem
●
WebField
●
WebRadioButton
●
WebResetButton
●
WebSpan
●
WebSubmitButton
●
WebTable
●
WebTextArea
●
WebTextField
●
WebBrowserElement
In order to keep the changes in UI and script in sync with each other, the name of the variable has to be 'element'
WebObject A WebObject represents a generic HTML element. Apart from Configuring properties for a Web element Task, Execution of a Web element task and Release of a Web element task, following operations/events are ed for a WebObject : ●
Creation of a WebObject
●
ed events for a WebObject
Creation of a WebObject WebObject element can be created using createWebObject API of IScriptEngine interface. The return value is an instance of WebObject interface. ●
WebObject createWebObject(int id, String sElementTag, int iElementType); where, ❍ ❍ ❍
'id' is the Task Id. It should be unique across the test. 'sElementTag' is the HTML tag name used to identify element. 'iElementType' possible values, 2 if element is on top level page, 3 if element is present on subframe.
For ex. var element = engine.createWebObject(1, 'a', 2); will create a WebObject element on Top level page with task id 1 and html tag 'a' In order to keep the changes in UI and script in sync with each other, the name of the variable has to be 'element'
ed events for a WebObject Once WebObject is created, you can play any one of the following event on it : ●
boolean click(); To replay a mouse click on element ❍
●
returns true if event was executed successfully, returns false if there is any failure during execution
For ex. element.click(); will replay click event on element. boolean rightClick(); To replay a mouse right click on element returns true if event was executed successfully, returns false if there is any failure during execution For ex. element.rightClick(); will replay right click event on element. ❍
●
boolean dblClick(); To replay a mouse double click on element ❍
●
returns true if event was executed successfully, returns false if there is any failure during execution
For ex. element.dblClick(); will replay double click event on element. boolean mouseMove(); To move mouse cursor over element returns true if event was executed successfully, returns false if there is any failure during execution For ex. element.mouseMove(); will move mouse cursor on element. boolean wait(String propertyName, String propertyValue, long timeout); Will make replayer wait till specified property recieves specified value or till the specified time out period, whatever happens earlier, where ❍
●
'propertyName' name of the element's attribute for which the value should be fetched. ❍ 'propertyValue' value of the attribute against which the comparision should be done. ❍ 'timeout' in no. of seconds, time period for which the replayer should wait to get the expected value ❍ returns true if event was executed successfully, returns false if there is any failure during execution For ex. element.wait('innerText', 'AppPerfect', 30); will make replayer to wait till innertext for this element is not equal to 'AppPerfect', maximum waiting time will be 30 seconds. If attribute does not receive the expected value in this time period then event will be marked as timed out. ❍
WebArea
A WebArea represents HTML element with tag 'area'. Apart from Configuring properties for a Web element Task, Execution of a Web element task and Release of a Web element task, following operations/events are ed for a WebArea : ●
Creation of a WebArea
●
ed events for a WebArea
Creation of a WebArea WebArea element can be created using createWebArea API of IScriptEngine interface. The return value is an instance of WebArea interface. ●
WebArea createWebArea(int id, int iElementType); where, ❍
'id' is the Task Id. It should be unique across the test.
'iElementType' possible values, 2 if element is on top level page, 3 if element is present on subframe. For ex. var element = engine.createWebArea(1, 2); will create a WebArea element on Top level page with task id 1 and html tag 'area' ❍
In order to keep the changes in UI and script in sync with each other, the name of the variable has to be 'element'
ed events for a WebArea Once WebArea is created, you can play events on it. WebArea s exactly same events as WebObject. Please refer to ed events for a WebObject for more details.
WebButton A WebButton represents HTML element with tag 'button'. Apart from Configuring properties for a Web element Task, Execution of a Web element task and Release of a Web element task, following operations/events are ed for a WebButton : ●
Creation of a WebButton
●
ed events for a WebButton
Creation of a WebButton WebButton element can be created using createWebButton API of IScriptEngine interface. The return value is an instance of WebButton interface. ●
WebButton createWebButton(int id, int iElementType); where,
'id' is the Task Id. It should be unique across the test. ❍ 'iElementType' possible values, 2 if element is on top level page, 3 if element is present on subframe. For ex. var element = engine.createWebButton(1, 2); will create a WebButton element on Top level page with task id 1 and html tag 'button' ❍
In order to keep the changes in UI and script in sync with each other, the name of the variable has to be 'element'
ed events for a WebButton Once WebButton is created, you can play events on it. WebButton s exactly same events as WebObject. Please refer to ed events for a WebObject for more details.
WebCheckBox A WebCheckBox represents HTML element with tag 'input' and type='checkbox'. Apart from Configuring properties for a Web element Task, Execution of a Web element task and Release of a Web element task, following operations/events are ed for a WebCheckBox : ●
Creation of a WebCheckBox
●
ed events for a WebCheckBox
Creation of a WebCheckBox WebCheckBox element can be created using createWebCheckBox API of IScriptEngine interface. The return value is an instance of WebCheckBox interface. ●
WebCheckBox createWebCheckBox(int id, int iElementType); where, 'id' is the Task Id. It should be unique across the test. ❍ 'iElementType' possible values, 2 if element is on top level page, 3 if element is present on subframe. For ex. var element = engine.createWebCheckBox(1, 2); will create a WebCheckBox element on Top level page with task id 1 and html tag 'input' ❍
In order to keep the changes in UI and script in sync with each other, the name of the variable has to be 'element'
ed events for a WebCheckBox Once WebCheckBox is created, you can play events on it. Apart from ed events for a WebObject, WebCheckBox also s following events:
●
boolean check(); To select the checkbox
●
returns true if event was executed successfully, returns false if there is any failure during execution For ex. element.check(); will select the check box. boolean unCheck(); To deselect a check box ❍
returns true if event was executed successfully, returns false if there is any failure during execution For ex. element.unCheck(); will deselect the checkbox. ❍
WebComboBox A WebComboBox represents HTML element with tag 'select'. Apart from Configuring properties for a Web element Task, Execution of a Web element task and Release of a Web element task, following operations/events are ed for a WebComboBox : ●
Creation of a WebComboBox
●
ed events for a WebComboBox
Creation of a WebComboBox WebComboBox element can be created using createWebComboBox API of IScriptEngine interface. The return value is an instance of WebComboBox interface. ●
WebComboBox createWebComboBox(int id, int iElementType); where, 'id' is the Task Id. It should be unique across the test. ❍ 'iElementType' possible values, 2 if element is on top level page, 3 if element is present on subframe. For ex. var element = engine.createWebComboBox(1, 2); will create a WebComboBox element on Top level page with task id 1 and html tag 'select' ❍
In order to keep the changes in UI and script in sync with each other, the name of the variable has to be 'element'
ed events for a WebComboBox Once WebComboBox is created, you can play events on it. Apart from ed events for a WebObject, WebComboBox also s following events: ●
String[] getItems(); To get all the items in the Combo box returns array of items For ex. element.getItems(); will return all the items in combo box. ❍
●
String getItem(int index); To get item at specified index, where ❍ ❍
'index' is the position of item in combo, starts at 0. returns item at index
●
For ex. element.getItem(1); will return the second element in the combo. int getItemsCount(); To get the item count in the Combo box
●
returns count of items in combo For ex. element.getItemsCount(); will return count of items in combo box. String[] getSelectedItems(); To get selected items in the Combo box
●
returns array of selected items in combo For ex. element.getSelectedItems(); will return all the selected items in combo box. boolean select(int index); To select item at specified index, where
❍
❍
❍ ❍
●
'index' is the position of item in combo, starts at 0. returns true if event was executed successfully, returns false if there is any failure during execution
For ex. element.select(1); will select the second element in the combo. boolean selectItem(String item); To select specified item in combo, where 'item' is the text representing the item to be selected. ❍ returns true if event was executed successfully, returns false if there is any failure during execution For ex. element.selectItem('AppPerfect'); will select 'AppPerfect' item in the combo. ❍
WebDivElement A WebDivElement represents HTML element with tag 'div'. Apart from Configuring properties for a Web element Task, Execution of a Web element task and Release of a Web element task, following operations/events are ed for a WebDivElement : ●
Creation of a WebDivElement
●
ed events for a WebDivElement
Creation of a WebDivElement WebDivElement element can be created using createWebDivElement API of IScriptEngine interface. The return value is an instance of WebDivElement interface. ●
WebDivElement createWebDivElement(int id, int iElementType); where, ❍
'id' is the Task Id. It should be unique across the test.
'iElementType' possible values, 2 if element is on top level page, 3 if element is present on subframe. For ex. var element = engine.createWebDivElement(1, 2); will create a WebDivElement element on Top level page with task id 1 and html tag 'div' ❍
In order to keep the changes in UI and script in sync with each other, the name of the variable has to be 'element'
ed events for a WebDivElement Once WebDivElement is created, you can play events on it. WebDivElement s exactly same events as WebObject. Please refer to ed events for a WebObject for more details.
WebEdit A WebEdit represents HTML element with tag 'input' and type='text'. Apart from Configuring properties for a Web element Task, Execution of a Web element task and Release of a Web element task, following operations/events are ed for a WebEdit : ●
Creation of a WebEdit
●
ed events for a WebEdit
Creation of a WebEdit WebEdit element can be created using createWebEdit API of IScriptEngine interface. The return value is an instance of WebEdit interface. ●
WebEdit createWebEdit(int id, int iElementType); where, 'id' is the Task Id. It should be unique across the test. ❍ 'iElementType' possible values, 2 if element is on top level page, 3 if element is present on subframe. For ex. var element = engine.createWebEdit(1, 2); will create a WebEdit element on Top level page with task id 1 and html tag 'input' ❍
In order to keep the changes in UI and script in sync with each other, the name of the variable has to be 'element'
ed events for a WebEdit Once WebEdit is created, you can play events on it. Apart from ed events for a WebObject, WebEdit also s following events: ●
boolean set(String text); To set the specified text in the input text box, where ❍ ❍
'text' is the text to set in the edit box returns true if event was executed successfully, returns false if there is any failure during execution
●
For ex. element.set('AppPerfect'); will set 'AppPerfect' as text in the edit box. boolean submit(); To submit the form ❍
returns true if event was executed successfully, returns false if there is any failure during execution
For ex. element.submit(); will submit the form.
WebFile A WebFile represents HTML element with tag 'input' and type='file'. Apart from Configuring properties for a Web element Task, Execution of a Web element task and Release of a Web element task, following operations/events are ed for a WebFile : ●
Creation of a WebFile
●
ed events for a WebFile
Creation of a WebFile WebFile element can be created using createWebFile API of IScriptEngine interface. The return value is an instance of WebFile interface. ●
WebFile createWebFile(int id, int iElementType); where, 'id' is the Task Id. It should be unique across the test. ❍ 'iElementType' possible values, 2 if element is on top level page, 3 if element is present on subframe. For ex. var element = engine.createWebFile(1, 2); will create a WebFile element on Top level page with task id 1 and html tag 'input' ❍
In order to keep the changes in UI and script in sync with each other, the name of the variable has to be 'element'
ed events for a WebFile Once WebFile is created, you can play events on it. Apart from ed events for a WebObject, WebFile also s following events: ●
boolean set(String text); To set the specified text as the file path, where
●
'text' is the file path to set ❍ returns true if event was executed successfully, returns false if there is any failure during execution For ex. element.set('C:\\file.txt'); will set 'C:\\file.txt' as file path boolean submit(); To submit the form ❍
❍
returns true if event was executed successfully, returns false if there is any failure
during execution For ex. element.submit(); will submit the form.
WebHiddenField A WebHiddenField represents HTML element with tag 'input' and type='hidden'. Apart from Configuring properties for a Web element Task, Execution of a Web element task and Release of a Web element task, following operations/events are ed for a WebHiddenField : ●
Creation of a WebHiddenField
●
ed events for a WebHiddenField
Creation of a WebHiddenField WebHiddenField element can be created using createWebHiddenField API of IScriptEngine interface. The return value is an instance of WebHiddenField interface. ●
WebHiddenField createWebHiddenField(int id, int iElementType); where, ❍ ❍
'id' is the Task Id. It should be unique across the test. 'iElementType' possible values, 2 if element is on top level page, 3 if element is present on subframe.
For ex. var element = engine.createWebHiddenField(1, 2); will create a WebHiddenField element on Top level page with task id 1 and html tag 'input' In order to keep the changes in UI and script in sync with each other, the name of the variable has to be 'element'
ed events for a WebHiddenField Once WebHiddenField is created, you can play events on it. Apart from ed events for a WebObject, WebHiddenField also s following events: ●
boolean set(String text); To set the specified text in the element, where
●
'text' is the text to set in the element ❍ returns true if event was executed successfully, returns false if there is any failure during execution For ex. element.set('AppPerfect'); will set 'AppPerfect' as text in the element. boolean submit(); To submit the form ❍
returns true if event was executed successfully, returns false if there is any failure during execution For ex. element.submit(); will submit the form. ❍
WebImage A WebImage represents HTML element with tag 'img'. Apart from Configuring properties for a Web element Task, Execution of a Web element task and Release of a Web element task, following operations/events are ed for a WebImage : ●
Creation of a WebImage
●
ed events for a WebImage
Creation of a WebImage WebImage element can be created using createWebImage API of IScriptEngine interface. The return value is an instance of WebImage interface. ●
WebImage createWebImage(int id, int iElementType); where, ❍
'id' is the Task Id. It should be unique across the test.
'iElementType' possible values, 2 if element is on top level page, 3 if element is present on subframe. For ex. var element = engine.createWebImage(1, 2); will create a WebImage element on Top level page with task id 1 and html tag 'img' ❍
In order to keep the changes in UI and script in sync with each other, the name of the variable has to be 'element'
ed events for a WebImage Once WebImage is created, you can play events on it. WebImage s exactly same events as WebObject. Please refer to ed events for a WebObject for more details.
WebInputElement A WebInputElement represents HTML element with tag 'input'. Apart from Configuring properties for a Web element Task, Execution of a Web element task and Release of a Web element task, following operations/events are ed for a WebInputElement : ●
Creation of a WebInputElement
●
ed events for a WebInputElement
Creation of a WebInputElement WebInputElement element can be created using createWebInputElement API of IScriptEngine interface. The return value is an instance of WebInputElement interface.
●
WebInputElement createWebInputElement(int id, int iElementType); where, ❍ ❍
'id' is the Task Id. It should be unique across the test. 'iElementType' possible values, 2 if element is on top level page, 3 if element is present on subframe.
For ex. var element = engine.createWebInputElement(1, 2); will create a WebInputElement element on Top level page with task id 1 and html tag 'input' In order to keep the changes in UI and script in sync with each other, the name of the variable has to be 'element'
ed events for a WebInputElement Once WebInputElement is created, you can play events on it. Apart from ed events for a WebObject, WebInputElement also s following events: ●
boolean set(String text); To set the specified text in the element, where ❍
'text' is the text to set in the element
returns true if event was executed successfully, returns false if there is any failure during execution For ex. element.set('AppPerfect'); will set 'AppPerfect' as text in the element. ❍
●
boolean submit(); To submit the form returns true if event was executed successfully, returns false if there is any failure during execution For ex. element.submit(); will submit the form. ❍
WebInputButton A WebInputButton represents HTML element with tag 'input' and type='button'. Apart from Configuring properties for a Web element Task, Execution of a Web element task and Release of a Web element task, following operations/events are ed for a WebInputButton : ●
Creation of a WebInputButton
●
ed events for a WebInputButton
Creation of a WebInputButton WebInputButton element can be created using createWebInputButton API of IScriptEngine interface. The return value is an instance of WebInputButton interface. ●
WebInputButton createWebInputButton(int id, int iElementType); where, ❍
'id' is the Task Id. It should be unique across the test.
'iElementType' possible values, 2 if element is on top level page, 3 if element is present on subframe. For ex. var element = engine.createWebInputButton(1, 2); will create a WebInputButton element on Top level page with task id 1 and html tag 'input' ❍
In order to keep the changes in UI and script in sync with each other, the name of the variable has to be 'element'
ed events for a WebInputButton Once WebInputButton is created, you can play events on it. WebInputButton s exactly same events as WebObject. Please refer to ed events for a WebObject for more details.
WebInputImage A WebInputImage represents HTML element with tag 'input' and type='image'. Apart from Configuring properties for a Web element Task, Execution of a Web element task and Release of a Web element task, following operations/events are ed for a WebInputImage : ●
Creation of a WebInputImage
●
ed events for a WebInputImage
Creation of a WebInputImage WebInputImage element can be created using createWebInputImage API of IScriptEngine interface. The return value is an instance of WebInputImage interface. ●
WebInputImage createWebInputImage(int id, int iElementType); where, 'id' is the Task Id. It should be unique across the test. ❍ 'iElementType' possible values, 2 if element is on top level page, 3 if element is present on subframe. For ex. var element = engine.createWebInputImage(1, 2); will create a WebInputImage element on Top level page with task id 1 and html tag 'input' ❍
In order to keep the changes in UI and script in sync with each other, the name of the variable has to be 'element'
ed events for a WebInputImage Once WebInputImage is created, you can play events on it. WebInputImage s exactly same events as WebObject. Please refer to ed events for a WebObject for more details.
WebLink A WebLink represents HTML element with tag 'a'. Apart from Configuring properties for a Web element Task, Execution of a Web element task and Release of a Web element task, following operations/events are ed for a WebLink : ●
Creation of a WebLink
●
ed events for a WebLink
Creation of a WebLink WebLink element can be created using createWebLink API of IScriptEngine interface. The return value is an instance of WebLink interface. ●
WebLink createWebLink(int id, int iElementType); where, ❍
'id' is the Task Id. It should be unique across the test.
'iElementType' possible values, 2 if element is on top level page, 3 if element is present on subframe. For ex. var element = engine.createWebLink(1, 2); will create a WebLink element on Top level page with task id 1 and html tag 'a' ❍
In order to keep the changes in UI and script in sync with each other, the name of the variable has to be 'element'
ed events for a WebLink Once WebLink is created, you can play events on it. WebLink s exactly same events as WebObject. Please refer to ed events for a WebObject for more details.
WebList A WebList represents ordered/unordered list HTML element. For ordered list tag is 'ol', while for unordered list tag is 'ul'. Apart from Configuring properties for a Web element Task, Execution of a Web element task and Release of a Web element task, following operations/events are ed for a WebList : ●
Creation of a WebList
●
ed events for a WebList
Creation of a WebList WebList element can be created using createWebList API of IScriptEngine interface. The return
value is an instance of WebList interface. ●
WebList createWebList(int id, int iElementType, boolean bOrdered); where, 'id' is the Task Id. It should be unique across the test. ❍ 'iElementType' possible values, 2 if element is on top level page, 3 if element is present on subframe. ❍ 'bOrdered' is true if its ordered list, false otherwise. For ex. var element = engine.createWebList(1, 2, true); will create a ordered WebList element on Top level page with task id 1 and html tag 'ol' ❍
In order to keep the changes in UI and script in sync with each other, the name of the variable has to be 'element'
ed events for a WebList Once WebList is created, you can play events on it. Apart from ed events for a WebObject, WebList also s following events: ●
String[] getItems(); To get all the items in the WebList ❍
returns array of items in list
●
For ex. element.getItems(); will return all the items in WebList. String getItem(int index); To get item at specified index, where
●
'index' is the position of item in list, starts at 0. ❍ returns item at index For ex. element.getItem(1); will return the second element in the list. int getItemsCount(); To get the item count in the WebList
●
returns count of items in WebList For ex. element.getItemsCount(); will return count of items in WebList. boolean submit(); To submit the form
❍
❍
returns true if event was executed successfully, returns false if there is any failure during execution For ex. element.submit(); will submit the form. ❍
WebListItem A WebListItem represents HTML element with tag 'li'. Apart from Configuring properties for a Web element Task, Execution of a Web element task and Release of a Web element task, following operations/events are ed for a WebListItem : ●
Creation of a WebListItem
●
ed events for a WebListItem
Creation of a WebListItem WebListItem element can be created using createWebListItem API of IScriptEngine interface. The return value is an instance of WebListItem interface. ●
WebListItem createWebListItem(int id, int iElementType); where, ❍
'id' is the Task Id. It should be unique across the test.
'iElementType' possible values, 2 if element is on top level page, 3 if element is present on subframe. For ex. var element = engine.createWebListItem(1, 2); will create a WebListItem element on Top level page with task id 1 and html tag 'li' ❍
In order to keep the changes in UI and script in sync with each other, the name of the variable has to be 'element'
ed events for a WebListItem Once WebListItem is created, you can play events on it. WebListItem s exactly same events as WebObject. Please refer to ed events for a WebObject for more details.
WebField A WebField represents HTML element with tag 'input' and type=''. Apart from Configuring properties for a Web element Task, Execution of a Web element task and Release of a Web element task, following operations/events are ed for a WebField : ●
Creation of a WebField
●
ed events for a WebField
Creation of a WebField WebField element can be created using createWebField API of IScriptEngine interface. The return value is an instance of WebField interface. ●
WebField createWebField(int id, int iElementType); where, 'id' is the Task Id. It should be unique across the test. ❍ 'iElementType' possible values, 2 if element is on top level page, 3 if element is present on subframe. For ex. var element = engine.createWebField(1, 2); will create a WebField element on Top level page with task id 1 and html tag 'input' ❍
In order to keep the changes in UI and script in sync with each other, the name of the variable has
to be 'element'
ed events for a WebField Once WebField is created, you can play events on it. Apart from ed events for a WebObject, WebField also s following events: ●
boolean set(String text); To set the specified in the field, where ❍
'text' is the text to set as in the field
returns true if event was executed successfully, returns false if there is any failure during execution For ex. element.set('AppPerfect'); will set 'AppPerfect' as in the field. ❍
●
boolean submit(); To submit the form ❍
returns true if event was executed successfully, returns false if there is any failure during execution
For ex. element.submit(); will submit the form.
WebRadioButton A WebRadioButton represents HTML element with tag 'input' and type='radio'. Apart from Configuring properties for a Web element Task, Execution of a Web element task and Release of a Web element task, following operations/events are ed for a WebRadioButton : ●
Creation of a WebRadioButton
●
ed events for a WebRadioButton
Creation of a WebRadioButton WebRadioButton element can be created using createWebRadioButton API of IScriptEngine interface. The return value is an instance of WebRadioButton interface. ●
WebRadioButton createWebRadioButton(int id, int iElementType); where, ❍ ❍
'id' is the Task Id. It should be unique across the test. 'iElementType' possible values, 2 if element is on top level page, 3 if element is present on subframe.
For ex. var element = engine.createWebRadioButton(1, 2); will create a WebRadioButton element on Top level page with task id 1 and html tag 'input' In order to keep the changes in UI and script in sync with each other, the name of the variable has to be 'element'
ed events for a WebRadioButton
Once WebRadioButton is created, you can play events on it. Apart from ed events for a WebObject, WebRadioButton also s following events: ●
boolean select(); To select the Radio Button returns true if event was executed successfully, returns false if there is any failure during execution For ex. element.select(); will select the radio button. ❍
WebResetButton A WebResetButton represents HTML element with tag 'input' and type='reset'. Apart from Configuring properties for a Web element Task, Execution of a Web element task and Release of a Web element task, following operations/events are ed for a WebResetButton : ●
Creation of a WebResetButton
●
ed events for a WebResetButton
Creation of a WebResetButton WebResetButton element can be created using createWebResetButton API of IScriptEngine interface. The return value is an instance of WebResetButton interface. ●
WebResetButton createWebResetButton(int id, int iElementType); where, 'id' is the Task Id. It should be unique across the test. ❍ 'iElementType' possible values, 2 if element is on top level page, 3 if element is present on subframe. For ex. var element = engine.createWebResetButton(1, 2); will create a WebResetButton element on Top level page with task id 1 and html tag 'input' ❍
In order to keep the changes in UI and script in sync with each other, the name of the variable has to be 'element'
ed events for a WebResetButton Once WebResetButton is created, you can play events on it. WebResetButton s exactly same events as WebObject. Please refer to ed events for a WebObject for more details.
WebSpan A WebSpan represents HTML element with tag 'span'. Apart from Configuring properties for a Web element Task, Execution of a Web element task and Release of a Web element task, following
operations/events are ed for a WebSpan : ●
Creation of a WebSpan
●
ed events for a WebSpan
Creation of a WebSpan WebSpan element can be created using createWebSpan API of IScriptEngine interface. The return value is an instance of WebSpan interface. ●
WebSpan createWebSpan(int id, int iElementType); where, 'id' is the Task Id. It should be unique across the test. ❍ 'iElementType' possible values, 2 if element is on top level page, 3 if element is present on subframe. For ex. var element = engine.createWebSpan(1, 2); will create a WebSpan element on Top level page with task id 1 and html tag 'span' ❍
In order to keep the changes in UI and script in sync with each other, the name of the variable has to be 'element'
ed events for a WebSpan Once WebSpan is created, you can play events on it. WebSpan s exactly same events as WebObject. Please refer to ed events for a WebObject for more details.
WebSubmitButton A WebSubmitButton represents HTML element with tag 'input' and type='submit'. Apart from Configuring properties for a Web element Task, Execution of a Web element task and Release of a Web element task, following operations/events are ed for a WebSubmitButton : ●
Creation of a WebSubmitButton
●
ed events for a WebSubmitButton
Creation of a WebSubmitButton WebSubmitButton element can be created using createWebSubmitButton API of IScriptEngine interface. The return value is an instance of WebSubmitButton interface. ●
WebSubmitButton createWebSubmitButton(int id, int iElementType); where, ❍ ❍
'id' is the Task Id. It should be unique across the test. 'iElementType' possible values, 2 if element is on top level page, 3 if element is
present on subframe. For ex. var element = engine.createWebSubmitButton(1, 2); will create a WebSubmitButton element on Top level page with task id 1 and html tag 'input' In order to keep the changes in UI and script in sync with each other, the name of the variable has to be 'element'
ed events for a WebSubmitButton Once WebSubmitButton is created, you can play events on it. WebSubmitButton s exactly same events as WebObject. Please refer to ed events for a WebObject for more details.
WebTable A WebTable represents Table HTML element with tag 'table'. Apart from Configuring properties for a Web element Task, Execution of a Web element task and Release of a Web element task, following operations/events are ed for a WebTable : ●
Creation of a WebTable
●
ed events for a WebTable
Creation of a WebTable WebTable element can be created using createWebTable API of IScriptEngine interface. The return value is an instance of WebTable interface. ●
WebTable createWebTable(int id, int iElementType); where, 'id' is the Task Id. It should be unique across the test. ❍ 'iElementType' possible values, 2 if element is on top level page, 3 if element is present on subframe. For ex. var element = engine.createWebTable(1, 2, true); will create a WebTable element on Top level page with task id 1 and html tag 'table' ❍
In order to keep the changes in UI and script in sync with each other, the name of the variable has to be 'element'
ed events for a WebTable Once WebTable is created, you can play events on it. Apart from ed events for a WebObject, WebTable also s following events: ●
String getCellData(long row, long column); To get cell data at specified row and column,
where 'row' is the index of row in Table, starts at 0. ❍ 'column' is the index of column in Table, starts at 0. ❍ returns cell's data at row, column For ex. element.getCellData(1, 1); will return the cell's data at second row and second column in the Table. long getColumnCount(long row); To get the column count at specified row in the WebTable ❍
●
❍
'row' is the index of row in Table, starts at 0.
returns count of columns at specified row in WebTable For ex. element.getColumnCount(1); will return count of columns at second row in WebTable. ❍
●
long getRowCount(); To get the row count in the WebTable ❍
●
return count of rows in WebTable
For ex. element.getRowCount(); will return count of rows in WebTable. boolean submit(); To submit the form returns true if event was executed successfully, returns false if there is any failure during execution For ex. element.submit(); will submit the form. ❍
WebTextArea A WebTextArea represents HTML element with tag 'textarea'. Apart from Configuring properties for a Web element Task, Execution of a Web element task and Release of a Web element task, following operations/events are ed for a WebTextArea : ●
Creation of a WebTextArea
●
ed events for a WebTextArea
Creation of a WebTextArea WebTextArea element can be created using createWebTextArea API of IScriptEngine interface. The return value is an instance of WebTextArea interface. ●
WebTextArea createWebTextArea(int id, int iElementType); where, 'id' is the Task Id. It should be unique across the test. ❍ 'iElementType' possible values, 2 if element is on top level page, 3 if element is present on subframe. For ex. var element = engine.createWebTextArea(1, 2); will create a WebTextArea element on Top level page with task id 1 and html tag 'textarea' ❍
In order to keep the changes in UI and script in sync with each other, the name of the variable has to be 'element'
ed events for a WebTextArea Once WebTextArea is created, you can play events on it. Apart from ed events for a WebObject, WebTextArea also s following events: ●
boolean set(String text); To set the specified text in the textarea, where ❍
'text' is the text to set in the textarea
returns true if event was executed successfully, returns false if there is any failure during execution For ex. element.set('AppPerfect'); will set 'AppPerfect' as text in the textarea. ❍
WebTextField A WebTextField represents HTML element with tag 'input' and type='textfield'. Apart from Configuring properties for a Web element Task, Execution of a Web element task and Release of a Web element task, following operations/events are ed for a WebTextField : ●
Creation of a WebTextField
●
ed events for a WebTextField
Creation of a WebTextField WebTextField element can be created using createWebTextField API of IScriptEngine interface. The return value is an instance of WebTextField interface. ●
WebTextField createWebTextField(int id, int iElementType); where, 'id' is the Task Id. It should be unique across the test. ❍ 'iElementType' possible values, 2 if element is on top level page, 3 if element is present on subframe. For ex. var element = engine.createWebTextField(1, 2); will create a WebTextField element on Top level page with task id 1 and html tag 'input' ❍
In order to keep the changes in UI and script in sync with each other, the name of the variable has to be 'element'
ed events for a WebTextField Once WebTextField is created, you can play events on it. Apart from ed events for a WebObject, WebTextField also s following events: ●
boolean set(String text); To set the specified text in the element, where
❍ ❍
●
'text' is the text to set in the element returns true if event was executed successfully, returns false if there is any failure during execution
For ex. element.set('AppPerfect'); will set 'AppPerfect' as text in the element. boolean submit(); To submit the form returns true if event was executed successfully, returns false if there is any failure during execution For ex. element.submit(); will submit the form. ❍
WebBrowserElement To fire any event on a WebBrowser one need to create WebBrowserElement. Apart from Configuring properties for a Web element Task, Execution of a Web element task and Release of a Web element task, following operations/events are ed for a WebBrowserElement : ●
Creation of a WebBrowserElement
●
ed events for a WebBrowserElement
Creation of a WebBrowserElement WebBrowserElement element can be created using createWebBrowserElement API of IScriptEngine interface. The return value is an instance of WebBrowserElement interface. ●
WebBrowserElement createWebBrowserElement(int id, int iElementType); where, 'id' is the Task Id. It should be unique across the test. ❍ 'iElementType' should always be 1 for element on a WebBrowser. For ex. var element = engine.createWebBrowserElement(1, 1); will create a WebBrowserElement element on WebBrowser with task id 1. ❍
In order to keep the changes in UI and script in sync with each other, the name of the variable has to be 'element'
ed events for a WebBrowserElement Once WebBrowserElement is created, you can play events on it. WebBrowserElement s following events: ●
boolean back(); To move to previous page in the WebBrowser
●
returns true if event was executed successfully, returns false if there is any failure during execution For ex. element.back(); will move to previous page in WebBrowser. boolean home(); To move to home page in the WebBrowser ❍
returns true if event was executed successfully, returns false if there is any failure during execution For ex. element.home(); will move to home page in WebBrowser. boolean forward(); To move to next page in the WebBrowser ❍
●
returns true if event was executed successfully, returns false if there is any failure during execution For ex. element.forward(); will move to next page in WebBrowser. ❍
●
boolean refresh(); To refresh page in the WebBrowser ❍
●
returns true if event was executed successfully, returns false if there is any failure during execution
For ex. element.refresh(); will refresh page in WebBrowser. boolean close(); To close WebBrowser returns true if event was executed successfully, returns false if there is any failure during execution For ex. element.close(); will close WebBrowser. ❍
Configuring properties for a Web element Task Once a task is created, all its properties like think time, title, timeout period etc. can be initialised to proper values using appropriate apis exposed by individual tasks. Following APIs are ed for configuring properties of a Web/HTML element task. ●
void setThinkTime(int iThinkTime); where, 'iThinkTime' is wait time in no. of seconds for which the engine should wait before the task is actually executed. For ex. element.setThinkTime(10); will set think time to 10 seconds. ❍
●
void setIgnored(boolean bIgnore); where, 'bIgnore' whether task should be ignored during execution. Possible values are true if task should be ignored, false otherwise. For ex. element.setIgnored(false); will ignore execution of task. void setExactMatchForAttributesComparision(boolean bExactMatch); This method should be called to match all the attributes exactly as they are while finding the target element. Else only part of the string is used during comparision of attributes. where, ❍
●
'bExactMatch' is true if all the attributes for the event are to matched exactly as they are; false otherwise. For ex. element.setExactMatchForAttributesComparision(false); void setTitle(String sTitle); where, ❍
●
'sTitle' title for event on element For ex. element.setTitle('click on WebObject'); void setDomIndex(long lDomIndex); This method should be called to set the DOM index of the target HTML element on which event is executed. Where, ❍
●
❍
'lDomIndex' is DOM index of the target HTML element.
●
For ex. element.setDomIndex(27); void setOuterHtml(String outerHtml); This method should be called to set the outerHTML of the target HTML element. This is used for highlighting the recorded element in the Editor view. Where, ❍
●
'outerHtml' is outer html code of the target HTML element.
For ex. element.setOuterHtml('INPUT title="AppPerfect" maxLength=2048 size=55 name=corp_id'); void setBreakPoint(boolean bBreakPoint); In case breakpoint is set, test will wait for 's interruption before moving forward. where, 'bBreakPoint' is true if breakpoint should be set; false otherwise. For ex. element.setBreakPoint(false); will clear breakpoint. void addAttribute(String sAttributeName, String sAttributeValue, boolean bIgnore, boolean bValidate); Each Web Element has a set of attributes, which are used to find the desired element during execution. where, ❍
●
❍ ❍ ❍
'sAttributeName' is name of the attribute 'sAttributeValue' is value of the attribute 'bIgnore' is true if this attribute should be ignored during execution; false otherwise.
'bValidate' is true if this attribute should be validated; false otherwise. For ex. element.addAttribute('innerText', 'AppPerfect', false, false); ❍
If attribute is parameterised then the value for same should be fetched using following API of IScriptEngine ●
String getParameterValue(String name, String value, String parameterName, boolean beforeExecution); where, ❍ ❍ ❍ ❍
❍
'name' is name of the attribute 'value' is recorded value of the attribute 'parameterName' is name of the test parameter 'bBeforeExecution' to indicate whether the test parameter should be populated before the execution of the task returns resultant value of parameterisation
For ex. var arg0 = engine.getParameterValue('innerText', 'AppPerfect', 'testparam1', true);
Execution of a Web element task Once a task is initialised it should be executed to fetch and process the results. Invoking the ed API for any Web Element will result in execution of that particular event. Please refer to Types of Web Element and all its ed events for more details. For ex. To execute a click event on WebLink the code statement will be var successful = element.click();
Release of a Web element task Once a task is executed it is must to call release method to release all the opened resources. It takes care to release all the internal objects like ResultSet, Connection etc. if any. Also this method takes care of saving the response/images if any to disk. This method should be always called in the end after the execution of each task. It can be done using following API of IScriptEngine interface ●
void release(); For ex. engine.release(); will release Web element task.
Window element task A window element represents dialogs or window components. For furthur details on ed elements and APIs go though the points mentioned below : ●
Types of Window Element
●
Configuring properties for a Window element Task
●
Execution of a Window element task
●
Release of a Window element task
Types of Window Element Following types of Window elements are ed in Web Test. Out of them, WinObject is generic element and can be used to represent any element not in the list. Please go through following elements for futhur details related to creation of each type of element and events ed on them. ●
WinObject
●
WinApplet
●
WinButton
●
WinCalendar
●
WinCheckBox
●
WinComboBox
●
WinEdit
●
WinFlash
●
WinListBox
●
WinListView
●
WinMenu
●
WinRadioButton
●
WinScrollBar
●
WinSpin
●
WinStatic
●
WinStatusBar
●
WinTab
●
WinToolbar
●
WinTreeView
In order to keep the changes in UI and script in sync with each other, the name of the variable has to be 'element'
WinObject A WinObject represents a generic Window element. Apart from Configuring properties for a Window element Task, Execution of a Window element task and Release of a Window element task, following operations/events are ed for a WinObject : ●
Creation of a WinObject
●
ed events for a WinObject
Creation of a WinObject WinObject element can be created using createWinObject API of IScriptEngine interface. The return value is an instance of WinObject interface. ●
WinObject createWinObject(int id, String sWindowClass, int iElementType); where, 'id' is the Task Id. It should be unique across the test. ❍ 'sWindowClass' is the Window class name used to identify element. ❍ 'iElementType' possible values, 1 if element is on a WebBrowser, 2 if element is on top level page, 3 if element is present on subframe. For ex. var element = engine.createWinObject(1, 'Edit', 1); will create a WinObject element on browser with task id 1 and window class 'Edit' ❍
In order to keep the changes in UI and script in sync with each other, the name of the variable has to be 'element'
ed events for a WinObject Once WinObject is created, you can play any one of the following event on it : ●
void captureImage(String sImageFilePath, boolean overrideExisting); Captures image of the
●
window object, where ❍ 'sImageFilePath' The complete file path where the captured image should be saved. ❍ 'overrideExisting' Whether to override the image if it already exists. ❍ returns true if event was executed successfully, returns false if there is any failure during execution For ex. element.captureImage('C:\\image1.jpeg', false);. boolean click(int x, int y); To replay a mouse click on element, where ❍ ❍ ❍
'x', is horizontal coordinate, relative to left client rect position of window 'y', is vertical coordinate, relative to top client rect position of window returns true if event was executed successfully, returns false if there is any failure during execution
●
For ex. element.click(24, 36); will replay click event on element. boolean rightClick(int x, int y); To replay a mouse right click on element, where
●
'x', is horizontal coordinate, relative to left client rect position of window ❍ 'y', is vertical coordinate, relative to top client rect position of window ❍ returns true if event was executed successfully, returns false if there is any failure during execution For ex. element.rightClick(24, 36); will replay right click event on element. boolean dblClick(int x, int y); To replay a mouse double click on element, where ❍
❍ ❍ ❍
'x', is horizontal coordinate, relative to left client rect position of window 'y', is vertical coordinate, relative to top client rect position of window returns true if event was executed successfully, returns false if there is any failure during execution
●
For ex. element.dblClick(24, 36); will replay double click event on element. boolean mouseMove(int x, int y); To replay a mouse move on element, where
●
'x', is horizontal coordinate, relative to left client rect position of window ❍ 'y', is vertical coordinate, relative to top client rect position of window ❍ returns true if event was executed successfully, returns false if there is any failure during execution For ex. element.mouseMove(24, 36); will replay mouse move event on element. boolean drag(int x, int y); To replay a drag event on element, where ❍
❍ ❍
'x', is horizontal coordinate, relative to left client rect position of window 'y', is vertical coordinate, relative to top client rect position of window
returns true if event was executed successfully, returns false if there is any failure during execution For ex. element.drag(24, 36); will replay a drag event on element. boolean drop(int x, int y); To replay a drop event on element, where ❍
●
❍ ❍ ❍
'x', is horizontal coordinate, relative to left client rect position of window 'y', is vertical coordinate, relative to top client rect position of window returns true if event was executed successfully, returns false if there is any failure during execution
For ex. element.drop(24, 36); will replay drop event on element. ●
boolean vScroll(int option, int item); Vertically scrolls an object that has embedded scrollbars, where ❍
'option', is a pre-defined constant indicating the direction and increment-type to scroll. Possible values are as follows : ■ ■ ■ ■ ■ ■
0 Scrolls X lines down, where X is specified by the item argument 1 Scrolls X lines up, where X is specified by the item argument 2 Scrolls X pages down, where X is specified by the item argument 3 Scrolls X pages up, where X is specified by the item argument 4 Scrolls to the top of Scrollbar 5 Scrolls to the bottom of Scrollbar
6 Scrolls to the position specified by the item argument 'item', this value specifies the quantity of lines or pages to scroll ■
❍
returns true if event was executed successfully, returns false if there is any failure during execution For ex. element.vScroll(1, 2); will scroll 2 lines up. ❍
●
boolean hScroll(int option, int item); Horizontally scrolls an object that has embedded scrollbars, where ❍
'option', is a pre-defined constant indicating the direction and increment-type to scroll. Possible values are as follows : ■ ■ ■ ■ ■ ■ ■
0 Scrolls X lines forwards, where X is specified by the item argument 1 Scrolls X lines backwards, where X is specified by the item argument 2 Scrolls X pages forwards, where X is specified by the item argument 3 Scrolls X pages backwards, where X is specified by the item argument 4 Scrolls to the beginning of Scrollbar 5 Scrolls to the end of Scrollbar 6 Scrolls to the position specified by the item argument
'item', this value specifies the quantity of lines or pages to scroll ❍ returns true if event was executed successfully, returns false if there is any failure during execution For ex. element.hScroll(1, 2); will scroll 2 lines backwards. boolean type(String keyBoardInput, boolean isAlphaNumeric); Types the specified string in the object, where ❍
●
❍ ❍
'keyBoardInput' A String value. The text string to type. 'isAlphaNumeric' is true if text string represents a alphanumeric key, false otherwise
returns true if event was executed successfully, returns false if there is any failure during execution For ex. element.type('AppPerfect', false); will type 'AppPerfect' text in the object. boolean maximize(); Maximizes the window to fill the entire screen. ❍
●
❍
returns true if event was executed successfully, returns false if there is any failure during execution
For ex. element.maximize(); ●
boolean minimize(); Minimizes the window to an icon. ❍
●
returns true if event was executed successfully, returns false if there is any failure during execution
For ex. element.minimize(); boolean restore(); Restores the window to its previous size. returns true if event was executed successfully, returns false if there is any failure during execution For ex. element.restore(); ❍
●
boolean activate(); Activates the window.
●
returns true if event was executed successfully, returns false if there is any failure during execution For ex. element.activate(); boolean close(); Closes the window. ❍
returns true if event was executed successfully, returns false if there is any failure during execution For ex. element.close(); ❍
●
boolean wait(String propertyName, String propertyValue, long timeout); Will make replayer wait till specified property recieves specified value or till the specified time out period, whatever happens earlier, where 'propertyName' name of the element's attribute for which the value should be fetched. ❍ 'propertyValue' value of the attribute against which the comparision should be done. ❍ 'timeout' in no. of seconds, time period for which the replayer should wait to get the expected value ❍ returns true if event was executed successfully, returns false if there is any failure during execution For ex. element.wait('innerText', 'AppPerfect', 30); will make replayer to wait till innertext for this element is not equal to 'AppPerfect', maximum waiting time will be 30 seconds. If attribute does not receive the expected value in this time period then event will be marked as timed out. ❍
WinApplet A WinApplet represents window element with class 'SunAwtCanvas'. Apart from Configuring properties for a Window element Task, Execution of a Window element task and Release of a Window element task, following operations/events are ed for a WinApplet : ●
Creation of a WinApplet
●
ed events for a WinApplet
Creation of a WinApplet
WinApplet element can be created using createWinApplet API of IScriptEngine interface. The return value is an instance of WinApplet interface. ●
WinApplet createWinApplet(int id, int iElementType); where, 'id' is the Task Id. It should be unique across the test. ❍ 'iElementType' possible values, 1 if element is on a WebBrowser, 2 if element is on top level page, 3 if element is present on subframe. For ex. var element = engine.createWinApplet(1, 2); will create a WinApplet element on Top level page with task id 1 and class 'SunAwtCanvas' ❍
In order to keep the changes in UI and script in sync with each other, the name of the variable has to be 'element'
ed events for a WinApplet Once WinApplet is created, you can play events on it. WinApplet s exactly same events as WinObject. Please refer to ed events for a WinObject for more details.
WinButton A WinButton represents window element with class 'Button'. Apart from Configuring properties for a Window element Task, Execution of a Window element task and Release of a Window element task, following operations/events are ed for a WinButton : ●
Creation of a WinButton
●
ed events for a WinButton
Creation of a WinButton WinButton element can be created using createWinButton API of IScriptEngine interface. The return value is an instance of WinButton interface. ●
WinButton createWinButton(int id, int iElementType); where, ❍ ❍
'id' is the Task Id. It should be unique across the test. 'iElementType' possible values, 1 if element is on a WebBrowser, 2 if element is on top level page, 3 if element is present on subframe.
For ex. var element = engine.createWinButton(1, 2); will create a WinButton element on Top level page with task id 1 and class 'Button' In order to keep the changes in UI and script in sync with each other, the name of the variable has to be 'element'
ed events for a WinButton Once WinButton is created, you can play events on it. WinButton s exactly same events as WinObject. Please refer to ed events for a WinObject for more details.
WinCalendar A WinCalendar represents window element with class 'CalWndMain'. Apart from Configuring properties for a Window element Task, Execution of a Window element task and Release of a Window element task, following operations/events are ed for a WinCalendar : ●
Creation of a WinCalendar
●
ed events for a WinCalendar
Creation of a WinCalendar WinCalendar element can be created using createWinCalendar API of IScriptEngine interface. The return value is an instance of WinCalendar interface. ●
WinCalendar createWinCalendar(int id, int iElementType); where, ❍
'id' is the Task Id. It should be unique across the test.
'iElementType' possible values, 1 if element is on a WebBrowser, 2 if element is on top level page, 3 if element is present on subframe. For ex. var element = engine.createWinCalendar(1, 2); will create a WinCalendar element on Top level page with task id 1 and class 'CalWndMain' ❍
In order to keep the changes in UI and script in sync with each other, the name of the variable has to be 'element'
ed events for a WinCalendar Once WinCalendar is created, you can play events on it. WinCalendar s exactly same events as WinObject. Please refer to ed events for a WinObject for more details.
WinCheckBox A WinCheckBox represents window element with class 'Button'. Apart from Configuring properties for a Window element Task, Execution of a Window element task and Release of a Window element task, following operations/events are ed for a WinCheckBox : ●
Creation of a WinCheckBox
●
ed events for a WinCheckBox
Creation of a WinCheckBox WinCheckBox element can be created using createWinCheckBox API of IScriptEngine interface. The return value is an instance of WinCheckBox interface. ●
WinCheckBox createWinCheckBox(int id, int iElementType); where, ❍ ❍
'id' is the Task Id. It should be unique across the test. 'iElementType' possible values, 1 if element is on a WebBrowser, 2 if element is on top level page, 3 if element is present on subframe.
For ex. var element = engine.createWinCheckBox(1, 2); will create a WinCheckBox element on Top level page with task id 1 and class 'Button' In order to keep the changes in UI and script in sync with each other, the name of the variable has to be 'element'
ed events for a WinCheckBox Once WinCheckBox is created, you can play events on it. Apart from ed events for a WinObject WinCheckBox also s following events : ●
boolean check(); To select the checkbox ❍
●
returns true if event was executed successfully, returns false if there is any failure during execution
For ex. element.check(); will select the check box. boolean unCheck(); To deselect a check box returns true if event was executed successfully, returns false if there is any failure during execution For ex. element.unCheck(); will deselect the checkbox. ❍
WinComboBox A WinComboBox represents window element with class 'ComboBox'. Apart from Configuring properties for a Window element Task, Execution of a Window element task and Release of a Window element task, following operations/events are ed for a WinComboBox : ●
Creation of a WinComboBox
●
ed events for a WinComboBox
Creation of a WinComboBox WinComboBox element can be created using createWinComboBox API of IScriptEngine interface.
The return value is an instance of WinComboBox interface. ●
WinComboBox createWinComboBox(int id, int iElementType); where, ❍
'id' is the Task Id. It should be unique across the test.
'iElementType' possible values, 1 if element is on a WebBrowser, 2 if element is on top level page, 3 if element is present on subframe. For ex. var element = engine.createWinComboBox(1, 2); will create a WinComboBox element on Top level page with task id 1 and class 'ComboBox' ❍
In order to keep the changes in UI and script in sync with each other, the name of the variable has to be 'element'
ed events for a WinComboBox Once WinComboBox is created, you can play events on it. Apart from ed events for a WinObject WinComboBox also s following events : ●
String[] getItems(); To get all the items in the Combo box
●
returns array of items For ex. element.getItems(); will return all the items in combo box. String getItem(int index); To get item at specified index, where ❍
❍ ❍
'index' is the position of item in combo, starts at 0. returns item at index
●
For ex. element.getItem(1); will return the second element in the combo. int getItemsCount(); To get the item count in the Combo box
●
returns count of items in combo For ex. element.getItemsCount(); will return count of items in combo box. String getSelectedItem(); To get selected item in the Combo box
●
returns selected item in combo For ex. element.getSelectedItem(); will return the selected item in combo box. boolean select(int index); To select item at specified index, where
●
'index' is the position of item in combo, starts at 0. ❍ returns true if event was executed successfully, returns false if there is any failure during execution For ex. element.select(1); will select the second element in the combo. boolean selectItem(String item); To select specified item in combo, where
❍
❍
❍
'item' is the text representing the item to be selected. ❍ returns true if event was executed successfully, returns false if there is any failure during execution For ex. element.selectItem('AppPerfect'); will select 'AppPerfect' item in the combo. ❍
WinEdit A WinEdit represents window element with class 'Edit'. Apart from Configuring properties for a Window element Task, Execution of a Window element task and Release of a Window element task, following operations/events are ed for a WinEdit : ●
Creation of a WinEdit
●
ed events for a WinEdit
Creation of a WinEdit WinEdit element can be created using createWinEdit API of IScriptEngine interface. The return value is an instance of WinEdit interface. ●
WinEdit createWinEdit(int id, int iElementType); where, ❍
'id' is the Task Id. It should be unique across the test.
'iElementType' possible values, 1 if element is on a WebBrowser, 2 if element is on top level page, 3 if element is present on subframe. For ex. var element = engine.createWinEdit(1, 2); will create a WinEdit element on Top level page with task id 1 and class 'Button' ❍
In order to keep the changes in UI and script in sync with each other, the name of the variable has to be 'element'
ed events for a WinEdit Once WinEdit is created, you can play events on it. Apart from ed events for a WinObject WinEdit also s following events : ●
boolean set(String text); To set the specified text in the Edit box, where 'text' is the text to set in Edit box. ❍ returns true if event was executed successfully, returns false if there is any failure during execution For ex. element.set('AppPerfect'); will set 'AppPerfect' in the Edit box boolean setCaretPos(int row, int column); Places the cursor at the specified point in the edit box, where ❍
●
'row' is the The zero-based row position (in lines) at which the insertion point is placed. ❍ 'column' is the The zero-based column position (in characters in the specified row) at which the insertion point is placed. ❍ returns true if event was executed successfully, returns false if there is any failure during execution For ex. element.setCaretPos(2, 3); will place cursor at 4th character in third line of Edit Box. ❍
●
boolean setSelection(int columnFrom, int columnTo); Selects text in the edit box, where ❍ ❍
'columnFrom' is the zero-based column at which the selection starts (in characters). 'columnTo' is the zero-based column at which the selection ends (in characters).
returns true if event was executed successfully, returns false if there is any failure during execution For ex. element.setSelection(2, 3); will select text from 3rd to 4th character. ❍
WinFlash A WinFlash represents window element with class 'MacromediaFlashPlayerActiveX'. Apart from Configuring properties for a Window element Task, Execution of a Window element task and Release of a Window element task, following operations/events are ed for a WinFlash : ●
Creation of a WinFlash
●
ed events for a WinFlash
Creation of a WinFlash WinFlash element can be created using createWinFlash API of IScriptEngine interface. The return value is an instance of WinFlash interface. ●
WinFlash createWinFlash(int id, int iElementType); where, 'id' is the Task Id. It should be unique across the test. ❍ 'iElementType' possible values, 1 if element is on a WebBrowser, 2 if element is on top level page, 3 if element is present on subframe. For ex. var element = engine.createWinFlash(1, 2); will create a WinFlash element on Top level page with task id 1 and class 'MacromediaFlashPlayerActiveX' ❍
In order to keep the changes in UI and script in sync with each other, the name of the variable has to be 'element'
ed events for a WinFlash Once WinFlash is created, you can play events on it. WinFlash s exactly same events as WinObject. Please refer to ed events for a WinObject for more details.
WinListBox A WinListBox represents window element with class 'ListBox'. Apart from Configuring properties for a Window element Task, Execution of a Window element task and Release of a Window element task, following operations/events are ed for a WinListBox :
●
Creation of a WinListBox
●
ed events for a WinListBox
Creation of a WinListBox WinListBox element can be created using createWinListBox API of IScriptEngine interface. The return value is an instance of WinListBox interface. ●
WinListBox createWinListBox(int id, int iElementType); where, 'id' is the Task Id. It should be unique across the test. ❍ 'iElementType' possible values, 1 if element is on a WebBrowser, 2 if element is on top level page, 3 if element is present on subframe. For ex. var element = engine.createWinListBox(1, 2); will create a WinListBox element on Top level page with task id 1 and class 'ListBox' ❍
In order to keep the changes in UI and script in sync with each other, the name of the variable has to be 'element'
ed events for a WinListBox Once WinListBox is created, you can play events on it. Apart from ed events for a WinObject WinListBox also s following events : ●
String[] getItems(); To get all the items in the Listbox
●
returns array of items For ex. element.getItems(); will return all the items in Listbox. String getItem(int index); To get item at specified index, where
●
'index' is the position of item in ListBox, starts at 0. ❍ returns item at index For ex. element.getItem(1); will return the second element in the ListBox. int getItemsCount(); To get the item count in the ListBox
❍
❍
❍
returns count of items in ListBox
●
For ex. element.getItemsCount(); will return count of items in ListBox. String[] getSelectedItems(); To get selected items in the ListBox
●
returns array of selected items in ListBox For ex. element.getSelectedItems(); will return the selected items in ListBox. boolean select(int index); To select item at specified index, where ❍
'index' is the position of item in ListBox, starts at 0. ❍ returns true if event was executed successfully, returns false if there is any failure during execution For ex. element.select(1); will select the second element in the ListBox. ❍
●
boolean selectItem(String item); To select specified item in ListBox, where ❍ ❍
'item' is the text representing the item to be selected. returns true if event was executed successfully, returns false if there is any failure during execution
●
For ex. element.selectItem('AppPerfect'); will select 'AppPerfect' item in the ListBox. boolean deSelect(int index); To deselect item at specified index, where
●
'index' is the position of item in ListBox, starts at 0. ❍ returns true if event was executed successfully, returns false if there is any failure during execution For ex. element.deSelect(1); will deselect the second element in the ListBox. boolean deSelectItem(String item); To deselect specified item in ListBox, where ❍
❍ ❍
●
'item' is the text representing the item to be deselected. returns true if event was executed successfully, returns false if there is any failure during execution
For ex. element.deSelectItem('AppPerfect'); will deselect 'AppPerfect' item in the ListBox. boolean selectRange(int fromindex, int toIndex); To select multiple items in a listbox, where 'fromindex' is the index of first item in the range to be selected, starts at 0. ❍ 'toIndex' is the index of last item in the range to be selected, starts at 0. ❍ returns true if event was executed successfully, returns false if there is any failure during execution For ex. element.selectRange(1, 5); will select the range from second element to sixth element in the ListBox. boolean selectRangeItem(String fromitem, String toItem); To select multiple items in a listbox based on item text, where ❍
●
'fromitem' is the first item in the range to be selected, starts at 0. ❍ 'toItem' is the last item in the range to be selected, starts at 0. ❍ returns true if event was executed successfully, returns false if there is any failure during execution For ex. element.selectRange('AppPerfect', 'Testing Tools'); will select the items in specified range in the ListBox. ❍
●
boolean extendSelect(int index); To select an additional item in multiselect list box, where 'index' is the position of additional item to be selected in ListBox, starts at 0. ❍ returns true if event was executed successfully, returns false if there is any failure during execution For ex. element.extendSelect(1); boolean extendSelectItem(String item); To select an additional item in multiselect list box, where ❍
●
'item' is the text representing the additional item to be selected. ❍ returns true if event was executed successfully, returns false if there is any failure during execution For ex. element.extendSelectItem('AppPerfect'); ❍
WinListView A WinListView represents windows list view control with class 'SysListView32'. Apart from Configuring properties for a Window element Task, Execution of a Window element task and Release of a Window element task, following operations/events are ed for a WinListView : ●
Creation of a WinListView
●
ed events for a WinListView
Creation of a WinListView WinListView element can be created using createWinListView API of IScriptEngine interface. The return value is an instance of WinListView interface. ●
WinListView createWinListView(int id, int iElementType); where, 'id' is the Task Id. It should be unique across the test. ❍ 'iElementType' possible values, 1 if element is on a WebBrowser, 2 if element is on top level page, 3 if element is present on subframe. For ex. var element = engine.createWinListView(1, 2); will create a WinListView element on Top level page with task id 1 and class 'ListView' ❍
In order to keep the changes in UI and script in sync with each other, the name of the variable has to be 'element'
ed events for a WinListView Once WinListView is created, you can play events on it. Apart from ed events for a WinObject WinListView also s following events : ●
String[] getItems(); To get all the items in the ListView
●
returns array of items For ex. element.getItems(); will return all the items in ListView. String getItem(int index); To get item at specified index, where
●
'index' is the position of item in ListView, starts at 0. ❍ returns item at index For ex. element.getItem(1); will return the second element in the ListView. int getItemsCount(); To get the item count in the ListView
●
returns count of items in listview For ex. element.getItemsCount(); will return count of items in ListView. String[] getSelectedItems(); To get selected items in the ListView
❍
❍
❍
❍
returns array of selected items in ListView
●
For ex. element.getSelectedItems(); will return the selected items in ListView. boolean select(int index); To select item at specified index, where ❍
'index' is the position of item in ListView, starts at 0.
returns true if event was executed successfully, returns false if there is any failure during execution For ex. element.select(1); will select the second element in the ListView. ❍
●
boolean selectItem(String item); To select specified item in ListView, where
●
'item' is the text representing the item to be selected. ❍ returns true if event was executed successfully, returns false if there is any failure during execution For ex. element.selectItem('AppPerfect'); will select 'AppPerfect' item in the ListView. boolean deSelect(int index); To deselect item at specified index, where ❍
❍
'index' is the position of item in ListView, starts at 0.
returns true if event was executed successfully, returns false if there is any failure during execution For ex. element.deSelect(1); will deselect the second element in the ListView. ❍
●
boolean deSelectItem(String item); To deselect specified item in ListView, where
●
'item' is the text representing the item to be deselected. ❍ returns true if event was executed successfully, returns false if there is any failure during execution For ex. element.deSelectItem('AppPerfect'); will deselect 'AppPerfect' item in the ListView. boolean selectRange(int fromindex, int toIndex); To select multiple items in a ListView, where ❍
'fromindex' is the index of first item in the range to be selected, starts at 0. ❍ 'toIndex' is the index of last item in the range to be selected, starts at 0. ❍ returns true if event was executed successfully, returns false if there is any failure during execution For ex. element.selectRange(1, 5); will select the range from second element to sixth element in the ListView. ❍
●
boolean selectRangeItem(String fromitem, String toItem); To select multiple items in a ListView based on item text, where 'fromitem' is the first item in the range to be selected, starts at 0. ❍ 'toItem' is the last item in the range to be selected, starts at 0. ❍ returns true if event was executed successfully, returns false if there is any failure during execution For ex. element.selectRange('AppPerfect', 'Testing Tools'); will select the items in specified range in the ListView. boolean extendSelect(int index); To select an additional item in multiselect list box, where ❍
●
'index' is the position of additional item to be selected in ListView, starts at 0. ❍ returns true if event was executed successfully, returns false if there is any failure during execution For ex. element.extendSelect(1); ❍
●
boolean extendSelectItem(String item); To select an additional item in multiselect list box, where ❍ ❍
●
'item' is the text representing the additional item to be selected. returns true if event was executed successfully, returns false if there is any failure during execution
For ex. element.extendSelectItem('AppPerfect'); int getColumnCount(); To get the number of columns in the (report style) listview object. returns number of columns in the listview For ex. element.getColumnCount(); String getColumnHeader(int index); To get the text header of the specified (report style) listview column, where ❍
●
'index' is the zero-based index of the column ❍ returns column header text of specified column For ex. element.getColumnHeader(1); ❍
WinMenu A WinMenu represents windows menu bar. Apart from Configuring properties for a Window element Task, Execution of a Window element task and Release of a Window element task, following operations/events are ed for a WinMenu : ●
Creation of a WinMenu
●
ed events for a WinMenu
Creation of a WinMenu WinMenu element can be created using createWinMenu API of IScriptEngine interface. The return value is an instance of WinMenu interface. ●
WinMenu createWinMenu(int id, String sWindowClass, int iElementType); where, 'id' is the Task Id. It should be unique across the test. ❍ 'sWindowClass' is the Window class name used to identify element. ❍ 'iElementType' possible values, 1 if element is on a WebBrowser, 2 if element is on top level page, 3 if element is present on subframe. For ex. var element = engine.createWinMenu(1, 'Notepad', 2); will create a WinMenu element. ❍
In order to keep the changes in UI and script in sync with each other, the name of the variable has to be 'element'
ed events for a WinMenu
Once WinMenu is created, you can play events on it. WinMenu s following events : ●
boolean selectItem(String menuPath, boolean isContextMenu, boolean selectByCommand); To select the specified menuitem, where ❍
❍ ❍
❍
●
'menuPath' specifies the complete path of the menu item, separate each item with a semicolon (;) 'isContextMenu' is true if its a context menu, false otherwise 'selectByCommand' is true if item should be selected using command identifier, false otherwise returns true if event was executed successfully, returns false if there is any failure during execution
For ex. element.selectItem('&Help;&About Notepad', false, true); will select the specified menu item boolean wait(String propertyName, String propertyValue, long timeout); Will make replayer wait till specified property recieves specified value or till the specified time out period, whatever happens earlier, where 'propertyName' name of the element's attribute for which the value should be fetched. ❍ 'propertyValue' value of the attribute against which the comparision should be done. ❍ 'timeout' in no. of seconds, time period for which the replayer should wait to get the expected value ❍ returns true if event was executed successfully, returns false if there is any failure during execution For ex. element.wait('innerText', 'AppPerfect', 30); will make replayer to wait till innertext for this element is not equal to 'AppPerfect', maximum waiting time will be 30 seconds. If attribute does not receive the expected value in this time period then event will be marked as timed out. ❍
WinRadioButton A WinRadioButton represents window element with class 'Button'. Apart from Configuring properties for a Window element Task, Execution of a Window element task and Release of a Window element task, following operations/events are ed for a WinRadioButton : ●
Creation of a WinRadioButton
●
ed events for a WinRadioButton
Creation of a WinRadioButton WinRadioButton element can be created using createWinRadioButton API of IScriptEngine interface. The return value is an instance of WinRadioButton interface. ●
WinRadioButton createWinRadioButton(int id, int iElementType); where, ❍
'id' is the Task Id. It should be unique across the test.
'iElementType' possible values, 1 if element is on a WebBrowser, 2 if element is on top level page, 3 if element is present on subframe. For ex. var element = engine.createWinRadioButton(1, 2); will create a WinRadioButton element on Top level page with task id 1 and class 'Button' ❍
In order to keep the changes in UI and script in sync with each other, the name of the variable has to be 'element'
ed events for a WinRadioButton Once WinRadioButton is created, you can play events on it. Apart from ed events for a WinObject WinRadioButton also s following events : ●
boolean select(); To select the Radio Button ❍
returns true if event was executed successfully, returns false if there is any failure during execution
For ex. element.select(); will select the radio.
WinScrollbar A WinScrollbar represents window element with class 'Scrollbar'. Apart from Configuring properties for a Window element Task, Execution of a Window element task and Release of a Window element task, following operations/events are ed for a WinScrollbar : ●
Creation of a WinScrollbar
●
ed events for a WinScrollbar
Creation of a WinScrollbar WinScrollbar element can be created using createWinScrollbar API of IScriptEngine interface. The return value is an instance of WinScrollbar interface. ●
WinScrollbar createWinScrollbar(int id, int iElementType); where, 'id' is the Task Id. It should be unique across the test. ❍ 'iElementType' possible values, 1 if element is on a WebBrowser, 2 if element is on top level page, 3 if element is present on subframe. For ex. var element = engine.createWinScrollbar(1, 2); will create a WinScrollbar element on Top level page with task id 1 and class 'Scrollbar' ❍
In order to keep the changes in UI and script in sync with each other, the name of the variable has to be 'element'
ed events for a WinScrollbar Once WinScrollbar is created, you can play events on it. Apart from ed events for a WinObject WinScrollbar also s following events : ●
boolean set(int position); Sets the scroll bar position, where ❍ ❍
●
For ex. element.set(100); boolean nextLine(int count); Moves the scroll bar downward, or to the right by the specified number of lines, where ❍ ❍
●
'count' is number of lines to move returns true if event was executed successfully, returns false if there is any failure during execution
For ex. element.nextLine(1); boolean prevLine(int count); Moves the scroll bar upward, or to the left, by the specified number of lines, where ❍ ❍
●
'position' is scroll bar position to set returns true if event was executed successfully, returns false if there is any failure during execution
'count' is number of lines to move returns true if event was executed successfully, returns false if there is any failure during execution
For ex. element.prevLine(1); boolean nextPage(int count); Moves the scroll bar downward, or to the right by the specified number of pages, where 'count' is number of Pages to move ❍ returns true if event was executed successfully, returns false if there is any failure during execution For ex. element.nextPage(1); boolean prevPage(int count); Moves the scroll bar upward, or to the left, by the specified number of Pages, where ❍
●
❍
'count' is number of Pages to move
returns true if event was executed successfully, returns false if there is any failure during execution For ex. element.prevPage(1); ❍
WinSpin A WinSpin represents window element with class 'msctls_updown32'. Apart from Configuring properties for a Window element Task, Execution of a Window element task and Release of a Window element task, following operations/events are ed for a WinSpin : ●
Creation of a WinSpin
●
ed events for a WinSpin
Creation of a WinSpin WinSpin element can be created using createWinSpin API of IScriptEngine interface. The return value is an instance of WinSpin interface. ●
WinSpin createWinSpin(int id, int iElementType); where, 'id' is the Task Id. It should be unique across the test. ❍ 'iElementType' possible values, 1 if element is on a WebBrowser, 2 if element is on top level page, 3 if element is present on subframe. For ex. var element = engine.createWinSpin(1, 2); will create a WinSpin element on Top level page with task id 1 and class 'msctls_updown32' ❍
In order to keep the changes in UI and script in sync with each other, the name of the variable has to be 'element'
ed events for a WinSpin Once WinSpin is created, you can play events on it. Apart from ed events for a WinObject WinSpin also s following events : ●
boolean set(int position); Sets the spin object to the specified value, where ❍ ❍
'position' is value to set returns true if event was executed successfully, returns false if there is any failure during execution
●
For ex. element.set(100); boolean next(int count); Sets the spin object to its next value by specified count, where
●
'count' is count to move ❍ returns true if event was executed successfully, returns false if there is any failure during execution For ex. element.next(1); boolean prev(int count); Sets the spin object to its previous value by specified count, where ❍
'count' is count to move ❍ returns true if event was executed successfully, returns false if there is any failure during execution For ex. element.prev(1); ❍
WinStatic A WinStatic represents window element with class 'Static'. Apart from Configuring properties for a
Window element Task, Execution of a Window element task and Release of a Window element task, following operations/events are ed for a WinStatic : ●
Creation of a WinStatic
●
ed events for a WinStatic
Creation of a WinStatic WinStatic element can be created using createWinStatic API of IScriptEngine interface. The return value is an instance of WinStatic interface. ●
WinStatic createWinStatic(int id, int iElementType); where, ❍
'id' is the Task Id. It should be unique across the test.
'iElementType' possible values, 1 if element is on a WebBrowser, 2 if element is on top level page, 3 if element is present on subframe. For ex. var element = engine.createWinStatic(1, 2); will create a WinStatic element on Top level page with task id 1 and class 'Static' ❍
In order to keep the changes in UI and script in sync with each other, the name of the variable has to be 'element'
ed events for a WinStatic Once WinStatic is created, you can play events on it. WinStatic s exactly same events as WinObject. Please refer to ed events for a WinObject for more details.
WinStatusBar A WinStatusBar represents window element with class 'msctls_statusbar32'. Apart from Configuring properties for a Window element Task, Execution of a Window element task and Release of a Window element task, following operations/events are ed for a WinStatusBar : ●
Creation of a WinStatusBar
●
ed events for a WinStatusBar
Creation of a WinStatusBar WinStatusBar element can be created using createWinStatusBar API of IScriptEngine interface. The return value is an instance of WinStatusBar interface. ●
WinStatusBar createWinStatusBar(int id, int iElementType); where, ❍
'id' is the Task Id. It should be unique across the test.
❍
'iElementType' possible values, 1 if element is on a WebBrowser, 2 if element is on top level page, 3 if element is present on subframe.
For ex. var element = engine.createWinStatusBar(1, 2); will create a WinStatusBar element on Top level page with task id 1 and class 'msctls_statusbar32' In order to keep the changes in UI and script in sync with each other, the name of the variable has to be 'element'
ed events for a WinStatusBar Once WinStatusBar is created, you can play events on it. Apart from ed events for a WinObject WinStatusBar also s following events : ●
String[] getItems(); To get all the items in the StatusBar ❍
returns array of items
●
For ex. element.getItems(); will return all the items in StatusBar. String getItem(int index); To get item at specified index, where
●
'index' is the position of item in StatusBar, starts at 0. ❍ returns item at index For ex. element.getItem(1); will return the second element in the StatusBar. int getItemsCount(); To get the item count in the StatusBar ❍
returns count of items in StatusBar For ex. element.getItemsCount(); will return count of items in StatusBar. ❍
WinTab A WinTab represents window element with class 'SysTabControl32'. Apart from Configuring properties for a Window element Task, Execution of a Window element task and Release of a Window element task, following operations/events are ed for a WinTab : ●
Creation of a WinTab
●
ed events for a WinTab
Creation of a WinTab WinTab element can be created using createWinTab API of IScriptEngine interface. The return value is an instance of WinTab interface. ●
WinTab createWinTab(int id, int iElementType); where, ❍ ❍
'id' is the Task Id. It should be unique across the test. 'iElementType' possible values, 1 if element is on a WebBrowser, 2 if element is on
top level page, 3 if element is present on subframe. For ex. var element = engine.createWinTab(1, 2); will create a WinTab element on Top level page with task id 1 and class 'SysTabControl32' In order to keep the changes in UI and script in sync with each other, the name of the variable has to be 'element'
ed events for a WinTab Once WinTab is created, you can play events on it. Apart from ed events for a WinObject WinTab also s following events : ●
String[] getItems(); To get all the items in the Tab control
●
returns array of items For ex. element.getItems(); will return all the items in Tab control. String getItem(int index); To get item at specified index, where ❍
❍
'index' is the position of item in Tab control, starts at 0.
returns item at index For ex. element.getItem(1); will return the second element in the Tab control. ❍
●
int getItemsCount(); To get the item count in the Tab control ❍
returns count of items in Tab control
●
For ex. element.getItemsCount(); will return count of items in Tab control. String getSelectedItem(); To get selected item in the Tab control
●
returns selected item in Tab control For ex. element.getSelectedItem(); will return the selected item in Tab control boolean select(int index); To select item at specified index, where
●
'index' is the position of item in Tab control, starts at 0. ❍ returns true if event was executed successfully, returns false if there is any failure during execution For ex. element.select(1); will select the second element in the Tab control. boolean selectItem(String item); To select specified item in Tab control, where
❍
❍
❍ ❍
'item' is the text representing the item to be selected. returns true if event was executed successfully, returns false if there is any failure during execution
For ex. element.selectItem('AppPerfect'); will select 'AppPerfect' item in the Tab control.
WinToolbar A WinToolbar represents window element with class 'ToolbarWindow32'. Apart from Configuring properties for a Window element Task, Execution of a Window element task and Release of a Window element task, following operations/events are ed for a WinToolbar :
●
Creation of a WinToolbar
●
ed events for a WinToolbar
Creation of a WinToolbar WinToolbar element can be created using createWinToolbar API of IScriptEngine interface. The return value is an instance of WinToolbar interface. ●
WinToolbar createWinToolbar(int id, int iElementType); where, ❍ ❍
'id' is the Task Id. It should be unique across the test. 'iElementType' possible values, 1 if element is on a WebBrowser, 2 if element is on top level page, 3 if element is present on subframe.
For ex. var element = engine.createWinToolbar(1, 2); will create a WinToolbar element on Top level page with task id 1 and class 'ToolbarWindow32' In order to keep the changes in UI and script in sync with each other, the name of the variable has to be 'element'
ed events for a WinToolbar Once WinToolbar is created, you can play events on it. Apart from ed events for a WinObject WinToolbar also s following events : ●
String[] getItems(); To get all the items in the Toolbar control
●
returns array of items For ex. element.getItems(); will return all the items in Toolbar control. String getItem(int index); To get item at specified index, where ❍
❍ ❍
'index' is the position of item in Toolbar control, starts at 0. returns item at index
●
For ex. element.getItem(1); will return the second element in the Toolbar control. int getItemsCount(); To get the item count in the Toolbar control
●
returns count of items in Toolbar control For ex. element.getItemsCount(); will return count of items in Toolbar control. String getSelectedItem(); To get selected item in the Toolbar control
●
returns selected item in Toolbar control For ex. element.getSelectedItem(); will return the selected item in Toolbar control boolean select(int index); To select item at specified index, where
❍
❍
❍ ❍
'index' is the position of item in Toolbar control, starts at 0. returns true if event was executed successfully, returns false if there is any failure during execution
●
For ex. element.select(1); will select the second element in the Toolbar control. boolean selectItem(String item); To select specified item in Toolbar control, where ❍
'item' is the text representing the item to be selected.
returns true if event was executed successfully, returns false if there is any failure during execution For ex. element.selectItem('AppPerfect'); will select 'AppPerfect' item in the Toolbar control. ❍
WinTreeView A WinTreeView represents window element with class 'SysTreeView32'. Apart from Configuring properties for a Window element Task, Execution of a Window element task and Release of a Window element task, following operations/events are ed for a WinTreeView : ●
Creation of a WinTreeView
●
ed events for a WinTreeView
Creation of a WinTreeView WinTreeView element can be created using createWinTreeView API of IScriptEngine interface. The return value is an instance of WinTreeView interface. ●
WinTreeView createWinTreeView(int id, int iElementType); where, 'id' is the Task Id. It should be unique across the test. ❍ 'iElementType' possible values, 1 if element is on a WebBrowser, 2 if element is on top level page, 3 if element is present on subframe. For ex. var element = engine.createWinTreeView(1, 2); will create a WinTreeView element on Top level page with task id 1 and class 'SysTreeView32' ❍
In order to keep the changes in UI and script in sync with each other, the name of the variable has to be 'element'
ed events for a WinTreeView Once WinTreeView is created, you can play events on it. Apart from ed events for a WinObject WinTreeView also s following events : ●
String[] getItems(); To get all the items in the TreeView control
●
returns array of items For ex. element.getItems(); will return all the items in TreeView control. int getItemsCount(); To get the item count in the TreeView control ❍
❍
returns count of items in TreeView control
●
For ex. element.getItemsCount(); will return count of items in TreeView control. String[] getSelectedItems(); To get selected items in the TreeView control ❍
●
returns array of selected items in TreeView control
For ex. element.getSelectedItems(); will return the selected items in TreeView control boolean selectItem(String nodePath); To select specified item in TreeView control, where 'nodePath' is the text representing the complete path of tree item to be selected. Each item is separated by a semicolon (;) ❍ returns true if event was executed successfully, returns false if there is any failure during execution For ex. element.selectItem('AppPerfect;Web Test'); boolean collapse(String nodePath); To collapse the specified node in TreeView control, where ❍
●
❍
❍
●
'nodePath' is the text representing the complete path of tree item to be collapsed. Each item is separated by a semicolon (;) returns true if event was executed successfully, returns false if there is any failure during execution
For ex. element.collapse('AppPerfect;Web Test'); boolean expand(String nodePath); To expand the specified node in TreeView control, where 'nodePath' is the text representing the complete path of tree item to be expanded. Each item is separated by a semicolon (;) ❍ returns true if event was executed successfully, returns false if there is any failure during execution For ex. element.expand('AppPerfect;Web Test'); boolean expandAll(String nodePath); To expand the specified node in TreeView control and all of the nodes below it, where ❍
●
'nodePath' is the text representing the complete path of tree item to be expanded. Each item is separated by a semicolon (;) ❍ returns true if event was executed successfully, returns false if there is any failure during execution For ex. element.expandAll('AppPerfect;Web Test'); ❍
Configuring properties for a Window element Task Once a task is created, all its properties like think time, title, timeout period etc. can be initialised to proper values using appropriate apis exposed by individual tasks. Following APIs are ed for configuring properties of a Window element task. ●
void setThinkTime(int iThinkTime); where,
●
'iThinkTime' is wait time in no. of seconds for which the engine should wait before the task is actually executed. For ex. element.setThinkTime(10); will set think time to 10 seconds. void setIgnored(boolean bIgnore); where, ❍
'bIgnore' whether task should be ignored during execution. Possible values are true if task should be ignored, false otherwise. For ex. element.setIgnored(false); will ignore execution of task. void setRecordedWhileShowingSSLCertificate(boolean flag); This method should be called to mark event as an event on SSL certificate dialog. where, ❍
●
'flag' is true if this event is an event on SSL certificate dialog; false otherwise. For ex. element.setRecordedWhileShowingSSLCertificate(false); ❍
●
void setTitle(String sTitle); where, 'sTitle' title for event on element For ex. element.setTitle('click on WinObject'); void setImagePath(String sImagePath); This method should be called to set the element's image path. This is used for showing the elements image in the Editor view. Where, ❍
●
'sImagePath' is file path of the element's image saved on disk. Path is relative to the project location. For ex. element.setImagePath('recorded/2006_12_1_13_39_1_50/ActionGroup1/ appftimage0.jpeg'); ❍
●
void setBreakPoint(boolean bBreakPoint); In case breakpoint is set, test will wait for 's interruption before moving forward. where, 'bBreakPoint' is true if breakpoint should be set; false otherwise. For ex. element.setBreakPoint(false); will clear breakpoint. void addAttribute(String sAttributeName, String sAttributeValue, boolean bIgnore, boolean bValidate); Each Window Element has a set of attributes, which are used to find the desired element during execution. where, ❍
●
'sAttributeName' is name of the attribute ❍ 'sAttributeValue' is value of the attribute ❍ 'bIgnore' is true if this attribute should be ignored during execution; false otherwise. ❍ 'bValidate' is true if this attribute should be validated; false otherwise. For ex. element.addAttribute('windowIndex', '1', false, false); ❍
If attribute is parameterised then the value for same should be fetched using following API of IScriptEngine ●
String getParameterValue(String name, String value, String parameterName, boolean beforeExecution); where, 'name' is name of the attribute ❍ 'value' is recorded value of the attribute ❍ 'parameterName' is name of the test parameter ❍ 'bBeforeExecution' to indicate whether the test parameter should be populated before the execution of the task ❍ returns resultant value of parameterisation For ex. var arg0 = engine.getParameterValue('windowIndex', '1', 'testparam1', true); ❍
Execution of a Window element task Once a task is initialised it should be executed to fetch and process the results. Invoking the ed API for any Window Element will result in execution of that particular event. Please refer to Types of Window Element and all its ed events for more details. For ex. To execute a click event on WinObject the code statement will be var successful = element.click(24,36);This will simulate a mouse click at specified coordinates. The coordinates are relative to the top left client rect of the window.
Release of a Window element task Once a task is executed it is must to call release method to release all the opened resources. It takes care to release all the internal objects like ResultSet, Connection etc. if any. Also this method takes care of saving the response/images if any to disk. This method should be always called in the end after the execution of each task. It can be done using following API of IScriptEngine interface ●
void release(); For ex. engine.release(); will release Window element task.
Validating a task response To determine whether a task has executed successfully or not you need to validate the data received in the response. This chapter will cover: ●
Validating a Web 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. ●
●
●
●
●
●
●
●
●
●
●
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. boolean isValidationSuccessful(); Once the task is executed, this method returns the status of the validation carried out. void setValidationSuccessful(boolean success); Once the task is executed, this method can be used to set the status of validation. IValidationResult getValidationResult(); Once the task is executed, detailed validation result can be fetched using this method. 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. 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. boolean assertInDatabase(String description, String databaseId, String query); Once the task is executed, database can be validated by firing the specified SELECT query. 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. boolean assertTodaysDate(String description, String dateFormat); Once the task is executed, response can be validated to contain today's date in predefined format. boolean assertText(String description, String[] txt, boolean bCaseSensitive, boolean 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. 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. 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. 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. boolean assertPage(String description); Once the task is executed, the response page can be validated using this method. boolean assertLinkCount(String description, int count); Once the task is executed, no of links in the response can be validated using this method. boolean assertFormCount(String description, int count); Once the task is executed, no of forms in the response can be validated using this method. boolean assertImageCount(String description, int count); Once the task is executed, no of images in the response can be validated using this method. boolean assertInputElementCount(String description, int count); Once the task is executed, no of input elements in the response can be validated using this method. boolean assertPageSize(String description, long sizeInBytes); Once the task is executed, size of the response can be validated using this method.