Using the Player, Script Development Workbench, and Analyze
Transcription
Using the Player, Script Development Workbench, and Analyze
Usi n g t h e Pl ayer, Scri pt Devel opm en t W ork ben ch , an d An al yze Technical support is available from our Technical Support Hotline or via our FrontLine Support Web site. Technical Support Hotline: 1-800-538-7822 FrontLine Support Web Site: http://frontline.compuware.com This document and the product referenced in it are subject to the following legends: Access is limited to authorized users. Use of this product is subject to the terms and conditions of the user’s License Agreement with Compuware Corporation. © 1998-2009 Compuware Corporation. All rights reserved. Unpublished - rights reserved under the Copyright Laws of the United States. U.S. GOVERNMENT RIGHTS Use, duplication, or disclosure by the U.S. Government is subject to restrictions as set forth in Compuware Corporation license agreement and as provided in DFARS 227.7202-1(a) and 227.7202-3(a) (1995), DFARS 252.227-7013(c)(1)(ii)(OCT 1988), FAR 12.212(a) (1995), FAR 52.227-19, or FAR 52.227-14 (ALT III), as applicable. Compuware Corporation. This product contains confidential information and trade secrets of Compuware Corporation. Use, disclosure, or reproduction is prohibited without the prior express written permission of Compuware Corporation. Compuware, ActiveAnalysis, ActiveData, Interval, QACenter, QADirector, QALoad, QARun, Reconcile, TestPartner, TrackRecord, and WebCheck are trademarks or registered trademarks of Compuware Corporation. Acrobat® Reader copyright © 1987-2002 Adobe Systems Incorporated. All rights reserved. Adobe, Acrobat, and Acrobat Reader are trademarks of Adobe Systems Incorporated. This product includes software developed by the Apache Software Foundation (http:// www.apache.org/) This product includes software developed by Teodor Danciu (http://jasperreports.sourceforge.net) This product includes software developed by the University of California, Berkeley and its contributors. All other company or product names are trademarks of their respective owners. US Patent Nos.: Not Applicable. Tabl e Of Con t en t s QALoad On lin e Help ........................................................................................................................................ 1 W elcom e to QALoad ..................................................................................................................................... 2 Script Developm en t W orkben ch ............................................................................................................... 2 Con ductor .................................................................................................................................................. 2 Player .......................................................................................................................................................... 2 An alyze....................................................................................................................................................... 2 Gettin g Started............................................................................................................................................... 3 Th e Load Testin g Process........................................................................................................................... 3 Devel opin g Scripts ..................................................................................................................................... 4 Validatin g Scripts....................................................................................................................................... 4 How to Use th e On lin e Help ......................................................................................................................... 5 Com puware Custom er Support ..................................................................................................................... 6 Con tact In form ation .................................................................................................................................. 6 W orld W ide W eb In form ation .................................................................................................................. 6 ZipFile W izard ............................................................................................................................................ 6 Overview of th e ZipFile W izard ..................................................................................................................... 7 Accessibility Features..................................................................................................................................... 8 Accessibility of QALoad Com pon en ts ....................................................................................................... 8 Accessibility of QALoad Docum en tation ................................................................................................... 8 Assistive Tech n ology Tool s th at En h an ce th e Accessibility of QALoad .................................................... 9 Product Sh ortcut Keys................................................................................................................................ 9 Native Ch aracter Ch in ese, Japan ese, an d Korean Support ......................................................................... 13 Ch in ese, Japan ese, an d Korean Support in QALoad ................................................................................... 14 QALoad Glossary ...........................................................................................Er ror! Book m ar k n ot def i n ed. A .................................................................................................................Er ror! Book m ar k n ot def i n ed. B .................................................................................................................Er ror! Book m ar k n ot def i n ed. C .................................................................................................................Er ror! Book m ar k n ot def i n ed. D .................................................................................................................Er ror! Book m ar k n ot def i n ed. E..................................................................................................................Er ror! Book m ar k n ot def i n ed. F..................................................................................................................Er ror! Book m ar k n ot def i n ed. G.................................................................................................................Er ror! Book m ar k n ot def i n ed. H .................................................................................................................Er ror! Book m ar k n ot def i n ed. I ..................................................................................................................Er ror! Book m ar k n ot def i n ed. J..................................................................................................................Er ror! Book m ar k n ot def i n ed. K .................................................................................................................Er ror! Book m ar k n ot def i n ed. iii Usin g th e Player, Script Developm en t W orkben ch , an d An alyze L..................................................................................................................Er ror! Book m ar k n ot def i n ed. M ................................................................................................................Er ror! Book m ar k n ot def i n ed. N .................................................................................................................Er ror! Book m ar k n ot def i n ed. O.................................................................................................................Er ror! Book m ar k n ot def i n ed. P..................................................................................................................Er ror! Book m ar k n ot def i n ed. Q.................................................................................................................Er ror! Book m ar k n ot def i n ed. R .................................................................................................................Er ror! Book m ar k n ot def i n ed. S..................................................................................................................Er ror! Book m ar k n ot def i n ed. T .................................................................................................................Er ror! Book m ar k n ot def i n ed. U .................................................................................................................Er ror! Book m ar k n ot def i n ed. V .................................................................................................................Er ror! Book m ar k n ot def i n ed. W ................................................................................................................Er ror! Book m ar k n ot def i n ed. X .................................................................................................................Er ror! Book m ar k n ot def i n ed. Y .................................................................................................................Er ror! Book m ar k n ot def i n ed. Z .................................................................................................................Er ror! Book m ar k n ot def i n ed. Script Developm en t W orkben ch ................................................................................................................. 15 Overview of th e Script Developm en t W orkben ch ................................................................................... 15 ODBC M em ory Error Crash ..................................................................................................................... 15 Th e Script Developm en t W orkben ch M ain W in dow .............................................................................. 17 M en us an d Toolbar Button s .................................................................................................................... 17 Settin g Con version Option s .................................................................................................................... 18 Open in g a M iddleware Session ................................................................................................................ 19 Accessin g th e QALoad Script Developm en t W orkben ch ........................................................................ 19 Con figurin g th e Script Developm en t W orkben ch .................................................................................. 19 Im portin g Application Van tage Trace Files .............................................................................................. 20 Script Packagin g for Clien tVan tage ......................................................................................................... 20 Packagin g a Script .................................................................................................................................... 20 Usin g EasyScript Session s......................................................................................................................... 21 Devel opin g a Script ................................................................................................................................ 301 Player ......................................................................................................................................................... 319 Overview of th e QALoad Player ............................................................................................................. 319 In stallin g UNIX Players.......................................................................................................................... 319 Tran sferrin g Scripts to a UNIX Player .................................................................................................... 319 Validatin g Scripts in th e Player.............................................................................................................. 320 Player M ain W in dow ............................................................................................................................. 321 An alyze ...................................................................................................................................................... 324 Overview of An alyze .............................................................................................................................. 324 iv Table Of Con ten ts Accessin g An alyze .................................................................................................................................. 324 Un derstan din g Duration s ...................................................................................................................... 324 QALoad An alyze M en us an d Toolbar Button s....................................................................................... 325 Accessin g Test Data via Groups ............................................................................................................. 326 Accessin g Test Data................................................................................................................................ 327 Displayin g Detail Dat a........................................................................................................................... 327 Creatin g a Ch art or Graph ..................................................................................................................... 336 Viewin g Reports..................................................................................................................................... 341 Publish in g or Sh arin g Test Results......................................................................................................... 358 In dex ............................................................................................................................................................. 363 v QALo ad On l i n e Hel p 1 Usin g th e Player, Script Developm en t W orkben ch , an d An alyze W el co m e t o QALo ad W ith QALoad, you can si m ulate th e load gen erated by th ousan ds of users with out th e expen se of actual en d users or th eir equi pm en t. QALoad en ables you t o quickly devel op test scri pts, con trol th e con dition s for th e test, create th e virt ual users th at sim ulate th e load, in itiate an d m on itor th e test, an d report th e results. Th e followin g com pon en t s of QALoad con trol differen t aspects of th e load testin g process: Script Development Workbench Devel op your scri pts. Capture session s an d con vert th e tran saction s in to C++ or Java-based script. For m ore in form ation , see Overview of th e Script Developm en t W orkben ch . Conduct or Con trol session activity. In itiate an d m on itor th e test. For m ore in form ation , see Overvi ew of th e QALoad Con ductor. Player Sim ulate user activity based on com m an ds given from th e Con ductor. For m ore in form ation , see Overview of th e QALoad Player. Analyze View sum m ary report dat a an d create oth er statistical reports from th e test. For m ore in form ation , see Overview of QALoad An alyze. Before you begin usin g QALoad, you sh ould fam iliarize yourself with load testin g con cepts. For m ore in form ation , see Th e Load Testin g Process. 2 QALoad On lin e Help Get t i n g St ar t ed The Load Test ing Process You begin th e testin g process by determ in in g th e types of application tran saction s you wan t to em ulat e. You th en develop th ese tran saction s in to QALoad scripts by creatin g th e sam e types of requests th at your application s in voke on th e server. Each tran saction becom es its own scri pt. Th e QALoad Script Devel opm en t W orkben ch lets you easily create full-fun ction scripts. W h en you plan your test, you n eed to decide wh ich tran saction s to run , th e n um ber of sim ulated clien ts th at will run each tran sact ion script, an d th e frequen cy at wh ich each script will run . W h en you run th e test on a workstation with th e QALoad Player com pon en t, you can specify tran saction rates as well as fixed an d ran dom delays to better em ulate real-system act ivity. QALoad con siders th ese factors a test scen ari o an d stores th em in a session ID file. W h ile a test is run n in g, the test operator can dyn am ically view overall run tim es as well as in dividual tran saction perform an ce. QALoad's Con ductor com pon en t collects th is data for an alysis at th e con clusion of th e test. After executin g th e test, sum m ary reports sh ow th e respon se tim es th at th e em ulated clien ts experien ced durin g th e test. In dividual an d global ch eckpoin ts let you view an d iden tify specific areas of system perform an ce. You can export all test output data to spreadsh eet an d statistical packages for furth er an al ysis or use QALoad's An alyze com pon en t to create presen tation -quality reports an d graph s. As sh own in th e followin g im age, a typical load test setup con sists of a QALoad Con ductor, on e or m ore QALoad Players, an d th e system un der test. QALoad Con duct or QALoad's Con ductor con t rols all testin g activity such as settin g up th e session description files, in itiatin g an d m on itorin g th e test, an d reportin g an d an alyzin g test results. QALoad Pl ayer A QALoad Player creates virtual users th at sim ulate m ultiple clien ts sen din g m iddleware calls to a server un der test. In a typical test setup, on e or m ore QALoad Player workst ation s run un der an y W in dows 32-bit platform (W in dows XP or 2000) or UNIX. For large tests (th ousan ds of sim ulated clien ts), you can con n ect m ultiple Players to QALoad's Con ductor. Th e Con ductor an d Players com m un icate usin g TCP/ IP. Th e h ardware an d software capabilities of th e Player m ach in e are th e on ly fact ors th at lim it th e capacity of an in dividual QALoad Pl ayer. Th e m axim um n um ber of virtual users per Player m ach in e is depen den t on th e system un der test, th e ch aracteristics of th e scri pt, an d th e test scen ario. You can specify h ow m an y th readed- an d process-based virtual users to assign on a m ach in e in th e M ach i n es win dow of th e Opt i on s dialog box in th e Con ductor. Th e Con ductor calcul ates h ow m an y virtual users will be active per 64 M B of RAM , based on th e values you provide in th ese fields. For m ore in form ation , see M ach in es Dialog Box. Syst em Un der Test Th e servers you test are typically production system s or a duplicate of a production system th at is set up at a test facility. If you perform an y kin d of system selection or perform an ce stress test, th e system un der test m ust use th e sam e h ardware an d software (in cludin g curren t version s) as th e production en viron m en t. Com puware h as foun d th at even subtle ch an ges h ave profoun d effects on perform an ce. 3 Usin g th e Player, Script Developm en t W orkben ch , an d An alyze Developing Script s Use th e QALoad Script Developm en t W orkben ch to develop test scripts. It con tain s facilities for capturi n g session s, con vertin g captured session s in to scripts, an d m odifyin g an d com pilin g scripts. On ce you com pile your script, use QALoad's Con ductor an d Player com pon en ts to test your system . Record Faci l i t y: QALoad's Record facility, wh ich you can access th rough th e QALoad Script Devel opm en t W orkben ch , records th e tran saction s th at your term in al, browser, or clien t m akes. It stores th ese tran saction s in a capture file. Con vert Faci l i t y: QALoad's Con vert facility, wh ich you can access th rough th e QALoad Script Devel opm en t W orkben ch , con verts capture files in to scripts. It gen erates a on e-to-on e correspon den ce of tran saction s from th e origin al session to your QALoad scri pt. Vi sual Navi gat or: Visual Navigator for W W W is QALoad's easy-to-use visual in terface to QALoad's powerful script developm en t tools. Visual Navigator for W W W ren ders your recorded C++ -based tran saction in a tri-pan ed, browser-like en viron m en t sim ilar to popular visual ly-orien ted developm en t tools, with icon s represen tin g all th e elem en ts of your script. Validat ing Script s Before you con duct an act ual load test, you sh ould i n dividually validate th e script(s) you plan to use by run n in g a sim ple load test. If th e script run s to th e en d with out an y errors an d run s m ultiple tim es without errors, it is valid to use in a load test. If th e script aborts on an error, debug th e script an d run it th rough a sim ple test again . You can validate scripts from th e QALoad Script Developm en t W orkben ch , th e QALoad Player, or th e QALoad Con duct or: Validatin g a Script in th e Script Developm en t W orkben ch Validatin g a Script in th e Player Validatin g a Script in th e Con ductor 4 QALoad On lin e Help Ho w t o Use t h e On l i n e Hel p QALoad's on lin e h elp in cl udes a Table of Con ten ts (TOC), an in dex, an d a search in put field. W h en you click on a topic title in the TOC, th e topic appears in th e righ t-h an d pan e of th e on lin e h elp. Topics in cluded in th e Table of Con ten ts are syn ch ron ized with th e TOC. Th is m ean s th at wh en you click a topic lin k in th e righ t-h an d pan e, th e topic title is h igh ligh ted in th e TOC in th e left-h an d pan e. Use th e In dex tab to search for a specific referen ce by typin g a keyword in th e in dex en try field. Use th e Search tab to search for associated topics. Type a keyword in th e search en try field. All topics th at con tain th e keyword are listed. W h en you are workin g in QALoad, click th e H el p button on an in dividual di alog box or press F1 to view a description of each field i n th e dialog box. For th ese topics an d oth ers th at do n ot appear in th e Table of Con ten ts, th e syn ch ron ization fun ction with th e TOC is disabled. 5 Usin g th e Player, Script Developm en t W orkben ch , an d An alyze Co m p u w ar e Cu st o m er Su p p o r t At Com puware, we strive to m ake our products an d docum en tation th e best in th e in dustry. Feedback from our custom ers h elps us m ain tain our quality stan dards. If you n eed support services, please obtain th e followin g in form ation before callin g Com puware’s 24-h our product support h otlin e: ! Th e release (version ), an d build n um ber of your QALoad in stallation . Th is in form ation is displayed wh en you select th e About com m an d from an y QALoad com pon en t’s Help m en u. ! In stallation in form ation , in cludin g in stalled com pon en ts, wh eth er it is in stalled in th e default directories, an d so on . ! En viron m en t in form ation , such as th e operatin g system an d release on wh ich th e product is in stalled, m em ory, h ardware/ n etwork specification s, an d th e n am es an d releases of oth er application s th at were run n in g. ! Th e location of th e problem in th e QALoad software, an d th e action s taken before th e problem occurred. ! Th e exact QALoad error m essage, if an y. ! Th e exact application , licen sin g, or operatin g system error m essages, if an y. ! Your Com puware clien t, office, or site n um ber, if available. Cont act Informat ion Com puware Corporation On e Cam pus M artius Detroit, M I 48226-5099 (800) 538-7822 World Wide Web Informat ion To access Com puware Corporation ’s site on th e W orld W ide W eb, poin t your browser at h ttp:/ / www.com puware.com . Th e Com puware site provi des a variety of product an d support in form ati on . Front Line Support Web Sit e You can access on lin e tech n ical support for Com puware products usin g our Fron tLin e support W eb site. Fron tLin e provides fast access to critical in form ation about your QACen ter product. You can read or down load docum en tation , frequen tly asked question s, an d product fixes, or em ail your question s or com m en ts. To access Fron tLin e, you m ust first register an d obtain a password. To register, poin t your browser at h ttp:/ / fron tlin e.com puware.com . ZipFile Wizard You can use th e ZipFile W izard to tran sm it sm aller files to QALoad Tech n ical Support. Th is sim plifies th e task of collectin g th e files n eeded to assist you in resolvin g your problem . 6 QALoad On lin e Help Over vi ew o f t h e Z i p Fi l e W i zar d Th e ZipFile W izard sim pli fies th e task of collectin g th e files n eeded by th e Tech n ical Support team to an alyze an d resol ve a problem th at you m igh t be havin g with QALoad. It facilitates n avigation th rough QALoad’s in stallation so you can easily sel ect th e required files with out actual ly kn owin g wh ere th ey reside. On ce selected, th e files are collect ed an d com pressed in to a ZIP file th at option ally can be tran sm itted to th e QALoad Tech n ical Support team . 7 Usin g th e Player, Script Developm en t W orkben ch , an d An alyze Accessi b i l i t y Feat u r es Com puware is com m itted to com plian ce with Section 508 stan dards for accessibility in software products. Section 508 stan dards were en acted by Con gress in 1998 as an am en dm en t to th e Reh abilitation Act. Th e stan dards require federal agen cies to in crease th e accessibility of th eir electron ic in form ation to people with disabilities. Software th at is fully com plian t with Section 508 stan dards provides in form ation access to people with disabilities th at is com parable to th e in form ation access available to people with out disabilities. Software th at is com plian t with excepti on s, such as QALoad, provides support for m ost, but n ot all, criteria of com plian ce. Th is topic describes th e level of accessibility curren t ly available in QALoad, in cludin g th e product docum en tation . Accessibilit y of QALoad Component s All com pon en ts of QALoad — Script Developm en t W orkben ch , Con ductor, Player, an d An alyze — support th e basic criteria of accessibility for software applicat ion s. For m ost categories of com plian ce, th ere are exception s in wh ich assistive tech n ologies do n ot work in all situation s or th e altern ate m eth ods of in form ation retrieval or product fun ction are n ot al ways available. However, th e followin g basic accessibility features are available in QALoad: ! Product functions are executable from the keyboard ! The application does not disrupt or disable activated features of other products that are identified as accessibility features ! The product provides an on-screen indication of the current focus and the focus can be tracked by assistive technologies ! The identity, operation, and state of elements of the user interface are available to assistive technologies ! Textual information is provided through the operating system functions for displaying text ! The application does not override user-selected contrast and color selections ! Color-coding is not used as the only means of conveying information ! Electronic forms allow people using assistive technology to access the information, field elements, and functionality required for completion and submission of the form Accessibilit y of QALoad Document at ion Gen erally, th e QALoad docum en tation is accessible an d can be read by screen readers. Altern ate form ats of th e docum en tation are n ot curren tly available. Online Help QALoad's on lin e h elp syst em is HTM L-based an d can be read by screen readers. All graph ics in th e on lin e h elp h ave text description s. Topics in th e on lin e h elp can be prin ted. Release Not es Th e QALoad Rel ease Notes is an HTM L docum en t t h at can be read by screen readers an d prin ted. 8 QALoad On lin e Help Inst allat ion Guide Th e QALoad Installation and Configuration Guide is an accessible PDF-based book th at provi des text description s for im ages in addition to th e ability to be read by som e screen readers an d th e Read Aloud feature of Adobe Acrobat. To take advan tage of th e accessibility features in the In stallation Guide, you m ust h ave Adobe Acrobat Reader 6.0 or later. Th is book can be prin ted. Assist ive Technology Tools t hat Enhance t he Accessibilit y of QALoad Th ere are m an y th ird-part y assistive tech n ology tools th at you can use to access th e QALoad user in terface an d product docum en tati on by altern ate m ean s. Th ese products perform a variety of fun ction s, such as en largin g th e user in terface an d readin g text on th e in terface or in th e docum en tation . M an y features are available in W in dows, such as: ! Windows Narrator ! Windows accessibility wizard (includes features such as SoundSentry, ShowSounds, StickyKeys, and MouseKeys) ! Windows On-Screen Keyboard ! Microsoft Magnifier Refer to th e W in dows docum en tation to learn m ore about usin g th ese features. M ost oth er tools fall in to on e of th e followin g two categories: ! Screen readers: Software programs that present graphics and text as speech. A screen reader is used to verbalize, or "speak," everything on the screen including names and descriptions of control buttons, menus, text, and punctuation. (Example: JAWS for Windows by Freedom Scientific, Inc.) ! Screen enlargers (or screen magnifiers): Software that works like a magnifying glass on other applications. They enlarge a portion of the screen as the user moves the focus — increasing legibility for some users. Some screen enlargers allow you to zoom in and out on a particular area of the screen. (Example: ZoomText Magnifier by AI Squared) Product Short cut Keys Th e followin g tables list th e defin ed sh ortcut keys for each com pon en t of QALoad. You can use th ese key com bin ation s to open dialog boxes, start or stop processes, or in teract in oth er ways with QALoad with out usin g a m ouse. Script Development Workbench Sh ort cut Key Com bi n at i on Act i on CTRL+N Open th e New di alog box, from wh ich you can create n ew scripts or datapools. CTRL+O Open th e Open di alog box, from wh ich you can open various product files. CTRL+S Save th e active docum en t. CTRL+P Prin t th e active docum en t CTRL+Z Un do th e last action . CTRL+Y Redo th e last action . 9 Usin g th e Player, Script Developm en t W orkben ch , an d An alyze CTRL+X Cut. CTRL+C Copy. CTRL+V Paste. CTRL+F Fin d. CTRL+H Repl ace. CTRL+G Open th e Go t o Li n e dialog box, from wh ich you can go to a specific lin e n um ber in th e active script. CTRL+F2 Toggle bookm ark on / off. F2 M ove to n ext bookm ark. SHIFT+F2 M ove to previous bookm ark. CTRL+SHIFT+F2 Clear all bookm arks. CTRL+ALT+C Start a recordin g. CTRL+ALT+T Stop a recordin g. CTRL+ALT+R Restart a recordin g. CTRL+ALT+U Resum e a recordin g. F7 Com pile th e active script. CTRL+F5 Validate th e active scri pt. CTRL+T Open th e FTP Tran sf er di alog box, from wh ich you can sen d a file via FTP. F1 Open th e QALoad on lin e h elp. ALT+F4 Close th e Script Developm en t W orkben ch . Conduct or Sh ort cut Key Com bi n at i on Descri pt i on F1 Open th e QALoad on lin e h elp. CTRL+X Cut. CTRL+C Copy. CTRL+P Paste. ALT+F4 Close th e Con ductor. 10 QALoad On lin e Help Analyze Sh ort cut Key Com bi n at i on Descri pt i on CTRL+O Open a tim in g file. CTRL+P Prin t th e active docum en t . CTRL+C Copy Sum m ary an d Dat a selection s. CTRL+A Select all item s. CTRL+U Un select all item s. F1 Open QALoad on lin e h elp. ALT+F6 M ove to th e n ext tab in th e Data win dow. ALT+F4 Close An alyze. Player Sh ort cut Key Com bi n at i on Descri pt i on CTRL+N Clear an y curren t m essages from th e Player's m ain win dow. CTRL+S Save a text file of th e m essages reported by a QALoad Player durin g a test. CTRL+P Prin t Player output. CTRL+Z Un do th e last action . CTRL+X Cut. CTRL+C Copy. CTRL+V Paste. F1 Open QALoad on lin e h elp. ALT+F4 Close th e Player. To request a Volun tary Product Accessibility Tem plate (VPAT) or for m ore in form ation regardin g accessibility of QALoad or an y oth er Com puware product, see h ttp:/ / www.com puware.com / accessibility/ 11 Usin g th e Player, Script Developm en t W orkben ch , an d An alyze 12 QALoad On lin e Help Nat i ve Ch ar act er Ch i n ese, Jap an ese, an d Ko r ean Su p p o r t By default, QALoad tran sl ates Ch in ese, Japan ese, an d Korean (CJK) ch aract ers if you are usin g th e QALoad W orkben ch on th e sam e CJK lan guage operatin g system as th e operatin g system on wh ich th e W eb application is bein g captured. Th ere are n o option s to en able, but you m ay wi sh to en sure th at th e Represen t CJK as Oct al Ch aract ers option ch eck box is not selected. QALoad uses th e en codin g option wh en con vertin g a capture file con tain in g m ore th an on e set of Ch in ese, Japan ese, or Korean (CJK) lan guage ch aracters. Th e en codin g option also is used wh en con vertin g th e script on a CJK lan guage operatin g system differen t th an th e on e on wh ich th e application was captured. To verify or to override, t h is option is located on th e Con f i gurat i on Opt i on s dialog box in th e QALoad W orkben ch . Select Opt i on s>Con vert . Th e Con figuration Option s dialog box appears. Ch oose W W W >Con vert Opt i on s> Gen er al . Select th e Represen t CJK as Oct al Ch ar act ers ch eck box to overri de QALoad's Nati ve Ch aracter Support an d en able En coded Support. To take advan tage of QALoad's Native Ch aracter support, en sure th at th e ch eck box is n ot selected. If you capture a script from a W eb application th at con tain s CJK ch aracters, QALoad con verts th e capt ured tran saction in to a test scri pt. QALoad uses th e n ative ch aracters in th e docum en t title to create, for exam ple, DO_VerifyDocTitle() an d Begin Ch eckpoin t() fun cti on s m ean in gful to th e n ative ch aracter set. Th e sam e ch aracter con version logic is applied to DO_SetValue() an d all DO_Get<xxx> fun ction s such as DO_GetAn ch orHREF(). W h en usin g n ative ch aracters with in QALoad test scripts, th e resultin g tim in g files display ch eckpoin ts in th eir n ative lan guage. If you use n ative ch aracters i n an y oth er system fun ction th at produces an error m essage, you also see th e n ative ch aracters displayed in QALoad Con ductor's error m essage display as sh own below. Th is applies to fun ction calls like DO_VerifyDocTitle an d an y DO_Get<xxx> fun ction s that fail durin g test execution . W h en usin g en coded ch aracters in QALoad test scri pts, th e resultin g tim in g files do n ot display ch eckpoin ts in th eir n ative lan guage. 13 Usin g th e Player, Script Developm en t W orkben ch , an d An alyze Ch i n ese, Jap an ese, an d Ko r ean Su p p o r t i n QA Lo ad QALoad supports load testin g of Ch in ese, Japan ese, an d Korean (CJK) W eb application s th at use Double Byte Ch aracter Sets (DBCS). DBCS is a ch aracter set t h at uses two bytes (16 bits) rath er th an on e byte (8 bits) to represen t a sin gle ch aracter. Som e lan guages, such as Ch in ese, Japan ese, an d Korean , h ave writi n g sch em es with m an y differen t ch aract ers an d ch aracter sets th at can n ot be represen ted with sin gle-byte ch aracters such as ASCII an d EBCDIC. QALoad supports th e foll owin g: ! Simplified Chinese - People's Republic of China (PRC), Singapore ! Traditional Chinese - Taiwan, Hong Kong, Macau ! Japanese ! Korean Not es: CJK support only applies to the WWW middleware. Currently, QALoad only supports the CJK Double Byte Character Sets; Web applications that host Bi-Directional (BiDi) characters (which includes Arabic and Hebrew languages) are not currently supported. UTF-8-encoded characters are treated as an additional character set used on CJK platforms. They are supported when represented on their native operating system. For example, Japanese characters are displayed properly on a Japanese operating system. QALoad provides two m et h ods of support for CJK: n ative ch aracter an d en codin g. Depen din g on your testin g requirem en ts an d en viron m en t, it m ay be n ecessary to use both m ech an ism s to support th e load testin g of a W eb site th at con tain s CJK ch aracters. 14 ! Native Character: converts the CJK characters to their original characters in Chinese, Japanese, or Korean. Native character support is only possible when using a native operating system (OS) such as load testing a Japanese Web application from a Japanese version of Microsoft Windows. QALoad supports one CJK language's characters in a script at a time, plus ASCII/English. Native character support is used within test scripts, error messages (generated through system commands that use native characters) and timing files, making script editing easier and timing file analysis quicker. ! Encoding: encodes all CJK characters into a sequence of printable characters regardless of the language and exact character set in use. Encoding support is used when load testing multiple language sites from the same OS, or when load testing a CJK site from that of another CJK platform. For example, testing a site with Japanese characters from a Korean or English/ASCII OS. The encoding option is used when native character support cannot be used or when script portability between different CJK language OS is required. QALoad On lin e Help Scr i p t Devel o p m en t W o r k b en ch Overview of t he Script Development Workbench Th e QALoad Script Devel opm en t W orkben ch is th e QALoad com pon en t used to devel op load test script s. It con tain s th e facilities you n eed for recordin g tran saction s such as fun ction calls or request / respon se in teraction s placed by your W in dows application . Th e recorded tran saction , called a capture file, con tain s raw dat a th at m ust be con verted to an editable test script based on C++ or Java, depen din g upon wh ich m iddleware en viron m en t is un der test. After con vertin g th e recorded tran saction to a scri pt , you can use th e Script Developm en t W orkben ch 's script editor an d oth er fun ction ality to m ake an y n ecessary m odification s to your script. For exam ple, m aybe you h ad to sign on to a W eb server with a user n am e an d password as part of your recorded tran saction . At test tim e, wh en m ultiple virtual users are run n in g your test script, you m igh t wan t each user to h ave a differen t user n am e/ password com bin ation . You can use th e Script Developm en t W orkben ch to create a re-usable pool of user n am e/ password com bin ation s, saved as a dat apool file, an d edit your script to extract values from th at file at test tim e. QALoad provi des scriptin g com m an ds for situation s l ike th at, an d provides a Fun ct ion W izard an d on lin e lan guage referen ce, both available righ t from th e editor, to h elp you locate an d in sert th e righ t com m an ds. W h en you are satisfied wi th your test script, you can com pile it directly from th e Script Developm en t W orkben ch . An d, fin ally, add it to a load test in th e QALoad Con ductor. In sh or t , t o p r od uce a usab l e t est scr i p t you: 1. Record a transaction into a capture file (.cap). 2. Convert the capture file to an editable script. 3. Edit the script. 4. Compile the script. ODBC M emory Error Crash W h en ever a user-started capture is in itiated, QALoad appears to begin capturi n g, but as soon as th e program to capture again st it is started, a m em ory exception is en coun tered. Th e followin g error is n ot en coun tered im m edi ately. It m ay n ot occur un til you attem pt to click on som eth in g or perform som e sort of activity on your m ach in e. Application popup: explorer.exe - Application Error : The instruction at "0x1001ee30" referenced memory at "0x1001ee30". The memory could not be "written". To f i x t h e ODBC m em or y er r or cr ash : If you are run n in g W in dows XP Pro SP2, perform th e followin g steps: 1. Right-click on My Computer and select Properties. The System Properties dialog box appears. (If your My Computer is not available, access Control Panel>System.) 2. Select the Advanced tab, then click Settings in the Performance group box. 15 Usin g th e Player, Script Developm en t W orkben ch , an d An alyze 3. On the Performance Options dialog box, select the Data Execution Prevention tab. Make sure that Turn on DEP for all programs…” is selected. 4. 16 Click Add, then navigate to select the following applications: QALoad On lin e Help a. <systemroot>\explorer.exe b. <systemroot>\system32\rundll32.exe 5. Click OK for any warnings that appear. 6. Click OK on the Performance Options dialog box to save your changes and close the dialog box. The Script Development Workbench M ain Window Th e QALoad Script Devel opm en t W orkben ch m ain win dow is divided in to dyn am ic pan es th at you can h ide or sh ow as n eeded by selectin g com m an ds from th e View m en u. Hint : Click on a pane in the following graphic for a description of that pane. Use your scroll bars to see the rest of the graphic. M enus and Toolbar But t ons Th e QALoad Script Devel opm en t W orkben ch m en us an d button s ch an ge depen din g on wh eth er you h ave an EasyScript Session open . 17 Usin g th e Player, Script Developm en t W orkben ch , an d An alyze M enus and Toolbars wit hout an Open EasyScript Session Th e followin g m en us an d toolbars are available wh en an EasyScript Session is n ot open . File View Option s Session Tools Help Toolbar Button s M enus and Toolbars wit h an Open EasyScript Session Th e followin g m en us an d toolbars are available wh en an EasyScript Session is open . File Edit View Option s Session Tools W in dow Help Toolbar Button s Recordin g Toolbar Set t ing Conversion Opt ions Before you begin recordin g, you can set option s to autom atically custom ize your script durin g con versi on . Com puware recom m en ds you set con version option s before recordin g, th en use th e option to autom atically con vert your capture files to scripts. 1. Access the Script Development Workbench. 2. From the Session menu, select the appropriate middleware or start a Universal session. 3. Select Options>Convert to open the appropriate Convert Options dialog box. 4. Choose General>Convert Options from the options tree and set any applicable options. This tree-view contains common options that apply to all the middleware environments QALoad supports. 5. Click the middleware-specific convert options in the Session Options tree, and set any appropriate middlewarespecific options. Not es: 6. For th e Citrix W eb In terface en viron m en t, you m ust select option s in both th e Citrix Con vert Option s an d th e W W W Con vert Option s in th e tree view. For WWW, refer to Using the WWW Convert Options. When you are finished, click OK to save the current settings. Hint : Press F1 from any middleware options tab for a description of available options. 18 QALoad On lin e Help Opening a M iddleware Session To access t h e Scr i p t Devel op m en t W or k b en ch an d op en a m i d d l ew ar e sessi on : 1. Click Start>Programs>Compuware>QALoad\Script Development Workbench. 2. Choose the m iddleware nam e from the Sessi on m enu or by click the appropriate button on the toolbar. The Def aul t Sessi on Prom pt opens. Not e: If this middleware type should be the default every time you open the Script Development Workbench, select the check box M ake t his my default session. If you do not want to be prompted to set a default middleware, clear the Enable default session checking check box. You can also turn default session checking on or off from the Configure Script Development Workbench dialog box at any time. 3. Click OK. The Default Session Prompt Did Not Open? If th e Default Session Prom pt fails to open wh en you start a m iddleware session , th en default session ch eckin g was previously disabled. Do th e followin g to en able default session ch eckin g: 1. From the Options menu, choose Workbench. The Configure QALoad Script Development Workbench dialog box opens. 2. On the Workbench Configuration tab, select the Enable default Session checking check box. Th e n ext tim e you open a QALoad Script Devel opm en t W orkben ch m iddleware session , you are prom pt ed to m ake it your default session . Accessing t he QALoad Script Development Workbench To access t h e Scr i p t Devel op m en t W or k b en ch : 1. From the Windows taskbar, click the Start button. 2. Choose Programs>Compuware>QALoad>Script Development Workbench. Configuring t he Script Development Workbench Th e first tim e you use th e QALoad Script Devel opm en t W orkben ch , you sh ould set option s to det erm in e a workin g directory QALoad can use for tem porary fi les, com piler settin gs, an d oth er gen eral option s rel ated to th e beh avior of th e QALoad Script Developm en t W orkben ch . To con f i g ur e t h e Scr i p t Devel op m en t W or k b en ch : 1. Access the Script Development Workbench. 19 Usin g th e Player, Script Developm en t W orkben ch , an d An alyze 2. From the Session menu, choose the session you want to start. 3. From the Options menu, choose Workbench. 4. Set any appropriate options. For a description of the available options, press F1 from the Configure Script Development Workbench dialog box. Not e: Compuware recommends that you always select Aut omat ically Convert Capt ure on the Record Options page and Aut omat ically Compile Script s on the Convert Options page. 5. Click OK to save your settings. Import ing Applicat ionVant age Trace Files Con vert Application Van t age trace files to QALoad W W W or W in sock capture files for use in W W W visual scripts or W in sock scri pts. Th is allows you to use Application Van t age-captured n etwork traffic as W W W an d W in sock session s in QALoad to run m ultiple virtual user load tests. To i m p or t Ap p l i cat i on Van t ag e t r ace f i l es: 1. Open the QALoad Script Development Workbench. 2. Choose Tools>Import>ApplicationVantage Trace. The Import ApplicationVantage Trace dialog box appears. 3. Type file location or browse to the ApplicationVantage trace file. 4. Select WWW or Winsock to capture file type. 5. Click Import. QALoad converts the ApplicationVantage trace file to the selected capture file type. Results display in the Results field. At this time, the .cap files are generated but are not converted to scripts. 6. Manually Convert the imported capture files into scripts. Script Packaging for Client Vant age Clien tVan tage users m ust verify th at version s of scri pts an d Player software located on each agen t m ach in e are com patible. W h en disparities exist, for exam ple, wh en production system s are upgraded, th e test scri pts used to m on itor th e en d-user experien ce also m ust be updated. QALoad's Package Script fun ction en ables you to sel ect a QALoad script, verify th at it is up-to-date, an d th en package it in a zip fil e th at you can tran sfer t o Player m ach in es in an y location . Th e Package Script utility autom atically determ in es an d in cludes all associated files, such as datapools an d bin ary files, th at are required to run th e script. Th e zip file con tain s th e script, its auxiliary files, an d a m an ifest file th at lists th e packaged files an d th e m iddleware th e script uses. Not e: You must compile scripts before placing them in the zip file. Packaging a Script Use th is procedure to select a QALoad script an d package it an d all its associ ated files in to a zip file. For exam ple, you can tran sfer th e zip file to a Player m ach in e for use by Clien tVan tage. To sel ect a scr i p t : 1. 20 Open a session in the Script Development Workbench. QALoad On lin e Help 2. Select a script in the Workspace pane and click File>Package Script. The Package Scripts dialog box appears with the script you selected displayed in the Script File field. Not e: You can open the Package Scripts dialog box before choosing a script, then click Browse to open the Select Script File to Package dialog box and select the script. To p ack ag e t h e scr i p t : 1. In the Package Scripts dialog box, click Package. The Select Package Directory and Name dialog box appears. 2. Click the down arrow in the Save in field to select the directory where you want to save the zip file. The default directory provided is Program Files\Compuware\QALoad. 3. In the File name field, type a name for the zip file. The default name provided is the name of the script. 4. Click Save. The zip file is created and saved in the directory you selected. The Package Scripts dialog box displays. Not e: You can only package compiled scripts. If you try to use the Package Scripts utility on an uncompiled script, an error message appears. You must exit the Package Scripts dialog box, compile the script, and start the script packaging process again. 5. Select another script to package, or click Close. To un p ack ag e t h e scr i p t : To un package th e script, access th e Van tage Con sole in Clien tVan tage wh ere you can publish th e script. For m ore in form ation on h ow to use th e Van tage Con sole, refer to th e on lin e h elp in Clien tVan tage. Using EasyScript Sessions Using t he Universal Session Th e Un iversal session allows you to record calls from m ultiple m iddleware application s with in a sin gle Script Developm en t W orkben ch session . You m igh t use th e Un iversal session in cases wh ere your application accesses an addition al application th at uses a differen t prot ocol. For exam ple, your browser m igh t down load an d open a Java applet wh ich th en com m un icates with a W in sock server. If you recorded th at activity usin g a sim ple W W W session , th e Script Developm en t W orkben ch would on ly record th e HTTP requests th at down loaded an d open ed th e Java applet. Recordi n g th at tran saction with th e Un iversal session en sures th at you record th e HTTP requests from th e browser as well as th e W in sock-based com m un ication between th e Java applet an d th e W in sock server — all with in a sin gle script. You start an d record from a Un iversal session exactl y like a sin gle m iddleware session with on e differen ce — after startin g a Un iversal session you m ust select wh ich m iddleware application s to record. Cit rix Overview Use QALoad's Citrix m iddleware to load test system s th at run Citrix M etaFram e or Citrix M etaFram e X P. 21 Usin g th e Player, Script Developm en t W orkben ch , an d An alyze W h at i s Ci t ri x ? Citrix m iddleware is a com m un ication layer th at provides rem ote access to W in dows system s. Th e rem ote system appears in a win dow on th e local system . Con n ect i n g t o t h e rem ot e syst em On ce con n ect ed to a m ach in e th at is run n ing th e M etaFram e server, log in to th e rem ote system an d run application s. Altern atively, specify an application in addition to a user n am e an d password, wh ich provi des access on ly to th e specified application an d m in im izes user in put th at is n ecessary to access th e application un der test. Test th e en viron m en t usin g th e W in dow Citrix Clien t to start a Citrix session . Test i n g i n l oad-bal an ced en vi ron m en t s If testin g an en viron m en t th at in cludes a server farm , use Citrix ICA files to support th is type of con figuration . Specify th e ICA file on th e Citrix Record Option s dial og box. ICA files are also n ecessary for en cryption . ICA files are gen erated on th e M etaFram e server an d can be obt ain ed from your M et aFram e adm in istrator. For m ore in form ation about usin g ICA files, see Usin g ICA files. W h en ICA files are n ot provided by an application , specify con n ection in form ation usin g th e Publish ed Application s or th e Sin gle Server option s in th e Citrix Record Option s dialog box. Th ese option s also en able you to specify lists of publish ed application s an d servers to in voke wh en you log on to th e Citrix clien t session . Test i n g usi n g t h e Ci t ri x W eb I n t er f ace W h en you in itiate Citrix-publish ed application s usi n g a web browser, you can capture an d pl ayback scripts in QALoad usin g th e Citrix W eb In terface. Th e Citrix W eb In terface starts a Un iversal session with th e Citrix an d W W W m iddlewares selected. Th e W W W m iddleware in tercepts th e ICA file created by th e web server. It passes dat a to an d from th e Citrix Server durin g th e capture process, en ablin g you to test th e perform an ce of application s th at are avail able th rough in tern et con n ection s. Wait Points in Citrix Scripts W h en m ouse m ove con solidation is en abled via th e Com bin e M ouse In put option on th e Con vert Opt ion s dialog box, n ot all even ts th at were captured appear durin g replay. As a result, th e placem en t of wait poi n ts for win dow m oves an d wi n dow resizin g is im portan t. W h en a win dow is m oved on th e desktop, a win dow m ove even t is created for each m ouse m ove. However, durin g replay of a con solidated script, on ly on e m ouse m ove is m ade (to t h e fin al destin ation ), an d subsequen tly on ly on e wi n dow m ove even t occurs. Because of th is con solidat ion of con secutive m ouse an d win dow m oves, th e CtxWaitForWindowMove com m an d in your script sh ould target th e fin al win dow m ove in th e series. Th is issue also applies to th e CtxWaitForWindowResize com m an d an d th e resizin g of win dows on th e desktop. If a win dow's title ch an ges wh ile th e win dow is bein g created (such as a browser win dow's title bar ch an gin g on ce th e default W eb page begin s to load), th e CtxWaitForWindowCreate com m an d m ay tim e out. If th is occurs, rem ove th e wait poin t or in sert a CtxWaitForScreenUpdate com m an d to preserve t h e wait in th e script. Recording Citrix Scripts for Restricted Desktops W h en recordin g a Citrix script on a restri cted deskt op, you m ust take extra st eps to en sure proper pl ayback. Dyn am ic win dows m ay be created an d destroyed with n o user in teraction at both logon an d logoff. To preven t un expected results durin g playback, do n ot click on an y of th ese dyn am ic win dows. For exam pl e, th e script m igh t attem pt to click on a destroyed win dow or a win dow th at h as n ot been created yet. Th e appearan ce of dyn am ic win dows often depen ds on t h e speed of th e server or th e load on th e farm durin g playback. 22 QALoad On lin e Help Performance issues with SAP or Citrix scripts If you experien ce perform an ce issues with SAP or Citrix scripts, in crease your system pagin g file size to a fixed size of at least four tim es th e am oun t of RAM on th e m ach in e. About the Citrix Web Interface Capture an d playback scri pts for Citrix application s accessed th rough a web browser usin g th e Citrix W eb In terface. Th is starts a Un iversal session for both th e Citrix an d W W W m iddlewares, wh ich en ables th e W W W m iddleware to pass in form ation to an d from th e Citrix server. W h en selectin g a publish ed application th rough a web browser, th e request i s sen t to th e web server. Th e web server creat es an ICA file for th e requested appli cation an d return s it to th e web browser. W h en th e web browser fin ds an associated application to h an dle th e ICA file, th e Citrix clien t starts th e publish ed application requested. Th e ICA file used durin g th e capture process is saved in QALoad\Middlewares\Temp. Not e: Only the first ICA file received by the web browser is recorded. Th e con verted script con t ain s both Citrix an d W W W fun ction s. A n ew variable, char* strICAFileName[N], is declared at th e top of th e script. All allocated m em ory is released at th e en d of th e script. Accessing a Citrix Session Use on e of th e followin g m eth ods to begin recordi n g a Citrix session . To access a Ci t r i x Cl i en t sessi on : ! From th e Sessi on m en u, click Ci t ri x >W i n dow s Cl i en t . OR ! On th e toolbar, select th e down arrow n ext to th e Ci t ri x button on th e toolbar, th en select W i n dow s Cl i en t . To access t h e Ci t r i x W eb In t er f ace w h en sel ect i n g a Ci t r i x sessi on : ! From th e Sessi on m en u, click Ci t ri x >W eb I n t erf ace. OR ! On th e toolbar, click th e down arrow n ext to th e Ci t ri x button , th en select W eb I n t er f ace. Th e Un iversal session starts with both th e Citrix and W W W m iddlewares selected. In th e Citrix tab, W eb In terface is select ed i n th e Type field. To access t h e Ci t r i x W eb In t er f ace f r om a Un i ver sal sessi on : 1. On the toolbar, click Session>Universal or click the Universal button on the toolbar. 2. Click Options>Record. The Universal Record Options dialog box appears. 3. In the Middleware Selection pane, select WWW, then select Citrix. The Universal Record dialog box displays both a WWW tab and a Citrix tab. In the Citrix tab, Web Interface is selected in the Type field. 23 Usin g th e Player, Script Developm en t W orkben ch , an d An alyze Recording a Citrix Session To begin recordin g a Citrix session , select th e down arrow n ext to th e Ci t ri x button on th e toolbar, th en do on e of th e followin g procedures below. Tips: It is recommended not to use the Caps Lock key during Citrix session capture and replay. During capture, either use the Shift key or modify the script to use uppercase characters. During replay, the Caps Lock key may interfere with replayed keystrokes. Similarly, the Windows Logo key is not supported. Do not use the Windows Logo key to start applications while recording a Citrix script. To b eg i n r ecor d i n g a Ci t r i x Cl i en t sessi on : 1. Select Windows Client to activate a new Citrix session. 2. From the toolbar, select Options>Record, and select the appropriate options. 3. Click Record on the Session toolbar. Th e Citrix capture application appears, as sh own in th e followin g im age. Click th e th ree section s of th e im age to learn m ore about th e fields an d th e in form ation th at is displayed i n each area. 24 QALoad On lin e Help To b eg i n r ecor d i n g usi n g t h e Ci t r i x W eb In t er f ace: 1. Select Web Interface to activate Universal session for the Citrix Web Interface. 2. Click Record on the Session toolbar. The Universal Record Options dialog box displays. 3. Select the appropriate options, then click Start Record. Setting Citrix Convert Options To set con ver si on op t i on s f or Ci t r i x Cl i en t sessi on : 1. Ch oose Opt i on s>Con vert in th e Script Developm en t W orkben ch toolbar. Th e Session Option s dialog box appears. 2. Select th e appropriate opt ion s, th en click OK. To set con ver si on op t i on s f or Ci t r i x W eb In t er f ace sessi on : 1. Choose Options>Convert in the Script Development Workbench toolbar. The Session Options dialog box appears with both Citrix and WWW selected. 2. Click the Session Options tab. 3. Under Convert Options, click Citrix Convert Options. 4. Select the appropriate options, then click OK. Not e: Durin g th e con versi on process for both Clien t an d W eb In terface session s, calls to th e CtxSetWindowTitle m eth od are som etim es pl aced at an in correct lin e in th e script. Determ in e th e correct lin e by in spectin g th e capture file an d m ovi n g th e call to th at position in th e script. Th e CtxSetWindowTitle m eth od is added by QALoad durin g con version an d sh ould oth erwise n ot be m odified or m an ually added to a scri pt. Inserting Screenshots in the Citrix Script Durin g th e Citrix session , you can take a screen sh ot of th e con ten ts of th e con n ection win dow. Th is in serts a wait poin t in th e script for th e screen sh ot you sel ect an d saves th e im age as a bitm ap. You can select: ! Insert Wait for Full Screenshot - Inserts a wait point based on a full screenshot of the current display. ! Insert Wait for Partial Screenshot - Inserts a wait point based on a partial screenshot of the current display. ! Save Current Screenshot - Saves a screenshot of the current display to a bitmap file. Not e: Images are saved to \ QALoad \Middlewares\Citrix\Captures\screenshot. To i n ser t a f ul l scr een sh ot i n t o t h e Ci t r i x scr i p t : 1. In the Citrix Capture dialog box, click Screenshots>Insert Wait for Full Screenshot. The Screen Capture Preview screen displays the image. 2. Click Finish to confirm the screenshot. The Specify Screenshot Name dialog box displays with a list of all previously saved screenshots. 3. In the Name field, type a descriptive name for the image. 4. Click OK. The image is saved as a bitmap and a wait point for the screenshot is inserted into the script. 25 Usin g th e Player, Script Developm en t W orkben ch , an d An alyze To i n ser t a p ar t i al scr een sh ot i n t o t h e Ci t r i x scr i p t : 1. In the Citrix Capture dialog box, click Screenshots>Insert Wait for Partial Screenshot. The selected screen displays with the message "Select a rectangular region of the screenshot you want to insert." 2. Hold down the left mouse button and drag the cursor across the screen to select the region to save. The Screen Capture Preview screen appears with the image you selected. 3. Click Finish. The Specify Screenshot Name dialog box appears with a list of all previously saved screenshots. 4. In the Name field, type a descriptive name for the image. 5. Click OK. The image is saved as a bitmap and a wait point for the screenshot is inserted into the script. To save t h e cur r en t scr een : 1. In the Citrix Capture dialog box, click Screenshots>Save Current Screenshot. The Screen Capture Preview screen displays. 2. Click Finish. The Specify Screenshot Name dialog box displays with a list of all previously saved screenshots. 3. In the Name field, type a descriptive name for the image. 4. Click OK. The image is saved as a bitmap. Using ICA files ICA files, wh ich are gen erated on th e M etaFram e server, con t ain con figuration option s for Citrix. You can specify an ICA file on th e Citrix Record Option s di al og box. ICA files are specified in t h e script with th e CtxSetICAFile com m an d. If an ICA file is specified, th e call is gen erated with an un qualified file n am e. For exam ple: CtxSetICAFile("customapp.ica"); Not e: The file name is not fully-qualified because the file may not exist in the same location among the remote Player machines. To validat e th e script on t h e sam e m ach in e on wh ich it was captured, copy th e ICA file to th e QALoad\BinaryFiles directory. To use th e ICA file on rem ote Player m ach in es, th e ICA file sh ould be specified as an Attach ed File in th e Extern al Data page of th e Script Properties dialog box. Th is also displays in th e Extern al Data area of th e Script Properties dialog box in th e Con ductor. Citrix Command Reference QALoad provides descri ption s an d exam ples of th e various com m an ds available for a Citrix script. For details, refer to th e Lan guage Referen ce Help section for Citrix. Desktop Screen Resolution When Recording Citrix Scripts To en sure th at th e en tire Citrix in terface is visible durin g recordin g, set th e Resolution field in th e Citrix recordin g option s to a lower value th an th at of th e desktop. Also, th e screen resolution m ust be th e sam e as th e screen resolution specified in th e Citrix ICA file. Citrix Script Samples Ci t ri x Scri pt Sam pl es You can address specific si tuation s or resolve certain problem s by m odifyin g con verted Citrix scripts. 26 QALoad On lin e Help Tips: Uppercase characters are not captured when the CAPS Lock key is on. Manually modify the script to use uppercase characters or hold down the SHIFT key during recording. Similarly, the Windows Logo key is not supported. Do not use the Windows Logo key to start applications while recording a Citrix script. Th e scripts listed below in clude a description of th e problem , th e procedure for im plem en tin g th e m odification , an d sam ples of a m odified scri pt. Han dlin g Citrix Server Farm s Han dlin g Dyn am ic W in dow Titles Han dlin g In term itten t W in dows Han dlin g Un expected Even ts M ovin g Citrix Con n ect an d Discon n ect Outside th e Tran saction Loop Scriptin g M ouse Action s Usin g th e CtxW aitForScreen Update Com m an d Flush in g Past Even ts from th e In tern al Queue Ci t ri x Server Farm s Han dlin g Citrix Server Farm s Citrix servers can be grouped in farm s. W h en load t estin g, you m ay wan t to con n ect to a Citrix server farm rath er th an to a specific server. Load testin g requirem en ts m ay in clude con n ectin g to a Citrix server farm , wh ere th e load balan cin g feature supports dyn am ic redirection to a given server at con n ection tim e. Th is load tests th e server farm an d Citrix load balan cin g rath er th an a sin gle server, wh ich can provide a m ore realistic load test. To record a scri pt th at con n ects to a farm , you m ust use an ICA file to con n ect. However, wh en a capt ure takes place, a specific server (in th e farm ) m ust h ave a con n ection . Specify th e correct ICA file to con n ect to th e server farm as well as a specific server with in th at server farm . To verify th at your script i s con n ectin g to a server farm an d n ot a specific server, assign th e server n am e to on e blan k space wh en validatin g th e script. In order to record a scri pt th at con n ects to a farm , you m ust use an ICA file specified i n th e Citrix Record Option s dialog. Sin ce th e ICA file sh ould con tain all th e n ecessary con n ection in form ation , th e server field sh ould be left blan k wh en recordin g. W h en con verted, th e CitrixServer variable h as a blan k space: . . . /* Declare Variables */ const char *CitrixServer const char *CitrixUsername const char *CitrixPassword const char *CitrixDomain const int CitrixOutputMode = = = = = " "; "citrix"; "~encr~657E06726F697206"; "qacitrix2"; OUTPUT_MODE_NORMAL; . . . SET_ABORT_FUNCTION(abort_function); DEFINE_TRANS_TYPE("Orders.cpp"); CitrixInit(4); 27 Usin g th e Player, Script Developm en t W orkben ch , an d An alyze /* Citrix replay settings */ CtxSetConnectTimeout(90); CtxSetDisconnectTimeout(90); CtxSetWindowTimeout(30); CtxSetPingTimeout(20); CtxSetWaitPointTimeout(30); CtxSetWindowVerification(TRUE); CtxSetDomainLoginInfo(CitrixUsername, CitrixPassword, Citrix-Domain); CtxSetICAFile("PRD desktop.ica"); CtxSetEnableCounters(TRUE); CtxSetWindowRetries(5, 5000); CtxSetEnableWildcardMatching(TRUE); SYNCHRONIZE(); Th e Citrix clien t ign ores th is value an d uses th e ICA file to dyn am ically retrieve th e server n am e at playback tim e. Conclusion W h en you use th ese tech n iques to set up a Citrix server farm test scri pt, you allow for dyn am ic server redirection at playback as part of testin g a load balan ced Citrix server farm . Sam ple Script for Han dlin g Citrix Server Farm s Th e followin g sam ple sh ows a sn ippet of a Citrix script th at sets up a server farm test script. Sample Script /* Converted using the following options: * General: * Line Split : 80 characters * Sleep Seconds : 1 * Auto Checkpoints : No * Citrix * General Options : * Replay Output Mode : Normal * Enable Counters : No * Timeout Value Options : * Connect Timeout (s) : 60 * Disconnect Timeout (s) : 60 * Window Creation Timeout (s) : 30 * Ping Timeout (s) : 20 * Wait Point Timeout (s) : 30 * Input Options : * Combine Keyboard Input : Yes * Combine Mouse Input : Yes * Window Options : * Window Verification : Yes * Window Max Retries : 5 * Window Wait Retries (ms) : 5000 * Enable Wildcard Title Match : Yes */ #define CITRIX_CLIENT_VERSION "8.100.29670" #define CITRIX_ICO_VERSION "2.4" #define SCRIPT_VER 0x00000505UL #include <stdio.h> #include "smacro.h" #include "do_citrix.h" 28 QALoad On lin e Help /* set function to call on abort*/ void abort_function(PLAYER_INFO *s_info); #ifndef NULL #define NULL #endif 0 extern "C" int rhobot_script(PLAYER_INFO *s_info) { /* Declare Variables */ /////////////////////////////////////////////////////////// /// Convert sets the Citrix server name to a single blank /// space. This is only necessary to verify that the script actually is connecting to a server farm. /////////////////////////////////////////////////////////// const char *CitrixServer = " "; const const const const char *CitrixUsername char *CitrixPassword char *CitrixDomain int CitrixOutputMode = = = = "test"; "~encr~657E06726F697206"; "test"; OUTPUT_MODE_NORMAL; /* Citrix Window Information Objects */ CtxWI *CWI_1 = new CtxWI(0x1001c, "Warning !!", 107, 43, 427, 351); CtxWI *CWI_2 = new CtxWI(0x5001c, "Please wait...", 111, 112, 418, 145); CtxWI *CWI_3 = new CtxWI(0x40030, "Citrix License Warning Notice", 125, 198, 397, 127); CtxWI *CWI_4 = new CtxWI(0x4002e, "UsrLogon.Cmd", 0, 456, 161, 25); CtxWI *CWI_5 = new CtxWI(0x1003a, "", -2, 452, 645, 31); CtxWI *CWI_6 = new CtxWI(0x10066, "ICA Seamless Host Agent", 0, 0, 391, 224); CtxWI *CWI_7 = new CtxWI(0x10052, "Program Manager", 0, 0, 641, 481); CtxWI *CWI_8 = new CtxWI(0x1008c, "", 115, 0, 405, 457); CtxWI *CWI_9 = new CtxWI(0x2006c, "Calculator", 66, 66, 261, 253); SET_ABORT_FUNCTION(abort_function); DEFINE_TRANS_TYPE("capCtxServerFarm.cpp"); CitrixInit(1); /* Citrix replay settings */ CtxSetConnectTimeout(60); CtxSetDisconnectTimeout(60); CtxSetWindowTimeout(30); CtxSetPingTimeout(20); CtxSetWaitPointTimeout(30); CtxSetWindowVerification(TRUE); CtxSetDomainLoginInfo(CitrixUsername, CitrixPassword, CitrixDomain); CtxSetICAFile("PRD desktop.ica"); CtxSetEnableCounters(FALSE); CtxSetWindowRetries(5, 5000); CtxSetEnableWildcardMatching(TRUE); SYNCHRONIZE(); …rest of script… Dyn am i c W i n dow Ti t l es Dyn am ic W in dow Titles Som e application s create win dows wh ose titles vary depen din g on th e state of th e win dow. For exam ple, M icrosoft W ord creates a t itle based on th e default docum en t n am e at th e tim e of th e win dow creation . Oth er win dow titles m ay con tain th e user’s n am e, or th e day or tim e. W h en a win dow n am e in th e record session varies from th e n am e in a validation or playback session , th e script fai ls with a win dow title m ism atch error. 29 Usin g th e Player, Script Developm en t W orkben ch , an d An alyze W h en th is error occurs durin g validation or pl ayback, you m ust m odify th e script to recogn ize th e base pattern of th e win dow title n am e rath er th an an exact win dow title. M odifyin g th e Script to Han dle Dyn am ic W in dow Titles W in dow titles can vary based on th e state of th e application . For exam ple, M icrosoft W ord win dows m ay appear with th e n am e of a default docum en t title as part of th e win dow n am e. Oth er win dow titles m ay con tain th e user’s n am e, or th e day or tim e. W h en a win dow n am e in th e record session varies from t h e n am e in a validation or pl ayback session , th e script fails with a win dow title m ism atch error. W h en th is error occurs durin g validation or pl ayback, you m ust m odify th e script to recogn ize th e base pattern of th e win dow title n am e rath er th an an exact win dow title. You can do th is durin g con version by addin g CtxW aitForW in dowCreate calls to th e script for each n am ed win dow creation even t. W h en you m odify a script for th ese occurren ces, you m ust: ! Modify the recording process ! Perform an initial validation ! Identify a Match Pattern ! Modify the script ! Revalidate the script Not e: You may need to configure the workbench and player for validation. To m od i f y t h e r ecor d i n g p r ocess: 1. Record th e Citrix session with th e proper option s selected. 2. Click Opt i on s>Con vert , t h en click th e Ci t ri x tab. 3. En sure th at th e En abl e W i l dcard Ti t l e M at ch ch eck box is selected. 4. Click OK to con vert th e recordin g. To p er f or m an i n i t i al val i d at i on af t er scr i p t r ecor d an d con ver si on : 1. Click Session>Validate Script. 2. W h en th e validation sessi on gen erates th e win dow title m ism atch error, com pare th e actual win dow title n am e to th e expected win dow title n am e. Not e: Repeated validations should generate a list of one or more window titles that differ from the expected title. To p er f or m a M at ch Pat t er n i d en t i f i cat i on : Iden tify a m atch pattern t h at com pares all actual wi n dow titles to origin al win dow titles usin g th e list of win dow titles from validation s. Not e: This regular-expression style match pattern uses the normal character set. Asterisks (*) denote 0 to n wildcard characters. Question marks denote one wildcard character. To m od i f y t h e scr i p t : M ake th e script ch an ges wh en you iden tify a workable m atch pattern for th e dyn am ic win dow. 30 QALoad On lin e Help 1. In th e script, en sure th at th e Ct x Set En abl eW i l dcar dM at ch i n g com m an d exists before th e SYNCH RONI ZE com m an d. 2. En sure th at th e Ct x Set En abl eW i l dcard M at ch i n g param eter value is set to TRUE. Not e: This statement is inserted when you set the Enable Wildcard Tit le M at ch option in Opt ions>Convert before converting the recording. 3. In sert a Ct x Set W i n dow M at ch Ti t l e com m an d before th e Ct x W ai t ForW i n dow Creat e call for each win dow creation wait even t for th e dyn am ic win dow. Th e param eters in clude th e Citrix win dow iden tifier an d th e iden tified m atch pattern for th e dyn am ic win dow. To r eval i d at e t h e scr i p t : 1. Click Session>Validate Script. 2. If th e Ct x W ai t ForW i n dow Creat e wait even t call fails, iden tify th e actual win dow title return ed. 3. Perform th e m atch pattern iden tification step an d re-create a valid wildcard strin g to m atch all expected win dow values. Conclusion Followin g th ese tech n iques, you can m odify win dow creation even ts to recogn ize dyn am ic win dow titles. Th e sam ple scri pts illustrate h ow to determ in e a base pattern for th e win dow title by sequen tial validation s of th e script an d h ow to m ake relevan t ch an ges to th e script. Th e first exam ple uses a substrin g m atch to recogn ize th e dyn am ic wi n dow title. Th e secon d exam ple uses a wildcard m at ch to accom plish th is. Script Sam ples - Usin g a Substrin g M atch Script Samples: Example One - Using a Substring Match In th is exam ple, th e M icrosoft W ord application gen erates a dyn am ic title. Th e dyn am ic n am e is a con cat en ation of th e default docum en t th at W ord creates at appli cation start up with th e n am e of th e application . Origin al W in dow Title (Record) “ M icrosoft W ord” Actual W in dow Title (Vali dation ) “ docum en t1 - M icrosoft W ord” Actual W in dow Title (Vali dation ) “ docum en t 2 - M icrosoft W ord” Th e script is altered to reflect th e fact th at th e strin g “ M icrosoft W ord” is always part of th e win dow title. Th e asterisk (*) wildcard is substituted for th e default docum en t n am e. “ M atch Pattern ” from win dow titles “ * - M icrosoft W ord” Sample: Original Citrix Script Th is is an exam ple of an origin al Citrix script con verted from capture. In th is exam ple, th e M icrosoft W ord application gen erat es a dyn am ic title. Th e dyn am ic n am e is a con caten ation of th e default docum en t th at W ord creates at application startup with th e n am e of th e application . Poin ts of in terest in th e script are h igh lighted in bold. Sample Script 31 Usin g th e Player, Script Developm en t W orkben ch , an d An alyze /* * dynamicwindow.cpp * * Script Converted on April 18, 2005 at 12:13:47 PM * Generated by Compuware QALoad convert module version 5.5.0 build 256 * * This script contains support for the following middlewares: * - Citrix */ /* Converted using the following options: * General: * Line Split : 80 characters * Sleep Seconds : 1 * Auto Checkpoints : No * Citrix * General Options : * Replay Output Mode : Normal * Enable Counters : No * Timeout Value Options : * Connect Timeout (s) : 60 * Disconnect Timeout (s) : 60 * Window Creation Timeout (s) : 30 * Ping Timeout (s) : 20 * Wait Point Timeout (s) : 30 * Input Options : * Combine Keyboard Input : Yes * Combine Mouse Input : Yes * Window Options : * Window Verification : Yes * Window Max Retries : 5 * Window Wait Retries (ms) : 5000 * Enable Wildcard Title Match : Yes */ #define CITRIX_CLIENT_VERSION "7.100.21825" #define CITRIX_ICO_VERSION "2.3" #define SCRIPT_VER 0x00000505UL #include <stdio.h> #include "smacro.h" #include "do_citrix.h" /* set function to call on abort*/ void abort_function(PLAYER_INFO *s_info); #ifndef NULL #define NULL #endif 0 extern "C" int rhobot_script(PLAYER_INFO *s_info) { /* Declare Variables */ const char *CitrixServer = "qaccitrix"; const char *CitrixPassword = ""; const int CitrixOutputMode = OUTPUT_MODE_NORMAL; /* Citrix Window Information Objects */ CtxWI *CWI_1 = new CtxWI(0x1001c, "Warning !!", 107, 43, 427, 351); CtxWI *CWI_2 = new CtxWI(0x2001c, "Log On to Windows", 111, 65, 418, 285); CtxWI *CWI_3 = new CtxWI(0x5001c, "Please wait...", 111, 112, 418, 145); CtxWI *CWI_4 = new CtxWI(0x30030, "Citrix License Warning Notice", 125, 198, 397, 127); CtxWI *CWI_5 = new CtxWI(0x40030, "Citrix License Warning Notice", 125, 198, 397, 127); CtxWI *CWI_6 = new CtxWI(0x4002e, "UsrLogon.Cmd", 0, 456, 161, 25); CtxWI *CWI_7 = new CtxWI(0x1003a, "", -2, 452, 645, 31); 32 QALoad On lin e Help CtxWI *CWI_8 = new CtxWI(0x10066, "ICA Seamless Host Agent", 0, 0, 391, 224); CtxWI *CWI_9 = new CtxWI(0x10052, "Program Manager", 0, 0, 641, 481); CtxWI *CWI_10 = new CtxWI(0x1008c, "", 115, 0, 405, 457); CtxWI *CWI_11 = new CtxWI(0x20068, "", 112, 116, 416, 248); // Note the initial window title of “Microsoft Word” is set here in the script… CtxWI *CWI_12 = new CtxWI(0x2006e, "Microsoft Word", -4, -4, 649, 461); CtxWI *CWI_13 = new CtxWI(0x7001c, "Please wait...", 111, 112, 418, 145); SET_ABORT_FUNCTION(abort_function); DEFINE_TRANS_TYPE("dynamicwindow.cpp"); CitrixInit(1); /* Citrix replay settings */ CtxSetConnectTimeout(60); CtxSetDisconnectTimeout(60); CtxSetWindowTimeout(30); CtxSetPingTimeout(20); CtxSetWaitPointTimeout(30); CtxSetWindowVerification(TRUE); CtxSetEnableCounters(FALSE); CtxSetWindowRetries(5, 5000); CtxSetEnableWildcardMatching(TRUE); SYNCHRONIZE(); BEGIN_TRANSACTION(); DO_SetTransactionStart(); CtxConnect(CitrixServer, CitrixOutputMode); CtxPoint(164, 61); //1113840775.516 // Window CWI_1 ("Warning !!") created 1113840775.516 CtxWaitForWindowCreate(CWI_1, 1969); DO_MSLEEP(2046); CtxPoint(332, 359); //1113840777.629 DO_MSLEEP(63); CtxClick(CWI_1, 94, L_BUTTON, NONE); //1113840777.723 // Window CWI_2 ("Log On to Windows") created 1113840777.817 CtxWaitForWindowCreate(CWI_2, 93); DO_MSLEEP(16); // Window CWI_1 ("Warning !!") destroyed 1113840777.833 CtxType(CWI_2, "citrix"); //1113840786.615 DO_MSLEEP(8547); CtxTypeVK(CWI_2, VK_TAB, NONE); DO_MSLEEP(281); CtxType(CWI_2, "citrix"); //1113840788.650 DO_MSLEEP(1672); CtxTypeVK(CWI_2, VK_TAB, NONE); DO_MSLEEP(359); CtxType(CWI_2, "q"); //1113840786.678 //1113840788.713 //1113840789.683 DO_MSLEEP(438); 33 Usin g th e Player, Script Developm en t W orkben ch , an d An alyze DO_MSLEEP(1078); CtxPoint(231, 325); //1113840790.309 DO_MSLEEP(78); CtxMouseDown(CWI_2, L_BUTTON, NONE, 231, 325); // 1113840790.309 CtxMouseUp(CWI_2, L_BUTTON, NONE, 232, 325); //1113840790.388 CtxPoint(232, 325); //1113840790.544 // Window CWI_3 ("Please wait...") created 1113840790.544 CtxWaitForWindowCreate(CWI_3, 204); // Window CWI_2 ("Log On to Windows") destroyed 1113840790.544 // Window CWI_4 ("Citrix License Warning Notice") created 1113840790.591 CtxWaitForWindowCreate(CWI_4, 46); DO_MSLEEP(16); // Window CWI_3 ("Please wait...") destroyed 1113840790.607 // Window CWI_5 ("Citrix License Warning Notice") created 1113840790.654 CtxWaitForWindowCreate(CWI_5, 47); DO_MSLEEP(16); // Window CWI_4 ("Citrix License Warning Notice") destroyed 1113840790.669 // Window CWI_6 ("UsrLogon.Cmd") created 1113840790.716 CtxWaitForWindowCreate(CWI_6, 46); DO_MSLEEP(16); // Window CWI_6 ("UsrLogon.Cmd") destroyed 1113840790.732 // Window CWI_7 ("") created 1113840790.967 DO_MSLEEP(234); // Window CWI_8 ("ICA Seamless Host Agent") created 1113840791.014 CtxWaitForWindowCreate(CWI_8, 47); // Window CWI_9 ("Program Manager") created 1113840791.030 CtxWaitForWindowCreate(CWI_9, 16); CtxPoint(347, 249); //1113840793.080 // Window CWI_10 ("") created 1113840793.080 DO_MSLEEP(16); DO_MSLEEP(1203); CtxPoint(571, 256); //1113840796.133 DO_MSLEEP(1844); // Window CWI_10 ("") destroyed 1113840796.133 DO_MSLEEP(1828); CtxPoint(446, 208); //1113840798.309 DO_MSLEEP(344); CtxClick(CWI_5, 78, L_BUTTON, NONE); //1113840798.387 DO_MSLEEP(437); CtxPoint(311, 303); 34 //1113840798.935 QALoad On lin e Help DO_MSLEEP(110); CtxClick(CWI_5, 109, L_BUTTON, NONE); //1113840799.045 DO_MSLEEP(94); // Window CWI_5 ("Citrix License Warning Notice") destroyed 1113840799.138 DO_MSLEEP(390); CtxPoint(275, 1); //1113840799.718 DO_MSLEEP(188); CtxClick(CWI_8, 62, L_BUTTON, NONE); //1113840799.780 DO_MSLEEP(703); CtxPoint(200, 187); //1113840800.579 DO_MSLEEP(94); CtxClick(CWI_8, 78, L_BUTTON, NONE); //1113840800.657 DO_MSLEEP(110); CtxPoint(209, 192); //1113840800.766 // Window CWI_8 ("ICA Seamless Host Agent") destroyed 1113840800.766 DO_MSLEEP(5328); CtxPoint(115, 175); //1113840806.245 DO_MSLEEP(140); CtxDoubleClick(CWI_9); // 1113840806.621 CtxMouseUp(CWI_7, L_BUTTON, NONE, 114, 174); //1113840806.512 DO_MSLEEP(16); CtxPoint(114, 174); //1113840806.621 DO_MSLEEP(359); CtxPoint(284, 205); //1113840807.028 // Window CWI_11 ("") created 1113840807.028 DO_MSLEEP(16); CtxPoint(309, 208); //1113840807.326 // Window CWI_12 ("Microsoft Word") created 1113840807.326 /// The window create wait event. If the window title at replay /// is any different that “Microsoft Word”, this wait event will FAIL. CtxWaitForWindowCreate(CWI_12, 266); DO_MSLEEP(46); CWI_12->setTitle("Document1 - Microsoft Word"); //1113840807.388 DO_MSLEEP(16); // Window CWI_11 ("") destroyed 1113840807.388 DO_MSLEEP(4188); CtxPoint(626, 8); //1113840811.693 DO_MSLEEP(109); CtxClick(CWI_12, 94, L_BUTTON, NONE); //1113840811.787 DO_MSLEEP(218); CtxPoint(623, 40); //1113840812.006 // Window CWI_12 ("Document1 - Microsoft Word") destroyed 1113840812.006 DO_MSLEEP(2204); CtxPoint(385, 1); //1113840815.262 35 Usin g th e Player, Script Developm en t W orkben ch , an d An alyze DO_MSLEEP(1046); // Window CWI_9 ("Program Manager") destroyed 1113840815.262 // Window CWI_7 ("") destroyed 1113840815.262 // Window CWI_13 ("Please wait...") created 1113840815.513 CtxWaitForWindowCreate(CWI_13, 0); DO_SetTransactionCleanup(); CtxDisconnect(); END_TRANSACTION(); delete delete delete delete delete delete delete delete delete delete delete delete delete CWI_1; // "Warning !!" CWI_2; // "Log On to Windows" CWI_3; // "Please wait..." CWI_4; // "Citrix License Warning Notice" CWI_5; // "Citrix License Warning Notice" CWI_6; // "UsrLogon.Cmd" CWI_7; // "" CWI_8; // "ICA Seamless Host Agent" CWI_9; // "Program Manager" CWI_10; // "" CWI_11; // "" CWI_12; // "Microsoft Word" CWI_13; // "Please wait..." CitrixUninit(); EXIT(); return(0); } void abort_function(PLAYER_INFO *s_info) { RR__printf("Virtual User ABORTED."); CitrixUninit(); EXIT(); } Sample One: Modified Citrix Script In th is exam ple, th e M icrosoft W ord application gen erates dyn am i c title th at is a con caten ation of th e default docum en t th at W ord creates at application startup with th e n am e of th e application . Th is script is altered to reflect th e fact t h at th e strin g “ M icrosoft W ord” is always part of th e win dow title. Th e asterisk (*) wildcard is substituted for th e default docum en t n am e. Ch an ges to th e origin al script are h igh ligh ted in bold. Sample Script /* * dynamicwindow.cpp * * Script Converted on April 18, 2005 at 12:13:47 PM * Generated by Compuware QALoad convert module version 5.5.0 build 256 * * This script contains support for the following middlewares: * - Citrix */ /* Converted using the following options: * General: * Line Split : 80 characters * Sleep Seconds : 1 36 QALoad On lin e Help * Auto Checkpoints * Citrix * General Options * Replay Output Mode * Enable Counters * Timeout Value Options * Connect Timeout (s) * Disconnect Timeout (s) * Window Creation Timeout (s) * Ping Timeout (s) * Wait Point Timeout (s) * Input Options * Combine Keyboard Input * Combine Mouse Input * Window Options * Window Verification * Window Max Retries * Window Wait Retries (ms) * Enable Wildcard Title Match */ : No : : : : : : : : : : : : : : : : : Normal No 60 60 30 20 30 Yes Yes Yes 5 5000 Yes #define CITRIX_CLIENT_VERSION "7.100.21825" #define CITRIX_ICO_VERSION "2.3" #define SCRIPT_VER 0x00000505UL #include <stdio.h> #include "smacro.h" #include "do_citrix.h" /* set function to call on abort*/ void abort_function(PLAYER_INFO *s_info); #ifndef NULL #define NULL #endif 0 extern "C" int rhobot_script(PLAYER_INFO *s_info) { /* Declare Variables */ const char *CitrixServer = "qaccitrix"; const char *CitrixPassword = ""; const int CitrixOutputMode = OUTPUT_MODE_NORMAL; /* Citrix Window Information Objects */ CtxWI *CWI_1 = new CtxWI(0x1001c, "Warning !!", 107, 43, 427, 351); CtxWI *CWI_2 = new CtxWI(0x2001c, "Log On to Windows", 111, 65, 418, 285); CtxWI *CWI_3 = new CtxWI(0x5001c, "Please wait...", 111, 112, 418, 145); CtxWI *CWI_4 = new CtxWI(0x30030, "Citrix License Warning Notice", 125, 198, 397, 127); CtxWI *CWI_5 = new CtxWI(0x40030, "Citrix License Warning Notice", 125, 198, 397, 127); CtxWI *CWI_6 = new CtxWI(0x4002e, "UsrLogon.Cmd", 0, 456, 161, 25); CtxWI *CWI_7 = new CtxWI(0x1003a, "", -2, 452, 645, 31); CtxWI *CWI_8 = new CtxWI(0x10066, "ICA Seamless Host Agent", 0, 0, 391, 224); CtxWI *CWI_9 = new CtxWI(0x10052, "Program Manager", 0, 0, 641, 481); CtxWI *CWI_10 = new CtxWI(0x1008c, "", 115, 0, 405, 457); CtxWI *CWI_11 = new CtxWI(0x20068, "", 112, 116, 416, 248); // The initial window title of “Microsoft Word” does not change CtxWI *CWI_12 = new CtxWI(0x2006e, "Microsoft Word", -4, -4, 649, 461); CtxWI *CWI_13 = new CtxWI(0x7001c, "Please wait...", 111, 112, 418, 145); SET_ABORT_FUNCTION(abort_function); DEFINE_TRANS_TYPE("dynamicwindow.cpp"); CitrixInit(1); 37 Usin g th e Player, Script Developm en t W orkben ch , an d An alyze /* Citrix replay settings */ CtxSetConnectTimeout(60); CtxSetDisconnectTimeout(60); CtxSetWindowTimeout(30); CtxSetPingTimeout(20); CtxSetWaitPointTimeout(30); CtxSetWindowVerification(TRUE); CtxSetEnableCounters(FALSE); CtxSetWindowRetries(5, 5000); CtxSetEnableWildcardMatching(TRUE); SYNCHRONIZE(); BEGIN_TRANSACTION(); DO_SetTransactionStart(); CtxConnect(CitrixServer, CitrixOutputMode); CtxPoint(164, 61); //1113840775.516 // Window CWI_1 ("Warning !!") created 1113840775.516 CtxWaitForWindowCreate(CWI_1, 1969); DO_MSLEEP(2046); CtxPoint(332, 359); //1113840777.629 DO_MSLEEP(63); CtxClick(CWI_1, 94, L_BUTTON, NONE); //1113840777.723 // Window CWI_2 ("Log On to Windows") created 1113840777.817 CtxWaitForWindowCreate(CWI_2, 93); DO_MSLEEP(16); // Window CWI_1 ("Warning !!") destroyed 1113840777.833 CtxType(CWI_2, "citrix"); //1113840786.615 DO_MSLEEP(8547); CtxTypeVK(CWI_2, VK_TAB, NONE); DO_MSLEEP(281); CtxType(CWI_2, "citrix"); //1113840788.650 DO_MSLEEP(1672); CtxTypeVK(CWI_2, VK_TAB, NONE); DO_MSLEEP(359); CtxType(CWI_2, "q"); //1113840786.678 //1113840788.713 //1113840789.683 DO_MSLEEP(438); DO_MSLEEP(1078); CtxPoint(231, 325); //1113840790.309 DO_MSLEEP(78); CtxMouseDown(CWI_2, L_BUTTON, NONE, 231, 325); // 1113840790.309 CtxMouseUp(CWI_2, L_BUTTON, NONE, 232, 325); //1113840790.388 CtxPoint(232, 325); //1113840790.544 // Window CWI_3 ("Please wait...") created 1113840790.544 CtxWaitForWindowCreate(CWI_3, 204); 38 QALoad On lin e Help // Window CWI_2 ("Log On to Windows") destroyed 1113840790.544 // Window CWI_4 ("Citrix License Warning Notice") created 1113840790.591 CtxWaitForWindowCreate(CWI_4, 46); DO_MSLEEP(16); // Window CWI_3 ("Please wait...") destroyed 1113840790.607 // Window CWI_5 ("Citrix License Warning Notice") created 1113840790.654 CtxWaitForWindowCreate(CWI_5, 47); DO_MSLEEP(16); // Window CWI_4 ("Citrix License Warning Notice") destroyed 1113840790.669 // Window CWI_6 ("UsrLogon.Cmd") created 1113840790.716 CtxWaitForWindowCreate(CWI_6, 46); DO_MSLEEP(16); // Window CWI_6 ("UsrLogon.Cmd") destroyed 1113840790.732 // Window CWI_7 ("") created 1113840790.967 DO_MSLEEP(234); // Window CWI_8 ("ICA Seamless Host Agent") created 1113840791.014 CtxWaitForWindowCreate(CWI_8, 47); // Window CWI_9 ("Program Manager") created 1113840791.030 CtxWaitForWindowCreate(CWI_9, 16); CtxPoint(347, 249); //1113840793.080 // Window CWI_10 ("") created 1113840793.080 DO_MSLEEP(16); DO_MSLEEP(1203); CtxPoint(571, 256); //1113840796.133 DO_MSLEEP(1844); // Window CWI_10 ("") destroyed 1113840796.133 DO_MSLEEP(1828); CtxPoint(446, 208); //1113840798.309 DO_MSLEEP(344); CtxClick(CWI_5, 78, L_BUTTON, NONE); //1113840798.387 DO_MSLEEP(437); CtxPoint(311, 303); //1113840798.935 DO_MSLEEP(110); CtxClick(CWI_5, 109, L_BUTTON, NONE); //1113840799.045 DO_MSLEEP(94); // Window CWI_5 ("Citrix License Warning Notice") destroyed 1113840799.138 DO_MSLEEP(390); CtxPoint(275, 1); //1113840799.718 DO_MSLEEP(188); CtxClick(CWI_8, 62, L_BUTTON, NONE); //1113840799.780 DO_MSLEEP(703); 39 Usin g th e Player, Script Developm en t W orkben ch , an d An alyze CtxPoint(200, 187); //1113840800.579 DO_MSLEEP(94); CtxClick(CWI_8, 78, L_BUTTON, NONE); //1113840800.657 DO_MSLEEP(110); CtxPoint(209, 192); //1113840800.766 // Window CWI_8 ("ICA Seamless Host Agent") destroyed 1113840800.766 DO_MSLEEP(5328); CtxPoint(115, 175); //1113840806.245 DO_MSLEEP(140); CtxDoubleClick(CWI_9); // 1113840806.621 CtxMouseUp(CWI_7, L_BUTTON, NONE, 114, 174); //1113840806.512 DO_MSLEEP(16); CtxPoint(114, 174); //1113840806.621 DO_MSLEEP(359); CtxPoint(284, 205); //1113840807.028 // Window CWI_11 ("") created 1113840807.028 DO_MSLEEP(16); CtxPoint(309, 208); //1113840807.326 // Window CWI_12 ("Microsoft Word") created 1113840807.326 ////////////////////////////////////////////////////////////////////// /// The CtxSetWindowMatchTitle command is inserted before the /// CtxWaitForWindowCreate call. Note that the window identifier is the // same for both calls, and the “match pattern” for the command is from /// Example One in the Match Pattern Identification section above. ////////////////////////////////////////////////////////////////////// CtxSetWindowMatchTitle(CW1_12, "*Microsoft Word"" ); /// The window create wait event call does not change. CtxWaitForWindowCreate(CWI_12, 266); DO_MSLEEP(46); CWI_12->setTitle("Document1 - Microsoft Word"); //1113840807.388 DO_MSLEEP(16); // Window CWI_11 ("") destroyed 1113840807.388 DO_MSLEEP(4188); CtxPoint(626, 8); //1113840811.693 DO_MSLEEP(109); CtxClick(CWI_12, 94, L_BUTTON, NONE); //1113840811.787 DO_MSLEEP(218); CtxPoint(623, 40); //1113840812.006 // Window CWI_12 ("Document1 - Microsoft Word") destroyed 1113840812.006 DO_MSLEEP(2204); CtxPoint(385, 1); //1113840815.262 DO_MSLEEP(1046); // Window CWI_9 ("Program Manager") destroyed 1113840815.262 // Window CWI_7 ("") destroyed 1113840815.262 40 QALoad On lin e Help // Window CWI_13 ("Please wait...") created 1113840815.513 CtxWaitForWindowCreate(CWI_13, 0); DO_SetTransactionCleanup(); CtxDisconnect(); END_TRANSACTION(); delete delete delete delete delete delete delete delete delete delete delete delete delete CWI_1; // "Warning !!" CWI_2; // "Log On to Windows" CWI_3; // "Please wait..." CWI_4; // "Citrix License Warning Notice" CWI_5; // "Citrix License Warning Notice" CWI_6; // "UsrLogon.Cmd" CWI_7; // "" CWI_8; // "ICA Seamless Host Agent" CWI_9; // "Program Manager" CWI_10; // "" CWI_11; // "" CWI_12; // "Microsoft Word" CWI_13; // "Please wait..." CitrixUninit(); EXIT(); return(0); } void abort_function(PLAYER_INFO *s_info) { RR__printf("Virtual User ABORTED."); CitrixUninit(); EXIT(); } Script Sam ples - Usin g a W ildcard M atch Script Samples: Example Two - Using a W ildcard Match In th is exam ple, th e Sam ple Application gen erates a dyn am ic title. Th e dyn am ic n am e is th e n am e of th e application followed by t h e tim e th e script is created. Origin al W in dow Title (Record) “ Sam ple Application – 09:01:23 AM ” Actual W in dow Title (Vali dation ) “ Sam ple Application – 11:00:04 AM ” Actual W in dow Title (Vali dation ) “ Sam ple Application – 12:20:52 PM ” Th e question m ark (?) wil dcard is substituted for a given tim e. “ M atch Pattern ” from win dow titles “ Sam ple Application – ??:??:?? ?M ” Sample Two: Original Citrix Script Th e followin g sam ple is an origin al Citrix script con verted from capture. In th is exam ple, th e Sam ple Application gen erates a dyn am ic title. Th e dyn am i c n am e is th e n am e of th e application followed by t h e tim e th e script is created. Poin ts of in terest in th e script are h igh ligh ted in bold. 41 Usin g th e Player, Script Developm en t W orkben ch , an d An alyze Sample Script /* * dynamicwindow2.cpp * * Script Converted on April 18, 2005 at 12:13:47 PM * Generated by Compuware QALoad convert module version 5.5.0 build 256 * * This script contains support for the following middlewares: * - Citrix */ /* Converted using the following options: * General: * Line Split : 80 characters * Sleep Seconds : 1 * Auto Checkpoints : No * Citrix * General Options : * Replay Output Mode : Normal * Enable Counters : No * Timeout Value Options : * Connect Timeout (s) : 60 * Disconnect Timeout (s) : 60 * Window Creation Timeout (s) : 30 * Ping Timeout (s) : 20 * Wait Point Timeout (s) : 30 * Input Options : * Combine Keyboard Input : Yes * Combine Mouse Input : Yes * Window Options : * Window Verification : Yes * Window Max Retries : 5 * Window Wait Retries (ms) : 5000 * Enable Wildcard Title Match : Yes */ #define CITRIX_CLIENT_VERSION "7.100.21825" #define CITRIX_ICO_VERSION "2.3" #define SCRIPT_VER 0x00000505UL #include <stdio.h> #include "smacro.h" #include "do_citrix.h" /* set function to call on abort*/ void abort_function(PLAYER_INFO *s_info); #ifndef NULL #define NULL #endif 0 extern "C" int rhobot_script(PLAYER_INFO *s_info) { /* Declare Variables */ const char *CitrixServer = "qaccitrix"; const char *CitrixPassword = ""; const int CitrixOutputMode = OUTPUT_MODE_NORMAL; /* Citrix Window Information Objects */ CtxWI *CWI_1 = new CtxWI(0x1001c, "Warning !!", 107, 43, 427, 351); CtxWI *CWI_2 = new CtxWI(0x2001c, "Log On to Windows", 111, 65, 418, 285); CtxWI *CWI_3 = new CtxWI(0x5001c, "Please wait...", 111, 112, 418, 145); CtxWI *CWI_4 = new CtxWI(0x30030, "Citrix License Warning Notice", 125, 198, 397, 127); CtxWI *CWI_5 = new CtxWI(0x40030, "Citrix License Warning Notice", 125, 198, 397, 127); CtxWI *CWI_6 = new CtxWI(0x4002e, "UsrLogon.Cmd", 0, 456, 161, 25); 42 QALoad On lin e Help CtxWI *CWI_7 = new CtxWI(0x1003a, "", -2, 452, 645, 31); CtxWI *CWI_8 = new CtxWI(0x10066, "ICA Seamless Host Agent", 0, 0, 391, 224); CtxWI *CWI_9 = new CtxWI(0x10052, "Program Manager", 0, 0, 641, 481); CtxWI *CWI_10 = new CtxWI(0x1008c, "", 115, 0, 405, 457); CtxWI *CWI_11 = new CtxWI(0x20068, "", 112, 116, 416, 248); // Note the initial window title of “Sample Application 09:01:23 AM” is set here… CtxWI *CWI_12 = new CtxWI(0x2006e, "Sample Application 09:01:23 AM ", -4, -4, 649, 461); CtxWI *CWI_13 = new CtxWI(0x7001c, "Please wait...", 111, 112, 418, 145); SET_ABORT_FUNCTION(abort_function); DEFINE_TRANS_TYPE("dynamicwindow.cpp"); CitrixInit(1); /* Citrix replay settings */ CtxSetConnectTimeout(60); CtxSetDisconnectTimeout(60); CtxSetWindowTimeout(30); CtxSetPingTimeout(20); CtxSetWaitPointTimeout(30); CtxSetWindowVerification(TRUE); CtxSetEnableCounters(FALSE); CtxSetWindowRetries(5, 5000); CtxSetEnableWildcardMatching(TRUE); SYNCHRONIZE(); BEGIN_TRANSACTION(); DO_SetTransactionStart(); CtxConnect(CitrixServer, CitrixOutputMode); CtxPoint(164, 61); //1113840775.516 // Window CWI_1 ("Warning !!") created 1113840775.516 CtxWaitForWindowCreate(CWI_1, 1969); DO_MSLEEP(2046); CtxPoint(332, 359); //1113840777.629 DO_MSLEEP(63); CtxClick(CWI_1, 94, L_BUTTON, NONE); //1113840777.723 // Window CWI_2 ("Log On to Windows") created 1113840777.817 CtxWaitForWindowCreate(CWI_2, 93); DO_MSLEEP(16); // Window CWI_1 ("Warning !!") destroyed 1113840777.833 CtxType(CWI_2, "citrix"); //1113840786.615 DO_MSLEEP(8547); CtxTypeVK(CWI_2, VK_TAB, NONE); DO_MSLEEP(281); CtxType(CWI_2, "citrix"); //1113840786.678 //1113840788.650 DO_MSLEEP(1672); CtxTypeVK(CWI_2, VK_TAB, NONE); //1113840788.713 DO_MSLEEP(359); 43 Usin g th e Player, Script Developm en t W orkben ch , an d An alyze CtxType(CWI_2, "q"); //1113840789.683 DO_MSLEEP(438); DO_MSLEEP(1078); CtxPoint(231, 325); //1113840790.309 DO_MSLEEP(78); CtxMouseDown(CWI_2, L_BUTTON, NONE, 231, 325); // 1113840790.309 CtxMouseUp(CWI_2, L_BUTTON, NONE, 232, 325); //1113840790.388 CtxPoint(232, 325); //1113840790.544 // Window CWI_3 ("Please wait...") created 1113840790.544 CtxWaitForWindowCreate(CWI_3, 204); // Window CWI_2 ("Log On to Windows") destroyed 1113840790.544 // Window CWI_4 ("Citrix License Warning Notice") created 1113840790.591 CtxWaitForWindowCreate(CWI_4, 46); DO_MSLEEP(16); // Window CWI_3 ("Please wait...") destroyed 1113840790.607 // Window CWI_5 ("Citrix License Warning Notice") created 1113840790.654 CtxWaitForWindowCreate(CWI_5, 47); DO_MSLEEP(16); // Window CWI_4 ("Citrix License Warning Notice") destroyed 1113840790.669 // Window CWI_6 ("UsrLogon.Cmd") created 1113840790.716 CtxWaitForWindowCreate(CWI_6, 46); DO_MSLEEP(16); // Window CWI_6 ("UsrLogon.Cmd") destroyed 1113840790.732 // Window CWI_7 ("") created 1113840790.967 DO_MSLEEP(234); // Window CWI_8 ("ICA Seamless Host Agent") created 1113840791.014 CtxWaitForWindowCreate(CWI_8, 47); // Window CWI_9 ("Program Manager") created 1113840791.030 CtxWaitForWindowCreate(CWI_9, 16); CtxPoint(347, 249); //1113840793.080 // Window CWI_10 ("") created 1113840793.080 DO_MSLEEP(16); DO_MSLEEP(1203); CtxPoint(571, 256); //1113840796.133 DO_MSLEEP(1844); // Window CWI_10 ("") destroyed 1113840796.133 DO_MSLEEP(1828); 44 QALoad On lin e Help CtxPoint(446, 208); //1113840798.309 DO_MSLEEP(344); CtxClick(CWI_5, 78, L_BUTTON, NONE); //1113840798.387 DO_MSLEEP(437); CtxPoint(311, 303); //1113840798.935 DO_MSLEEP(110); CtxClick(CWI_5, 109, L_BUTTON, NONE); //1113840799.045 DO_MSLEEP(94); // Window CWI_5 ("Citrix License Warning Notice") destroyed 1113840799.138 DO_MSLEEP(390); CtxPoint(275, 1); //1113840799.718 DO_MSLEEP(188); CtxClick(CWI_8, 62, L_BUTTON, NONE); //1113840799.780 DO_MSLEEP(703); CtxPoint(200, 187); //1113840800.579 DO_MSLEEP(94); CtxClick(CWI_8, 78, L_BUTTON, NONE); //1113840800.657 DO_MSLEEP(110); CtxPoint(209, 192); //1113840800.766 // Window CWI_8 ("ICA Seamless Host Agent") destroyed 1113840800.766 DO_MSLEEP(5328); CtxPoint(115, 175); //1113840806.245 DO_MSLEEP(140); CtxDoubleClick(CWI_9); // 1113840806.621 CtxMouseUp(CWI_7, L_BUTTON, NONE, 114, 174); //1113840806.512 DO_MSLEEP(16); CtxPoint(114, 174); //1113840806.621 DO_MSLEEP(359); CtxPoint(284, 205); //1113840807.028 // Window CWI_11 ("") created 1113840807.028 DO_MSLEEP(16); CtxPoint(309, 208); //1113840807.326 // Window CWI_12 ("Microsoft Word") created 1113840807.326 /// The window create wait event. If the window title at replay /// is any different that “Sample Application 09:01:23 AM”, this wait event /// will FAIL. CtxWaitForWindowCreate(CWI_12, 266); DO_MSLEEP(46); CWI_12->setTitle("Document1 - Microsoft Word"); //1113840807.388 DO_MSLEEP(16); // Window CWI_11 ("") destroyed 1113840807.388 DO_MSLEEP(4188); 45 Usin g th e Player, Script Developm en t W orkben ch , an d An alyze CtxPoint(626, 8); //1113840811.693 DO_MSLEEP(109); CtxClick(CWI_12, 94, L_BUTTON, NONE); //1113840811.787 DO_MSLEEP(218); CtxPoint(623, 40); //1113840812.006 // Window CWI_12 ("Document1 - Microsoft Word") destroyed 1113840812.006 DO_MSLEEP(2204); CtxPoint(385, 1); //1113840815.262 DO_MSLEEP(1046); // Window CWI_9 ("Program Manager") destroyed 1113840815.262 // Window CWI_7 ("") destroyed 1113840815.262 // Window CWI_13 ("Please wait...") created 1113840815.513 CtxWaitForWindowCreate(CWI_13, 0); DO_SetTransactionCleanup(); CtxDisconnect(); END_TRANSACTION(); delete delete delete delete delete delete delete delete delete delete delete delete delete CWI_1; // "Warning !!" CWI_2; // "Log On to Windows" CWI_3; // "Please wait..." CWI_4; // "Citrix License Warning Notice" CWI_5; // "Citrix License Warning Notice" CWI_6; // "UsrLogon.Cmd" CWI_7; // "" CWI_8; // "ICA Seamless Host Agent" CWI_9; // "Program Manager" CWI_10; // "" CWI_11; // "" CWI_12; // "Microsoft Word" CWI_13; // "Please wait..." CitrixUninit(); EXIT(); return(0); } void abort_function(PLAYER_INFO *s_info) { RR__printf("Virtual User ABORTED."); CitrixUninit(); EXIT(); } Sample Two: Modified Citrix Script Th e followin g is an exam ple of a Citrix script m odi fied to h an dle a dyn am ic win dow title. In th is exam ple, th e Sam ple Application gen erates a dyn am ic title. Th e dyn am ic n am e is th e n am e of th e application followed by th e tim e th e script is created. Th e question m ark (?) wildcard is substituted for a given tim e. Ch an ges to th e origin al script are h igh ligh ted in bold. Sample Script 46 QALoad On lin e Help /* * dynamicwindow2.cpp * * Script Converted on April 18, 2005 at 12:13:47 PM * Generated by Compuware QALoad convert module version 5.5.0 build 256 * * This script contains support for the following middlewares: * - Citrix */ /* Converted using the following options: * General: * Line Split : 80 characters * Sleep Seconds : 1 * Auto Checkpoints : No * Citrix * General Options : * Replay Output Mode : Normal * Enable Counters : No * Timeout Value Options : * Connect Timeout (s) : 60 * Disconnect Timeout (s) : 60 * Window Creation Timeout (s) : 30 * Ping Timeout (s) : 20 * Wait Point Timeout (s) : 30 * Input Options : * Combine Keyboard Input : Yes * Combine Mouse Input : Yes * Window Options : * Window Verification : Yes * Window Max Retries : 5 * Window Wait Retries (ms) : 5000 * Enable Wildcard Title Match : Yes */ #define CITRIX_CLIENT_VERSION "7.100.21825" #define CITRIX_ICO_VERSION "2.3" #define SCRIPT_VER 0x00000505UL #include <stdio.h> #include "smacro.h" #include "do_citrix.h" /* set function to call on abort*/ void abort_function(PLAYER_INFO *s_info); #ifndef NULL #define NULL #endif 0 extern "C" int rhobot_script(PLAYER_INFO *s_info) { /* Declare Variables */ const char *CitrixServer = "qaccitrix"; const char *CitrixPassword = ""; const int CitrixOutputMode = OUTPUT_MODE_NORMAL; /* Citrix Window Information Objects */ CtxWI *CWI_1 = new CtxWI(0x1001c, "Warning !!", 107, 43, 427, 351); CtxWI *CWI_2 = new CtxWI(0x2001c, "Log On to Windows", 111, 65, 418, 285); CtxWI *CWI_3 = new CtxWI(0x5001c, "Please wait...", 111, 112, 418, 145); CtxWI *CWI_4 = new CtxWI(0x30030, "Citrix License Warning Notice", 125, 198, 397, 127); CtxWI *CWI_5 = new CtxWI(0x40030, "Citrix License Warning Notice", 125, 198, 397, 127); CtxWI *CWI_6 = new CtxWI(0x4002e, "UsrLogon.Cmd", 0, 456, 161, 25); CtxWI *CWI_7 = new CtxWI(0x1003a, "", -2, 452, 645, 31); 47 Usin g th e Player, Script Developm en t W orkben ch , an d An alyze CtxWI *CWI_8 = new CtxWI(0x10066, "ICA Seamless Host Agent", 0, 0, 391, 224); CtxWI *CWI_9 = new CtxWI(0x10052, "Program Manager", 0, 0, 641, 481); CtxWI *CWI_10 = new CtxWI(0x1008c, "", 115, 0, 405, 457); CtxWI *CWI_11 = new CtxWI(0x20068, "", 112, 116, 416, 248); // The initial window title of “Sample Application 09:01:23 AM” does not change CtxWI *CWI_12 = new CtxWI(0x2006e, "Sample Application 09:01:23 AM", -4, -4, 649, 461); CtxWI *CWI_13 = new CtxWI(0x7001c, "Please wait...", 111, 112, 418, 145); SET_ABORT_FUNCTION(abort_function); DEFINE_TRANS_TYPE("dynamicwindow.cpp"); CitrixInit(1); /* Citrix replay settings */ CtxSetConnectTimeout(60); CtxSetDisconnectTimeout(60); CtxSetWindowTimeout(30); CtxSetPingTimeout(20); CtxSetWaitPointTimeout(30); CtxSetWindowVerification(TRUE); CtxSetEnableCounters(FALSE); CtxSetWindowRetries(5, 5000); CtxSetEnableWildcardMatching(TRUE); SYNCHRONIZE(); BEGIN_TRANSACTION(); DO_SetTransactionStart(); CtxConnect(CitrixServer, CitrixOutputMode); CtxPoint(164, 61); //1113840775.516 // Window CWI_1 ("Warning !!") created 1113840775.516 CtxWaitForWindowCreate(CWI_1, 1969); DO_MSLEEP(2046); CtxPoint(332, 359); //1113840777.629 DO_MSLEEP(63); CtxClick(CWI_1, 94, L_BUTTON, NONE); //1113840777.723 // Window CWI_2 ("Log On to Windows") created 1113840777.817 CtxWaitForWindowCreate(CWI_2, 93); DO_MSLEEP(16); // Window CWI_1 ("Warning !!") destroyed 1113840777.833 CtxType(CWI_2, "citrix"); //1113840786.615 DO_MSLEEP(8547); CtxTypeVK(CWI_2, VK_TAB, NONE); DO_MSLEEP(281); CtxType(CWI_2, "citrix"); //1113840788.650 DO_MSLEEP(1672); CtxTypeVK(CWI_2, VK_TAB, NONE); DO_MSLEEP(359); CtxType(CWI_2, "q"); 48 //1113840786.678 //1113840788.713 //1113840789.683 QALoad On lin e Help DO_MSLEEP(438); DO_MSLEEP(1078); CtxPoint(231, 325); //1113840790.309 DO_MSLEEP(78); CtxMouseDown(CWI_2, L_BUTTON, NONE, 231, 325); // 1113840790.309 CtxMouseUp(CWI_2, L_BUTTON, NONE, 232, 325); //1113840790.388 CtxPoint(232, 325); //1113840790.544 // Window CWI_3 ("Please wait...") created 1113840790.544 CtxWaitForWindowCreate(CWI_3, 204); // Window CWI_2 ("Log On to Windows") destroyed 1113840790.544 // Window CWI_4 ("Citrix License Warning Notice") created 1113840790.591 CtxWaitForWindowCreate(CWI_4, 46); DO_MSLEEP(16); // Window CWI_3 ("Please wait...") destroyed 1113840790.607 // Window CWI_5 ("Citrix License Warning Notice") created 1113840790.654 CtxWaitForWindowCreate(CWI_5, 47); DO_MSLEEP(16); // Window CWI_4 ("Citrix License Warning Notice") destroyed 1113840790.669 // Window CWI_6 ("UsrLogon.Cmd") created 1113840790.716 CtxWaitForWindowCreate(CWI_6, 46); DO_MSLEEP(16); // Window CWI_6 ("UsrLogon.Cmd") destroyed 1113840790.732 // Window CWI_7 ("") created 1113840790.967 DO_MSLEEP(234); // Window CWI_8 ("ICA Seamless Host Agent") created 1113840791.014 CtxWaitForWindowCreate(CWI_8, 47); // Window CWI_9 ("Program Manager") created 1113840791.030 CtxWaitForWindowCreate(CWI_9, 16); CtxPoint(347, 249); //1113840793.080 // Window CWI_10 ("") created 1113840793.080 DO_MSLEEP(16); DO_MSLEEP(1203); CtxPoint(571, 256); //1113840796.133 DO_MSLEEP(1844); // Window CWI_10 ("") destroyed 1113840796.133 DO_MSLEEP(1828); CtxPoint(446, 208); //1113840798.309 49 Usin g th e Player, Script Developm en t W orkben ch , an d An alyze DO_MSLEEP(344); CtxClick(CWI_5, 78, L_BUTTON, NONE); //1113840798.387 DO_MSLEEP(437); CtxPoint(311, 303); //1113840798.935 DO_MSLEEP(110); CtxClick(CWI_5, 109, L_BUTTON, NONE); //1113840799.045 DO_MSLEEP(94); // Window CWI_5 ("Citrix License Warning Notice") destroyed 1113840799.138 DO_MSLEEP(390); CtxPoint(275, 1); //1113840799.718 DO_MSLEEP(188); CtxClick(CWI_8, 62, L_BUTTON, NONE); //1113840799.780 DO_MSLEEP(703); CtxPoint(200, 187); //1113840800.579 DO_MSLEEP(94); CtxClick(CWI_8, 78, L_BUTTON, NONE); //1113840800.657 DO_MSLEEP(110); CtxPoint(209, 192); //1113840800.766 // Window CWI_8 ("ICA Seamless Host Agent") destroyed 1113840800.766 DO_MSLEEP(5328); CtxPoint(115, 175); //1113840806.245 DO_MSLEEP(140); CtxDoubleClick(CWI_9); // 1113840806.621 CtxMouseUp(CWI_7, L_BUTTON, NONE, 114, 174); //1113840806.512 DO_MSLEEP(16); CtxPoint(114, 174); //1113840806.621 DO_MSLEEP(359); CtxPoint(284, 205); //1113840807.028 // Window CWI_11 ("") created 1113840807.028 DO_MSLEEP(16); CtxPoint(309, 208); //1113840807.326 // Window CWI_12 ("Microsoft Word") created 1113840807.326 ////////////////////////////////////////////////////////////////////// /// The CtxSetWindowMatchTitle command is inserted before the /// CtxWaitForWindowCreate call. Note that the window identifier is the // same for both calls, and the “match pattern” for the command is from /// Example Two in the Match Pattern Identification section above. ////////////////////////////////////////////////////////////////////// CtxSetWindowMatchTitle(CW1_12, "Sample Application ??:??:?? ?M" ); /// The window create wait event call does not change. CtxWaitForWindowCreate(CWI_12, 266); DO_MSLEEP(46); 50 QALoad On lin e Help CWI_12->setTitle("Document1 - Microsoft Word"); //1113840807.388 DO_MSLEEP(16); // Window CWI_11 ("") destroyed 1113840807.388 DO_MSLEEP(4188); CtxPoint(626, 8); //1113840811.693 DO_MSLEEP(109); CtxClick(CWI_12, 94, L_BUTTON, NONE); //1113840811.787 DO_MSLEEP(218); CtxPoint(623, 40); //1113840812.006 // Window CWI_12 ("Document1 - Microsoft Word") destroyed 1113840812.006 DO_MSLEEP(2204); CtxPoint(385, 1); //1113840815.262 DO_MSLEEP(1046); // Window CWI_9 ("Program Manager") destroyed 1113840815.262 // Window CWI_7 ("") destroyed 1113840815.262 // Window CWI_13 ("Please wait...") created 1113840815.513 CtxWaitForWindowCreate(CWI_13, 0); DO_SetTransactionCleanup(); CtxDisconnect(); END_TRANSACTION(); delete CWI_1; // "Warning !!" delete CWI_2; // "Log On to Windows" delete CWI_3; // "Please wait..." delete CWI_4; // "Citrix License Warning Notice" delete CWI_5; // "Citrix License Warning Notice" delete CWI_6; // "UsrLogon.Cmd" delete CWI_7; // "" delete CWI_8; // "ICA Seamless Host Agent" delete CWI_9; // "Program Manager" delete CWI_10; // "" delete CWI_11; // "" delete CWI_12; // "Microsoft Word" delete CWI_13; // "Please wait..." CitrixUninit(); EXIT(); return(0); } void abort_function(PLAYER_INFO *s_info) { RR__printf("Virtual User ABORTED."); CitrixUninit(); EXIT(); } I n t erm i t t en t W i n dow s 51 Usin g th e Player, Script Developm en t W orkben ch , an d An alyze In term itten t W in dows W in dows th at do n ot appear wh en a script is recorded can appear in term itten tly durin g replay. On e exam ple com m on ly en coun tered with Citrix is th e ICA Seam less Host Agen t win dow. If an un expected win dow appears at validat ion or playback, you m ust m odify th e script to h an dle th e win dow even t. To sim plify th e scriptin g process, record a tem porary session an d con vert it to a script. Th is sh ould be a session wh ere th e un expected win dow appears so t h at th e user m ust in teract, for exam ple, with a m ouse click or keyboard en try, to dism iss th e in term itten t win dow. Note th e location in th e playback scri pt wh ere th e presen ce of th e in term itten t win dow preven ted th e script from con tin uin g. Th is is wh ere code is added to th e script. W h en th is error occurs durin g validation or pl ayback, you m ust m odify th e script to recogn ize th e base pattern of th e win dow title n am e rath er th an an exact win dow title. An in term itten t win dow, if it appears, requires user action or th e scri pt m ay fail. M odifyin g th e Script for In term itten t W in dows W in dows th at don 't appear wh en a scri pt is recorded can appear in term itten tly durin g replay. On e exam ple com m on ly en coun tered with Citrix is th e ICA Seam less Host Agen t win dow. If an un expected win dow appears at validat ion or playback, you m ust m odify th e script to h an dle th e win dow even t. To sim plify th e scriptin g process, record a tem porary session an d con vert it to a script. Th is sh ould be a session wh ere th e un expected win dow appears so t h at th e user m ust in teract, for exam ple, with a m ouse click or keyboard en try, to dism iss th e in term itten t win dow. Note th e location in th e playback scri pt wh ere th e presen ce of th e in term itten t win dow preven ted th e script from con tin uin g. Th is is wh ere code is added to th e script. Do th e followin g if a validation or playback session i n dicates an un expected win dow appeared th at requires user in teraction : ! Record a temporary script where the unexpected window event appears. ! Convert the original session to a script. ! Modify the original script with a section of the temporary script. To r ecor d a t em p or ar y scr i p t : Sim plify th e scriptin g effort required by doin g th e followin g: 1. Record a tem porary session of th e tran saction . Th is sh ould in clude th e appearan ce of th e in term itten t win dow an d th e subsequen t user in teraction th at dism isses th e win dow. 2. Add a com m en t wh en th e win dow appears an d before th e win dow is dism issed. 3. Give th e successful record session a tem porary n am e. 4. Click Opt i on s>Con vert , an d click OK to con vert th e session to a script. To m od i f y t h e or i g i n al scr i p t : Extract a sm all section of th e tem porary script code an d in sert it in to th e origin al script. 1. Iden tify th e location in th e origin al script wh ere th e un expected win dow appeared. You can do th is by n otin g th e last win dow th at was successfully creat ed before validation failure. Tip: Note the location with a code-style comment. This is the location where you paste in code from the temporary script. 52 QALoad On lin e Help 2. Iden tify th e code in th e tem porary script th at creates th e Citrix win dow object. Th is code is in th e section labeled / * Citrix W in dow In form ation Obj ects */ an d can be iden tified by th e n am e param eter. 3. Cut an d paste th is lin e in to th e correspon din g secti on in th e origin al script. 4. M odify th e lin e pasted in to th e origin al script, givin g th e statem en t a un ique Citrix win dow iden tifier. Not e: This identifier, CWI_n, must be a unique value in the original script or the script will not compile. 5. Fin d th e lin e in th e tem porary script th at deletes th e Citrix win dow object. Th is code is after th e END_TRANSACTION call. 6. Copy th is lin e to th e sam e location in th e origin al script an d m odify it with th e un ique Citrix win dow iden tifier from Step 4. 7. Add a special version of t h e CtxSetW in dowM atch Title com m an d in th e origin al script in th e location wh ere th e origin al script failed because of th e in term itten t win dow. Th is is wh ere th e win dow m ust be recogn ized an d dism issed, if it exists. Th e first param eter is th e Citrix win dow object iden tifier from Step 2. Th e secon d param eter is an asteri sk en closed in double quotes (“ *” ). Th is param et er en sures th at com m an ds like CtxClick work with an y m atch ed win dow, even if th e in term itten t win dow does n ot exist. 9. Iden tify th e code th at dism isses th is win dow in th e tem porary script by scroll in g to th e com m en t you in serted durin g capture, an d backtrackin g un til you fin d th e correct CtxW aitForW in dowCreate statem en t. Usually th is code con sists of eith er a set of CtxPoin t an d CtxClick or on e or m ore keyboard en try calls after th e win dow create even t. Caut ion: Do not include the CtxWaitForWindowCreate statement. 10. Copy th e code from th e t em porary scri pt an d paste it after th e CtxSetW in dowM atch Title call added in Step 5. En sure th at th e Citrix win dow object param eter for th ese calls is th e Citrix win dow object iden tifier from Step 2. Conclusion Followin g th ese tech n iques, you can m odify a sessi on to h an dle th e appearan ce of in term itten t win dows th at require user action to dism iss. Th e sam ple scripts illustrate th is process. Sam ple: Origin al Citrix Script for In term itten t W in dows Th e followin g is an exam ple of an origin al Citrix script con verted from capture. Poin ts of in terest in the script are h igh ligh ted in bold. Sample Script /* * intermittent_original.cpp * * Script Converted on April 18, 2005 at 03:23:41 PM * Generated by Compuware QALoad convert module version 5.5.0 build 256 * * This script contains support for the following middlewares: * - Citrix */ /* Converted using the following options: * General: * Line Split : 80 characters * Sleep Seconds : 1 53 Usin g th e Player, Script Developm en t W orkben ch , an d An alyze * Auto Checkpoints * Citrix * General Options * Replay Output Mode * Enable Counters * Timeout Value Options * Connect Timeout (s) * Disconnect Timeout (s) * Window Creation Timeout (s) * Ping Timeout (s) * Wait Point Timeout (s) * Input Options * Combine Keyboard Input * Combine Mouse Input * Window Options * Window Verification * Window Max Retries * Window Wait Retries (ms) * Enable Wildcard Title Match */ : No : : : : : : : : : : : : : : : : : Normal No 60 60 30 20 30 Yes Yes Yes 5 5000 Yes #define CITRIX_CLIENT_VERSION "7.100.21825" #define CITRIX_ICO_VERSION "2.3" #define SCRIPT_VER 0x00000505UL #include <stdio.h> #include "smacro.h" #include "do_citrix.h" /* set function to call on abort*/ void abort_function(PLAYER_INFO *s_info); #ifndef NULL #define NULL #endif 0 extern "C" int rhobot_script(PLAYER_INFO *s_info) { /* Declare Variables */ const char *CitrixServer = "qaccitrix"; const char *CitrixPassword = ""; const int CitrixOutputMode = OUTPUT_MODE_NORMAL; /* Citrix Window Information Objects */ CtxWI *CWI_1 = new CtxWI(0x1001c, "Warning !!", 107, 43, 427, 351); CtxWI *CWI_2 = new CtxWI(0x2001c, "Log On to Windows", 111, 65, 418, 285); CtxWI *CWI_3 = new CtxWI(0x5001c, "Please wait...", 111, 112, 418, 145); CtxWI *CWI_4 = new CtxWI(0x30030, "Citrix License Warning Notice", 125, 198, 397, 127); CtxWI *CWI_5 = new CtxWI(0x40030, "Citrix License Warning Notice", 125, 198, 397, 127); CtxWI *CWI_6 = new CtxWI(0x4002e, "UsrLogon.Cmd", 0, 456, 161, 25); CtxWI *CWI_7 = new CtxWI(0x1003a, "", -2, 452, 645, 31); CtxWI *CWI_8 = new CtxWI(0x10052, "Program Manager", 0, 0, 641, 481); CtxWI *CWI_9 = new CtxWI(0x100b8, "", 115, 0, 405, 457); CtxWI *CWI_10 = new CtxWI(0x7001c, "Please wait...", 111, 112, 418, 145); /// A line will be copied and modified here to create the new Citrix window object SET_ABORT_FUNCTION(abort_function); DEFINE_TRANS_TYPE("intermittent_original.cpp"); CitrixInit(1); /* Citrix replay settings */ CtxSetConnectTimeout(60); CtxSetDisconnectTimeout(60); 54 QALoad On lin e Help CtxSetWindowTimeout(30); CtxSetPingTimeout(20); CtxSetWaitPointTimeout(30); CtxSetWindowVerification(TRUE); CtxSetEnableCounters(FALSE); CtxSetWindowRetries(5, 5000); CtxSetEnableWildcardMatching(TRUE); SYNCHRONIZE(); BEGIN_TRANSACTION(); DO_SetTransactionStart(); CtxConnect(CitrixServer, CitrixOutputMode); // Window CWI_1 ("Warning !!") created 1113852175.329 CtxWaitForWindowCreate(CWI_1, 2047); DO_MSLEEP(1203); CtxPoint(162, 161); //1113852176.561 DO_MSLEEP(31); CtxClick(CWI_1, 79, L_BUTTON, NONE); //1113852176.639 DO_MSLEEP(718); CtxPoint(323, 362); //1113852177.451 DO_MSLEEP(94); CtxClick(CWI_1, 63, L_BUTTON, NONE); //1113852177.513 // Window CWI_2 ("Log On to Windows") created 1113852177.638 CtxWaitForWindowCreate(CWI_2, 125); // Window CWI_1 ("Warning !!") destroyed 1113852177.638 CtxType(CWI_2, "citr"); DO_MSLEEP(2625); CtxType(CWI_2, "ix"); DO_MSLEEP(343); CtxPoint(324, 362); //1113852180.291 //1113852180.790 //1113852180.790 CtxTypeVK(CWI_2, VK_TAB, NONE); DO_MSLEEP(266); CtxType(CWI_2, "citrix"); //1113852182.194 DO_MSLEEP(1078); CtxTypeVK(CWI_2, VK_TAB, NONE); DO_MSLEEP(281); CtxType(CWI_2, "q"); //1113852180.868 //1113852182.225 //1113852183.692 DO_MSLEEP(1078); DO_MSLEEP(844); CtxPoint(263, 324); //1113852184.176 DO_MSLEEP(31); CtxClick(CWI_2, 79, L_BUTTON, NONE); //1113852184.254 55 Usin g th e Player, Script Developm en t W orkben ch , an d An alyze DO_MSLEEP(109); // Window CWI_2 ("Log On to Windows") destroyed 1113852184.363 // Window CWI_3 ("Please wait...") created 1113852184.394 CtxWaitForWindowCreate(CWI_3, 16); // Window CWI_4 ("Citrix License Warning Notice") created 1113852184.457 CtxWaitForWindowCreate(CWI_4, 78); // Window CWI_3 ("Please wait...") destroyed 1113852184.472 // Window CWI_5 ("Citrix License Warning Notice") created 1113852184.566 CtxWaitForWindowCreate(CWI_5, 109); // Window CWI_6 ("UsrLogon.Cmd") created 1113852184.566 CtxWaitForWindowCreate(CWI_6, 0); // Window CWI_4 ("Citrix License Warning Notice") destroyed 1113852184.566 DO_MSLEEP(31); // Window CWI_6 ("UsrLogon.Cmd") destroyed 1113852184.597 // Window CWI_7 ("") created 1113852184.878 // Window CWI_8 ("Program Manager") created 1113852184.941 CtxWaitForWindowCreate(CWI_8, 0); CtxPoint(195, 192); //1113852186.891 // Window CWI_9 ("") created 1113852186.891 DO_MSLEEP(516); CtxPoint(316, 271); //1113852187.406 CtxMouseDown(CWI_5, L_BUTTON, NONE, 316, 271); // 1113852187.406 CtxMouseUp(CWI_5, L_BUTTON, NONE, 317, 278); //1113852187.515 DO_MSLEEP(219); CtxPoint(317, 287); //1113852187.671 DO_MSLEEP(46); CtxClick(CWI_5, 63, L_BUTTON, NONE); //1113852187.734 DO_MSLEEP(62); // Window CWI_5 ("Citrix License Warning Notice") destroyed 1113852187.796 /// Below is the last statement that executed prior to script failure /// This is where the code to identify and dismiss the window will be added. DO_MSLEEP(829); CtxPoint(555, 200); //1113852188.639 DO_MSLEEP(15); CtxClick(CWI_9, 94, L_BUTTON, NONE); //1113852188.732 DO_MSLEEP(875); CtxPoint(555, 199); 56 //1113852189.934 QALoad On lin e Help DO_MSLEEP(328); // Window CWI_9 ("") destroyed 1113852189.934 DO_MSLEEP(19766); CtxPoint(337, 157); //1113852210.000 DO_MSLEEP(328); // Window CWI_9 ("Program Manager") destroyed 1113852210.000 // Window CWI_7 ("") destroyed 1113852210.016 // Window CWI_10 ("Please wait...") created 1113852210.266 CtxWaitForWindowCreate(CWI_10, 0); DO_SetTransactionCleanup(); CtxDisconnect(); END_TRANSACTION(); delete CWI_1; // "Warning !!" delete CWI_2; // "Log On to Windows" delete CWI_3; // "Please wait..." delete CWI_4; // "Citrix License Warning Notice" delete CWI_5; // "Citrix License Warning Notice" delete CWI_6; // "UsrLogon.Cmd" delete CWI_7; // "" delete CWI_8; // "Program Manager" delete CWI_9; // "" delete CWI_10; // "Please wait..." /// A line will be copied here and modified to delete the Citrix window object. CitrixUninit(); EXIT(); return(0); } void abort_function(PLAYER_INFO *s_info) { RR__printf("Virtual User ABORTED."); CitrixUninit(); EXIT(); } Sam ple: M odified Citrix Script to Han dle In term itten t W in dow Th e followin g is an exam ple of a m odified Citrix script to h an dle an in term itten t win dow. Ch an ges to Origin al script are h igh ligh ted in bold. Sample Script /* * intermittent_original.cpp * * Script Converted on April 18, 2005 at 03:23:41 PM * Generated by Compuware QALoad convert module version 5.5.0 build 256 * * This script contains support for the following middlewares: * - Citrix */ /* Converted using the following options: 57 Usin g th e Player, Script Developm en t W orkben ch , an d An alyze * General: * Line Split * Sleep Seconds * Auto Checkpoints * Citrix * General Options * Replay Output Mode * Enable Counters * Timeout Value Options * Connect Timeout (s) * Disconnect Timeout (s) * Window Creation Timeout (s) * Ping Timeout (s) * Wait Point Timeout (s) * Input Options * Combine Keyboard Input * Combine Mouse Input * Window Options * Window Verification * Window Max Retries * Window Wait Retries (ms) * Enable Wildcard Title Match */ : 80 characters : 1 : No : : : : : : : : : : : : : : : : : Normal No 60 60 30 20 30 Yes Yes Yes 5 5000 Yes #define CITRIX_CLIENT_VERSION "7.100.21825" #define CITRIX_ICO_VERSION "2.3" #define SCRIPT_VER 0x00000505UL #include <stdio.h> #include "smacro.h" #include "do_citrix.h" /* set function to call on abort*/ void abort_function(PLAYER_INFO *s_info); #ifndef NULL #define NULL #endif 0 extern "C" int rhobot_script(PLAYER_INFO *s_info) { /* Declare Variables */ const char *CitrixServer = "qaccitrix"; const char *CitrixPassword = ""; const int CitrixOutputMode = OUTPUT_MODE_NORMAL; /* Citrix Window Information Objects */ CtxWI *CWI_1 = new CtxWI(0x1001c, "Warning !!", 107, 43, 427, 351); CtxWI *CWI_2 = new CtxWI(0x2001c, "Log On to Windows", 111, 65, 418, 285); CtxWI *CWI_3 = new CtxWI(0x5001c, "Please wait...", 111, 112, 418, 145); CtxWI *CWI_4 = new CtxWI(0x30030, "Citrix License Warning Notice", 125, 198, 397, 127); CtxWI *CWI_5 = new CtxWI(0x40030, "Citrix License Warning Notice", 125, 198, 397, 127); CtxWI *CWI_6 = new CtxWI(0x4002e, "UsrLogon.Cmd", 0, 456, 161, 25); CtxWI *CWI_7 = new CtxWI(0x1003a, "", -2, 452, 645, 31); CtxWI *CWI_8 = new CtxWI(0x10052, "Program Manager", 0, 0, 641, 481); CtxWI *CWI_9 = new CtxWI(0x100b8, "", 115, 0, 405, 457); CtxWI *CWI_10 = new CtxWI(0x7001c, "Please wait...", 111, 112, 418, 145); /// This line was added from the temporary script and modified so the Citrix window variable is unique for the original script. CtxWI *CWI_99 = new CtxWI(0x10066, "ICA Seamless Host Agent", 0, 0, 391, 224); SET_ABORT_FUNCTION(abort_function); DEFINE_TRANS_TYPE("intermittent_original.cpp"); 58 QALoad On lin e Help CitrixInit(1); /* Citrix replay settings */ CtxSetConnectTimeout(60); CtxSetDisconnectTimeout(60); CtxSetWindowTimeout(30); CtxSetPingTimeout(20); CtxSetWaitPointTimeout(30); CtxSetWindowVerification(TRUE); CtxSetEnableCounters(FALSE); CtxSetWindowRetries(5, 5000); CtxSetEnableWildcardMatching(TRUE); SYNCHRONIZE(); BEGIN_TRANSACTION(); DO_SetTransactionStart(); CtxConnect(CitrixServer, CitrixOutputMode); // Window CWI_1 ("Warning !!") created 1113852175.329 CtxWaitForWindowCreate(CWI_1, 2047); DO_MSLEEP(1203); CtxPoint(162, 161); //1113852176.561 DO_MSLEEP(31); CtxClick(CWI_1, 79, L_BUTTON, NONE); //1113852176.639 DO_MSLEEP(718); CtxPoint(323, 362); //1113852177.451 DO_MSLEEP(94); CtxClick(CWI_1, 63, L_BUTTON, NONE); //1113852177.513 // Window CWI_2 ("Log On to Windows") created 1113852177.638 CtxWaitForWindowCreate(CWI_2, 125); // Window CWI_1 ("Warning !!") destroyed 1113852177.638 CtxType(CWI_2, "citr"); DO_MSLEEP(2625); CtxType(CWI_2, "ix"); DO_MSLEEP(343); CtxPoint(324, 362); //1113852180.291 //1113852180.790 //1113852180.790 CtxTypeVK(CWI_2, VK_TAB, NONE); DO_MSLEEP(266); CtxType(CWI_2, "citrix"); //1113852182.194 DO_MSLEEP(1078); CtxTypeVK(CWI_2, VK_TAB, NONE); DO_MSLEEP(281); CtxType(CWI_2, "q"); //1113852180.868 //1113852182.225 //1113852183.692 DO_MSLEEP(1078); DO_MSLEEP(844); 59 Usin g th e Player, Script Developm en t W orkben ch , an d An alyze CtxPoint(263, 324); //1113852184.176 DO_MSLEEP(31); CtxClick(CWI_2, 79, L_BUTTON, NONE); //1113852184.254 DO_MSLEEP(109); // Window CWI_2 ("Log On to Windows") destroyed 1113852184.363 // Window CWI_3 ("Please wait...") created 1113852184.394 CtxWaitForWindowCreate(CWI_3, 16); // Window CWI_4 ("Citrix License Warning Notice") created 1113852184.457 CtxWaitForWindowCreate(CWI_4, 78); // Window CWI_3 ("Please wait...") destroyed 1113852184.472 // Window CWI_5 ("Citrix License Warning Notice") created 1113852184.566 CtxWaitForWindowCreate(CWI_5, 109); // Window CWI_6 ("UsrLogon.Cmd") created 1113852184.566 CtxWaitForWindowCreate(CWI_6, 0); // Window CWI_4 ("Citrix License Warning Notice") destroyed 1113852184.566 DO_MSLEEP(31); // Window CWI_6 ("UsrLogon.Cmd") destroyed 1113852184.597 // Window CWI_7 ("") created 1113852184.878 DO_MSLEEP(282); // Window CWI_9 ("Program Manager") created 1113852184.941 CtxWaitForWindowCreate(CWI_8, 0); CtxPoint(195, 192); //1113852186.891 // Window CWI_10 ("") created 1113852186.891 DO_MSLEEP(516); CtxPoint(316, 271); //1113852187.406 CtxMouseDown(CWI_5, L_BUTTON, NONE, 316, 271); // 1113852187.406 CtxMouseUp(CWI_5, L_BUTTON, NONE, 317, 278); //1113852187.515 DO_MSLEEP(219); CtxPoint(317, 287); //1113852187.671 DO_MSLEEP(46); CtxClick(CWI_5, 63, L_BUTTON, NONE); //1113852187.734 DO_MSLEEP(62); // Window CWI_5 ("Citrix License Warning Notice") destroyed 1113852187.796 /// This is the location where the code to set the intermittent /// window match name is added. CtxSetWindowMatchTitle( CWI_99, “*” ); /// The location where the code to dismiss the code was copied from 60 QALoad On lin e Help /// the temporary script. The parameter for the CtxClick command /// was corrected with the Citrix window object variable. DO_MSLEEP(14000); CtxPoint(178, 194); //1113851799.788 DO_MSLEEP(47); CtxClick(CWI_8, 63, L_BUTTON, NONE); //1113851799.866 DO_MSLEEP(829); CtxPoint(555, 200); //1113852188.639 DO_MSLEEP(15); CtxClick(CWI_9, 94, L_BUTTON, NONE); //1113852188.732 DO_MSLEEP(875); CtxPoint(555, 199); //1113852189.934 DO_MSLEEP(328); // Window CWI_10 ("") destroyed 1113852189.934 DO_MSLEEP(19766); CtxPoint(337, 157); //1113852210.000 DO_MSLEEP(328); // Window CWI_9 ("Program Manager") destroyed 1113852210.000 // Window CWI_7 ("") destroyed 1113852210.016 // Window CWI_11 ("Please wait...") created 1113852210.266 CtxWaitForWindowCreate(CWI_10, 0); DO_SetTransactionCleanup(); CtxDisconnect(); END_TRANSACTION(); delete CWI_1; // "Warning !!" delete CWI_2; // "Log On to Windows" delete CWI_3; // "Please wait..." delete CWI_4; // "Citrix License Warning Notice" delete CWI_5; // "Citrix License Warning Notice" delete CWI_6; // "UsrLogon.Cmd" delete CWI_7; // "" delete CWI_8; // "ICA Seamless Host Agent" delete CWI_9; // "Program Manager" delete CWI_10; // "" delete CWI_11; // "Please wait..." /// The code copied and modified to delete the Citrix window object. delete CWI_99; CitrixUninit(); EXIT(); return(0); } void abort_function(PLAYER_INFO *s_info) { RR__printf("Virtual User ABORTED."); CitrixUninit(); EXIT(); 61 Usin g th e Player, Script Developm en t W orkben ch , an d An alyze } Sam ple: Tem porary Citrix Script with W in dow Creation an d Dism issal Th e followin g is an exam ple of a tem porary Citrix script with win dow creation an d dism issal. Code to be iden tified an d copied from th e tem porary script is h igh lighted in bold. Sample Script /* * intermittent_temporary.cpp * * Script Converted on April 18, 2005 at 03:16:57 PM * Generated by Compuware QALoad convert module version 5.5.0 build 256 * * This script contains support for the following middlewares: * - Citrix */ /* Converted using the following options: * General: * Line Split : 80 characters * Sleep Seconds : 1 * Auto Checkpoints : No * Citrix * General Options : * Replay Output Mode : Normal * Enable Counters : No * Timeout Value Options : * Connect Timeout (s) : 60 * Disconnect Timeout (s) : 60 * Window Creation Timeout (s) : 30 * Ping Timeout (s) : 20 * Wait Point Timeout (s) : 30 * Input Options : * Combine Keyboard Input : Yes * Combine Mouse Input : Yes * Window Options : * Window Verification : Yes * Window Max Retries : 5 * Window Wait Retries (ms) : 5000 * Enable Wildcard Title Match : Yes */ #define CITRIX_CLIENT_VERSION "7.100.21825" #define CITRIX_ICO_VERSION "2.3" #define SCRIPT_VER 0x00000505UL #include <stdio.h> #include "smacro.h" #include "do_citrix.h" /* set function to call on abort*/ void abort_function(PLAYER_INFO *s_info); #ifndef NULL #define NULL #endif 0 extern "C" int rhobot_script(PLAYER_INFO *s_info) { /* Declare Variables */ const char *CitrixServer = "qaccitrix"; const char *CitrixPassword = ""; const int CitrixOutputMode = OUTPUT_MODE_NORMAL; 62 QALoad On lin e Help /* Citrix Window Information Objects */ CtxWI *CWI_1 = new CtxWI(0x1001c, "Warning !!", 107, 43, 427, 351); CtxWI *CWI_2 = new CtxWI(0x2001c, "Log On to Windows", 111, 65, 418, 285); CtxWI *CWI_3 = new CtxWI(0x5001c, "Please wait...", 111, 112, 418, 145); CtxWI *CWI_4 = new CtxWI(0x30030, "Citrix License Warning Notice", 125, 198, 397, 127); CtxWI *CWI_5 = new CtxWI(0x40030, "Citrix License Warning Notice", 125, 198, 397, 127); CtxWI *CWI_6 = new CtxWI(0x4002e, "UsrLogon.Cmd", 0, 456, 161, 25); CtxWI *CWI_7 = new CtxWI(0x1003a, "", -2, 452, 645, 31); /// The code line to copy to the original script. CtxWI *CWI_8 = new CtxWI(0x10066, "ICA Seamless Host Agent", 0, 0, 391, 224); CtxWI *CWI_9 = new CtxWI(0x10052, "Program Manager", 0, 0, 641, 481); CtxWI *CWI_10 = new CtxWI(0x10084, "", 115, 0, 405, 457); SET_ABORT_FUNCTION(abort_function); DEFINE_TRANS_TYPE("intermittent_temporary.cpp"); CitrixInit(1); /* Citrix replay settings */ CtxSetConnectTimeout(60); CtxSetDisconnectTimeout(60); CtxSetWindowTimeout(30); CtxSetPingTimeout(20); CtxSetWaitPointTimeout(30); CtxSetWindowVerification(TRUE); CtxSetEnableCounters(FALSE); CtxSetWindowRetries(5, 5000); CtxSetEnableWildcardMatching(TRUE); SYNCHRONIZE(); BEGIN_TRANSACTION(); DO_SetTransactionStart(); CtxConnect(CitrixServer, CitrixOutputMode); CtxPoint(120, 159); //1113851768.564 // Window CWI_1 ("Warning !!") created 1113851768.564 CtxWaitForWindowCreate(CWI_1, 2063); DO_MSLEEP(766); CtxPoint(313, 361); //1113851769.344 DO_MSLEEP(31); CtxClick(CWI_1, 62, L_BUTTON, NONE); //1113851769.407 // Window CWI_2 ("Log On to Windows") created 1113851769.454 CtxWaitForWindowCreate(CWI_2, 47); // Window CWI_1 ("Warning !!") destroyed 1113851769.454 CtxType(CWI_2, "citrix"); //1113851774.556 DO_MSLEEP(4891); CtxTypeVK(CWI_2, VK_TAB, NONE); DO_MSLEEP(281); CtxType(CWI_2, "citrix"); //1113851774.618 //1113851776.460 63 Usin g th e Player, Script Developm en t W orkben ch , an d An alyze DO_MSLEEP(1594); CtxTypeVK(CWI_2, VK_TAB, NONE); DO_MSLEEP(312); CtxType(CWI_2, "q"); //1113851776.522 //1113851779.627 DO_MSLEEP(2469); DO_MSLEEP(953); CtxPoint(231, 322); //1113851780.017 DO_MSLEEP(78); CtxMouseDown(CWI_2, L_BUTTON, NONE, 231, 322); // 1113851780.017 CtxMouseUp(CWI_2, L_BUTTON, NONE, 231, 321); //1113851780.080 DO_MSLEEP(16); CtxPoint(231, 321); //1113851780.127 DO_MSLEEP(94); // Window CWI_2 ("Log On to Windows") destroyed 1113851780.127 // Window CWI_3 ("Please wait...") created 1113851780.236 CtxWaitForWindowCreate(CWI_3, 109); // Window CWI_4 ("Citrix License Warning Notice") created 1113851780.298 CtxWaitForWindowCreate(CWI_4, 63); // Window CWI_3 ("Please wait...") destroyed 1113851780.298 // Window CWI_5 ("Citrix License Warning Notice") created 1113851780.314 CtxWaitForWindowCreate(CWI_5, 15); // Window CWI_6 ("UsrLogon.Cmd") created 1113851780.330 CtxWaitForWindowCreate(CWI_6, 16); // Window CWI_4 ("Citrix License Warning Notice") destroyed 1113851780.330 DO_MSLEEP(78); // Window CWI_6 ("UsrLogon.Cmd") destroyed 1113851780.408 // Window CWI_7 ("") created 1113851780.766 DO_MSLEEP(344); // Window CWI_8 ("ICA Seamless Host Agent") created 1113851780.766 CtxWaitForWindowCreate(CWI_8, 15); // Window CWI_9 ("Program Manager") created 1113851780.766 CtxWaitForWindowCreate(CWI_9, 0); DO_MSLEEP(891); CtxPoint(333, 300); //1113851781.718 DO_MSLEEP(62); CtxClick(CWI_5, 141, L_BUTTON, NONE); //1113851781.859 DO_MSLEEP(156); CtxPoint(261, 250); 64 //1113851782.186 QALoad On lin e Help DO_MSLEEP(172); // Window CWI_5 ("Citrix License Warning Notice") destroyed 1113851782.186 CtxPoint(303, 251); //1113851782.811 // Window CWI_10 ("") created 1113851782.811 DO_MSLEEP(625); DO_MSLEEP(2078); CtxPoint(518, 254); //1113851785.760 DO_MSLEEP(875); // Window CWI_10 ("") destroyed 1113851785.760 /// The following code dismisses the “ICA Seamless Host Agent”. /// Copy the bold section below to the original script. /// The DO_MSLEEP comments can also be copied. DO_MSLEEP(14000); CtxPoint(178, 194); //1113851799.788 DO_MSLEEP(47); CtxClick(CWI_8, 63, L_BUTTON, NONE); //1113851799.866 /// End of code section to copy. DO_MSLEEP(125); CtxPoint(183, 197); //1113851799.975 // Window CWI_8 ("ICA Seamless Host Agent") destroyed 1113851799.975 DO_MSLEEP(1250); CtxPoint(609, 12); //1113851804.469 DO_MSLEEP(3250); // Window CWI_9 ("Program Manager") destroyed 1113851804.469 // Window CWI_7 ("") destroyed 1113851804.469 DO_SetTransactionCleanup(); CtxDisconnect(); END_TRANSACTION(); delete CWI_1; // "Warning !!" delete CWI_2; // "Log On to Windows" delete CWI_3; // "Please wait..." delete CWI_4; // "Citrix License Warning Notice" delete CWI_5; // "Citrix License Warning Notice" delete CWI_6; // "UsrLogon.Cmd" delete CWI_7; // "" /// Copy this code to the original script to delete the Citrix window object. delete CWI_8; // "ICA Seamless Host Agent" delete CWI_9; // "Program Manager" delete CWI_10; // "" CitrixUninit(); EXIT(); return(0); } void abort_function(PLAYER_INFO *s_info) { RR__printf("Virtual User ABORTED."); 65 Usin g th e Player, Script Developm en t W orkben ch , an d An alyze CitrixUninit(); EXIT(); } Un ex pect ed Even t s Un expected Even ts in Citrix Th e CtxW in dowEven tExists an d CtxScreen Even tExists com m an ds can be used to h an dle un expected win dow an d screen even t s in Citrix scripts. W h en th ere is a possibility of un expected dialogs appearin g or un expected screen even ts occurrin g, you m ust m odi fy th e script to respon d to th e ch an ges an d con tin ue th e load test. For exam ple, if a script open s a M icrosoft W ord docum en t th at resides on a n etwork, an d th at docum en t is already open by an oth er n etwork user, an un expected dialog box appears th at prom pts th e user to ch oose between con tin uin g to open th e docum en t in read-on ly m ode or to can cel it. To preven t script failure, m odification s can be m ade in th e script to h an dle t h e dialog boxes th at appear in th is situation . Gen erally, to h an dle un expected even ts, you record two scripts. Th e first script con tain s a recordin g of th e expected even ts. Th e secon d script sh ould in clude t h e un expected even ts. Usin g th e CtxW in dowEven tExists an d CtxScreen Even tExists fun ction s, create a con diti on al block of code th at h an dles th e dialogs th at m ay appear. M odifyin g th e Script to Han dle Un expected Even ts Un expected Citrix even ts th at were n ot recorded in th e origin al script can occur durin g a playback sessi on . Th ese can in clude In term i tten t W in dows or applicat ion win dows th at m ay appear based on th e user’s session state. For exam ple, th e calculator application m ay already be presen t wh en th e Citrix user logs on a session , or th e user m ay n eed to in voke th e applicat ion . W h en th ere is th e possibility of un expected even ts occurrin g, you m ust m odi fy th e script to respon d to th e ch an ges an d con tin ue th e load test. Use th e CtxW in dowEven tExists fun ction to create a con dition al block of code th at h an dles th e un expected dialogs. W h en you m odify a script to h an dle un expect ed even ts, you m ust: ! Perform an initial validation of the script. ! Record a temporary script to capture the unexpected event. ! Modify the original script to include and handle the unexpected event. ! Re-validate the script. Not e: You may need to configure the workbench and player for validation. To p er f or m an i n i t i al val i d at i on : 1. Click Session>Validate to validate the script. This is when an unexpected event can cause sporadic failure during validation or playback. 2. Identify the sporadic event visually so that you can recognize it in a later record session. To r ecor d a t em p or ar y scr i p t : 1. 66 Click Options>Record to record a second script that recreates the unexpected event. Successive sessions should be recorded until the unexpected event occurs. QALoad On lin e Help 2. In sert com m en ts at two poin ts: ! W h ere th e even t is first recogn ized. ! W h ere th e even t is acted on an d th e Citrix session state an d an y win dow stat es h ave return ed to th e state before th e even t occurred. Not e: You may need to position the mouse over a window or control, such as a button, before inserting the second comment. (See Scripting Mouse Events.) 3. Give this capture a name to denote this session’s temporary status. 4. Click Options>Convert, then click OK to convert the session to a script. To m od i f y t h e or i g i n al scr i p t w i t h cod e f r om t h e t em p or ar y scr i p t : Follow th ese steps to in sert script code from th e tem porary scri pt th at h an dles th e un expected even t. 1. Insert a code comment in the original script where the unexpected event occurred. 2. Copy the code between the two comments in the temporary script and paste it into the original script at the location of the unexpected event you identified. Not e: Comments ensure that the pasted code is clearly marked in the script. 3. Identify any Citrix window objects that exist in API calls in the pasted code snippet. For each object, do one of the following: ! If th e win dow object is wh olly con tain ed, both created an d destroyed, in th e pasted code sn ippet: a. Identify the Citrix window creation and deletion lines of code in the temporary script. b. Copy these lines to the original script. This is the creation line in the /* Citrix Window Information Objects */ section and the deletion line after the END_TRANSACTION call. c. Give the Citrix window object variable a unique variable name. d. name. Change all variable references to the Citrix window in the pasted code snippet API calls to the new variable ! If th e win dow object referen ced in a pasted API call is an action on an existin g win dow object in th e origin al script, m odify all API calls in th e pasted calls to refer to th e vari able n am e of th e Citrix win dow object in th e origin al script. 4. Before the code snippet, add a conditional check to see if the unexpected window event has occurred. Use the CtxWindowEventExists API call in an If conditional, where if the result is TRUE, a block of code is executed. Then add a BeginBlock on the next line. BeginBlock is logically identical to the C begin brace “{“. After the code snippet, add an EndBlock. EndBlock is logically identical to the C end brace “}“. 5. Not e: If there is code in the original script that should not be executed if the condition is TRUE, put this code in an Else block within the BeginBlock and EndBlock calls. To r e-val i d at e t h e scr i p t : 1. Click Session>Compile to compile the script after making scripting changes. 2. Click Session>Validate Script to validate the script. Make sure that validation succeeds when the unexpected event occurs and when the event does not occur. Conclusion Followin g th ese tech n iques, you can m odify scripts to h an dle un expect ed even ts th at occur durin g playback. Scriptin g aroun d un expected even ts allows you to perform load testin g for com plex user scen arios. Th e followin g sam ple scri pts illustrate th is process: 67 Usin g th e Player, Script Developm en t W orkben ch , an d An alyze Sam ple: Origin al Citrix Scripts for Un expect ed Even ts Th e followin g sam ple sh ows two exam ples of an un expected Citrix even t. In th e first exam ple, th e calculator application m ust be started in th e origin al script. Th e secon d exam ple h as a session wh ere th e calculator application is already presen t wh en th e user logs on . Poin ts of in terest in th e script are h igh lighted in bold. Example 1: Original Record Script with No Calculator Application Present at Logon /* * CalculatorCreateNew.cpp * * Script Converted on May 17, 2004 at 12:33:36 PM * Generated by Compuware QALoad convert module version 5.2.0 build 33 * * This script contains support for the following middlewares: * - Citrix */ /* Converted using the following options: * General: * Line Split : 80 characters * Sleep Seconds : 1 * Auto Checkpoints : No * Citrix * General Options : * Window Verification : Yes * Session Timeouts : Yes * Connect Timeout (s) : 60 * Disconnect Timeout (s) : 60 * Window Creation Timeout (s) : 30 * Ping Timeout (s) : 20 * Wait Point Timeout (s) : 30 * Include Wait Points : Yes * Enable Counters : No * Include Unnamed Windows : Yes * Output Mode : Normal * Input Options : * Combine Keyboard Input : Yes * Combine Mouse Input : Yes */ #define CITRIX_CLIENT_VERSION "7.100.21825" #define CITRIX_ICO_VERSION "2.3" #define SCRIPT_VER 0x00000205UL #include <stdio.h> #include "smacro.h" #include "do_citrix.h" /* set function to call on abort*/ void abort_function(PLAYER_INFO *s_info); #ifndef NULL #define NULL 0 #endif extern "C" int rhobot_script(PLAYER_INFO *s_info) { /* Declare Variables */ const char *CitrixServer = "qaccitrix2"; const int CitrixOutputMode = OUTPUT_MODE_NORMAL; /* Citrix Window Information Objects */ CtxWI *CWI_1 = new CtxWI(0x1001a, "Warning !!", 107, 43, 427, 351); CtxWI *CWI_2 = new CtxWI(0x2001a, "Log On to Windows", 111, 65, 418, 285); CtxWI *CWI_3 = new CtxWI(0x3002e, "Please wait...", 111, 112, 418, 145); 68 QALoad On lin e Help CtxWI CtxWI CtxWI CtxWI CtxWI CtxWI CtxWI CtxWI *CWI_4 = new CtxWI(0x40030, "UsrLogon.Cmd", 0, 456, 161, 25); *CWI_5 = new CtxWI(0x3002c, "", 0, 0, 641, 481); *CWI_6 = new CtxWI(0x20026, "", -2, 452, 645, 31); *CWI_7 = new CtxWI(0x10052, "ICA Seamless Host Agent", 0, 0, 391, 224); *CWI_8 = new CtxWI(0x10048, "Program Manager", 0, 0, 641, 481); *CWI_9 = new CtxWI(0x10084, "", 115, 0, 405, 457); *CWI_10 = new CtxWI(0x20058, "Calculator", 44, 44, 261, 255); *CWI_11 = new CtxWI(0x5002e, "Please wait...", 111, 112, 418, 145); SET_ABORT_FUNCTION(abort_function); DEFINE_TRANS_TYPE("CalculatorCreateNew.cpp"); CitrixInit(1); /* Citrix replay settings */ CtxSetConnectTimeout(60); CtxSetDisconnectTimeout(60); CtxSetWindowTimeout(30); CtxSetPingTimeout(20); CtxSetWaitPointTimeout(30); CtxSetWindowVerification(TRUE); CtxSetEnableCounters(FALSE); CtxSetWindowRetries(5, 5000); CtxSetEnableWildcardMatching(TRUE); SYNCHRONIZE(); BEGIN_TRANSACTION(); CtxConnect(CitrixServer, CitrixOutputMode); DO_MSLEEP(1172); CtxPoint(172, 214); DO_MSLEEP(250); // Window CWI_1 ("Warning !!") created 1084811574.696 CtxWaitForWindowCreate(CWI_1); DO_MSLEEP(906); CtxPoint(308, 359); DO_MSLEEP(156); CtxClick(CWI_1, 78, L_BUTTON, NONE); DO_MSLEEP(63); // Window CWI_2 ("Log On to Windows") created 1084811575.899 CtxWaitForWindowCreate(CWI_2); // Window CWI_1 ("Warning !!") destroyed 1084811575.899 Type(CWI_2, "citrix"); DO_MSLEEP(2547); CtxTypeVK(CWI_2, VK_TAB, NONE); DO_MSLEEP(328); Type(CWI_2, "citrix"); DO_MSLEEP(3015); CtxTypeVK(CWI_2, VK_TAB, NONE); DO_MSLEEP(282); Type(CWI_2, "q"); DO_MSLEEP(703); DO_MSLEEP(1343); 69 Usin g th e Player, Script Developm en t W orkben ch , an d An alyze CtxPoint(247, 322); DO_MSLEEP(110); CtxClick(CWI_2, 62, L_BUTTON, NONE); DO_MSLEEP(391); // Window CWI_2 ("Log On to Windows") destroyed 1084811584.685 DO_MSLEEP(16); // Window CWI_3 ("Please wait...") created 1084811584.701 CtxWaitForWindowCreate(CWI_3); DO_MSLEEP(156); // Window CWI_3 ("Please wait...") destroyed 1084811584.857 DO_MSLEEP(156); // Window CWI_4 ("UsrLogon.Cmd") created 1084811585.013 CtxWaitForWindowCreate(CWI_4); DO_MSLEEP(63); CtxPoint(259, 322); // Window CWI_4 ("UsrLogon.Cmd") destroyed 1084811585.076 DO_MSLEEP(187); CtxPoint(449, 462); DO_MSLEEP(63); // Window CWI_5 ("") created 1084811585.326 DO_MSLEEP(93); // Window CWI_5 ("") destroyed 1084811585.420 DO_MSLEEP(16); // Window CWI_6 ("") created 1084811585.436 DO_MSLEEP(219); // Window CWI_7 ("ICA Seamless Host Agent") created 1084811585.654 CtxWaitForWindowCreate(CWI_7); DO_MSLEEP(15); // Window CWI_8 ("Program Manager") created 1084811585.670 CtxWaitForWindowCreate(CWI_8); DO_MSLEEP(641); CtxPoint(135, 347); DO_MSLEEP(3359); // Window CWI_9 ("") created 1084811589.672 DO_MSLEEP(3032); CtxPoint(192, 216); // Window CWI_9 ("") destroyed 1084811592.705 DO_MSLEEP(921); CtxPoint(190, 199); DO_MSLEEP(63); CtxClick(CWI_6, 78, L_BUTTON, NONE); 70 QALoad On lin e Help DO_MSLEEP(16); // Window CWI_7 ("ICA Seamless Host Agent") destroyed 1084811593.784 /// /// /// /// These methods are, by placement in the script prior to the creation of the calculator window, deduced to be the actions that result in the creation of the Calculator application window. Paying attention to actions performed while recording makes this task easier. DO_MSLEEP(3843); CtxPoint(112, 98); DO_MSLEEP(282); CtxDoubleClick(CWI_8); DO_MSLEEP(110); DO_MSLEEP(140); // Window CWI_10 ("Calculator") created 1084811598.255 /// /// /// /// Scripting Step 1: The calculator window is created at this point Working backward, we deduce that the CtxPoint and CtxDoubleClick API calls created this window. CtxWaitForWindowCreate(CWI_10); DO_MSLEEP(2672); CtxPoint(295, 48); DO_MSLEEP(672); CtxClick(CWI_10, 94, L_BUTTON, NONE); // Window CWI_10 ("Calculator") destroyed 1084811601.694 DO_MSLEEP(1125); CtxPoint(256, 95); DO_MSLEEP(281); // Window CWI_8 ("Program Manager") destroyed 1084811603.101 // Window CWI_6 ("") destroyed 1084811603.101 // Window CWI_11 ("Please wait...") created 1084811603.601 CtxWaitForWindowCreate(CWI_11); CtxDisconnect(); END_TRANSACTION(); delete CWI_1; // "Warning !!" delete CWI_2; // "Log On to Windows" delete CWI_3; // "Please wait..." delete CWI_4; // "UsrLogon.Cmd" delete CWI_5; // "" delete CWI_6; // "" delete CWI_7; // "ICA Seamless Host Agent" delete CWI_8; // "Program Manager" delete CWI_9; // "" delete CWI_10; // "Calculator" delete CWI_11; // "Please wait..." CitrixUninit(); REPORT(SUCCESS); EXIT(); return(0); } 71 Usin g th e Player, Script Developm en t W orkben ch , an d An alyze void abort_function(PLAYER_INFO *s_info) { RR__printf("Virtual User ABORTED."); CitrixUninit(); EXIT(); } Example 2: Original Record Script with Calculator Application Present at Logon Points of interest in the script are highlighted in bold. /* * CalculatorUseExisting.cpp * * Script Converted on May 17, 2004 at 12:35:29 PM * Generated by Compuware QALoad convert module version 5.2.0 build 33 * * This script contains support for the following middlewares: * - Citrix */ /* Converted using the following options: * General: * Line Split : 80 characters * Sleep Seconds : 1 * Auto Checkpoints : No * Citrix * General Options : * Window Verification : Yes * Session Timeouts : Yes * Connect Timeout (s) : 60 * Disconnect Timeout (s) : 60 * Window Creation Timeout (s) : 30 * Ping Timeout (s) : 20 * Wait Point Timeout (s) : 30 * Include Wait Points : Yes * Enable Counters : No * Include Unnamed Windows : Yes * Output Mode : Normal * Input Options : * Combine Keyboard Input : Yes * Combine Mouse Input : Yes */ #define CITRIX_CLIENT_VERSION "7.100.21825" #define CITRIX_ICO_VERSION "2.3" #define SCRIPT_VER 0x00000205UL #include <stdio.h> #include "smacro.h" #include "do_citrix.h" /* set function to call on abort*/ void abort_function(PLAYER_INFO *s_info); #ifndef NULL #define NULL 0 #endif extern "C" int rhobot_script(PLAYER_INFO *s_info) { /* Declare Variables */ const char *CitrixServer = "qaccitrix2"; const int CitrixOutputMode = OUTPUT_MODE_NORMAL; /* Citrix Window Information Objects */ CtxWI *CWI_1 = new CtxWI(0x1001c, "Warning !!", 107, 43, 427, 351); CtxWI *CWI_2 = new CtxWI(0x2001c, "Log On to Windows", 111, 65, 418, 285); CtxWI *CWI_3 = new CtxWI(0x20026, "", -2, 740, 1029, 31); CtxWI *CWI_4 = new CtxWI(0x10136, "Calculator", 154, 154, 261, 253); 72 QALoad On lin e Help CtxWI *CWI_5 = new CtxWI(0x10048, "Program Manager", 0, 0, 1025, 769); CtxWI *CWI_6 = new CtxWI(0x2017c, "ICA Seamless Host Agent", 0, 0, 391, 224); CtxWI *CWI_7 = new CtxWI(0x5002e, "Please wait...", 303, 208, 418, 145); SET_ABORT_FUNCTION(abort_function); DEFINE_TRANS_TYPE("CalculatorUseExisting.cpp"); CitrixInit(1); /* Citrix replay settings */ CtxSetConnectTimeout(60); CtxSetDisconnectTimeout(60); CtxSetWindowTimeout(30); CtxSetPingTimeout(20); CtxSetWaitPointTimeout(30); CtxSetWindowVerification(TRUE); CtxSetEnableCounters(FALSE); CtxSetWindowRetries(5, 5000); CtxSetEnableWildcardMatching(TRUE); SYNCHRONIZE(); BEGIN_TRANSACTION(); CtxConnect(CitrixServer, CitrixOutputMode); DO_MSLEEP(625); CtxPoint(130, 78); DO_MSLEEP(797); // Window CWI_1 ("Warning !!") created 1084811688.065 CtxWaitForWindowCreate(CWI_1); DO_MSLEEP(1813); CtxPoint(309, 365); DO_MSLEEP(203); CtxClick(CWI_1, 140, L_BUTTON, NONE); DO_MSLEEP(63); // Window CWI_2 ("Log On to Windows") created 1084811690.285 CtxWaitForWindowCreate(CWI_2); DO_MSLEEP(15); // Window CWI_1 ("Warning !!") destroyed 1084811690.300 CtxType(CWI_2, "citrix"); DO_MSLEEP(2375); CtxPoint(309, 364); CtxTypeVK(CWI_2, VK_TAB, NONE); DO_MSLEEP(813); CtxType(CWI_2, "citrix"); DO_MSLEEP(1844); CtxTypeVK(CWI_2, VK_TAB, NONE); DO_MSLEEP(328); CtxType(CWI_2, "q"); DO_MSLEEP(672); DO_MSLEEP(1281); CtxPoint(241, 317); 73 Usin g th e Player, Script Developm en t W orkben ch , an d An alyze DO_MSLEEP(125); CtxClick(CWI_2, 141, L_BUTTON, NONE); DO_MSLEEP(406); // Window CWI_2 ("Log On to Windows") destroyed 1084811698.289 DO_MSLEEP(828); CtxPoint(514, 358); DO_MSLEEP(125); // Window CWI_3 ("") created 1084811699.258 DO_MSLEEP(16); // Window CWI_4 ("Calculator") created 1084811699.258 /// /// /// /// /// The following comment inserted during record indicates that the calculator window has appeared in the script. Since it happens before any events after the Logon window was destroyed, we know that in this session, we will not have to start the calculator application – it is already present! /* The calculator has been created at this point in the modified script! */ /// Scripting Step 2: /// The code in bold is cut and pasted into the original script CtxWaitForWindowCreate(CWI_4); // Window CWI_5 ("Program Manager") created 1084811699.258 CtxWaitForWindowCreate(CWI_5); DO_MSLEEP(640); // Window CWI_6 ("ICA Seamless Host Agent") created 1084811699.899 CtxWaitForWindowCreate(CWI_6); DO_MSLEEP(1672); CtxPoint(200, 195); DO_MSLEEP(234); CtxClick(CWI_6, 141, L_BUTTON, NONE); DO_MSLEEP(16); // Window CWI_6 ("ICA Seamless Host Agent") destroyed 1084811701.962 DO_MSLEEP(672); CtxPoint(200, 205); DO_MSLEEP(125); CtxClick(CWI_3, 109, L_BUTTON, NONE); DO_MSLEEP(719); CtxPoint(275, 316); DO_MSLEEP(31); CtxMouseDown(CWI_4, L_BUTTON, NONE, 275, 316); CtxMouseUp(CWI_4, L_BUTTON, NONE, 274, 316); DO_MSLEEP(812); CtxPoint(349, 376); DO_MSLEEP(172); CtxClick(CWI_4, 110, L_BUTTON, NONE); 74 QALoad On lin e Help DO_MSLEEP(1297); CtxPoint(259, 313); DO_MSLEEP(46); CtxClick(CWI_4, 79, L_BUTTON, NONE); DO_MSLEEP(843); CtxPoint(387, 374); CtxMouseDown(CWI_4, L_BUTTON, NONE, 387, 374); CtxMouseUp(CWI_4, L_BUTTON, NONE, 387, 375); DO_MSLEEP(3782); CtxPoint(397, 160); DO_MSLEEP(1140); CtxClick(CWI_4, 125, L_BUTTON, NONE); /// /// /// /// /// /// /// /// DO_MSLEEP(16); // Window CWI_4 ("Calculator") destroyed 1084811712.045 Scripting Step 2: This is the end of the code snippet that will be cut and pasted into the original script. The following comment inserted during record indicates that the calculator window has been destroyed. Since it happens before any events after the Logon window was destroyed, we know that in this session, we will not have to start the calculator application – it is already present! /* The calculator has been destroyed at this point in the modified script! */ DO_MSLEEP(1469); CtxPoint(235, 85); DO_MSLEEP(343); // Window CWI_5 ("Program Manager") destroyed 1084811713.858 // Window CWI_3 ("") destroyed 1084811713.858 // Window CWI_7 ("Please wait...") created 1084811714.359 CtxWaitForWindowCreate(CWI_7); CtxDisconnect(); END_TRANSACTION(); delete CWI_1; // "Warning !!" delete CWI_2; // "Log On to Windows" delete CWI_3; // "" delete CWI_4; // "Calculator" delete CWI_5; // "Program Manager" delete CWI_6; // "ICA Seamless Host Agent" delete CWI_7; // "Please wait..." CitrixUninit(); REPORT(SUCCESS); EXIT(); return(0); } void abort_function(PLAYER_INFO *s_info) { RR__printf("Virtual User ABORTED."); 75 Usin g th e Player, Script Developm en t W orkben ch , an d An alyze CitrixUninit(); EXIT(); } Sam ple: M odified Citrix Script for Han dlin g Un expected Even ts Th e followin g sam ple sh ows a Citrix script th at is m odified to address wh eth er th e calculator application is presen t is presen t at logon . Ch an ges to Origin al script are h igh ligh ted in bold. Sample Script /* * CalculatorUseExisting.cpp * * Script Converted on May 17, 2004 at 12:35:29 PM * Generated by Compuware QALoad convert module version 5.2.0 build 33 * * This script contains support for the following middlewares: * - Citrix */ /* Converted using the following options: * General: * Line Split : 80 characters * Sleep Seconds : 1 * Auto Checkpoints : No * Citrix * General Options : * Window Verification : Yes * Session Timeouts : Yes * Connect Timeout (s) : 60 * Disconnect Timeout (s) : 60 * Window Creation Timeout (s) : 30 * Ping Timeout (s) : 20 * Wait Point Timeout (s) : 30 * Include Wait Points : Yes * Enable Counters : No * Include Unnamed Windows : Yes * Output Mode : Normal * Input Options : * Combine Keyboard Input : Yes * Combine Mouse Input : Yes */ #define CITRIX_CLIENT_VERSION "7.100.21825" #define CITRIX_ICO_VERSION "2.3" #define SCRIPT_VER 0x00000205UL #include <stdio.h> #include "smacro.h" #include "do_citrix.h" /* set function to call on abort*/ void abort_function(PLAYER_INFO *s_info); #ifndef NULL #define NULL 0 #endif extern "C" int rhobot_script(PLAYER_INFO *s_info) { /* Declare Variables */ const char *CitrixServer = "qaccitrix2"; const int CitrixOutputMode = OUTPUT_MODE_NORMAL; /* Citrix Window Information Objects */ CtxWI *CWI_1 = new CtxWI(0x1001c, "Warning !!", 107, 43, 427, 351); CtxWI *CWI_2 = new CtxWI(0x2001c, "Log On to Windows", 111, 65, 418, 285); CtxWI *CWI_3 = new CtxWI(0x20026, "", -2, 740, 1029, 31); CtxWI *CWI_4 = new CtxWI(0x10136, "Calculator", 154, 154, 261, 253); 76 QALoad On lin e Help CtxWI *CWI_5 = new CtxWI(0x10048, "Program Manager", 0, 0, 1025, 769); CtxWI *CWI_6 = new CtxWI(0x2017c, "ICA Seamless Host Agent", 0, 0, 391, 224); CtxWI *CWI_7 = new CtxWI(0x5002e, "Please wait...", 303, 208, 418, 145); SET_ABORT_FUNCTION(abort_function); DEFINE_TRANS_TYPE("CalculatorUseExisting.cpp"); CitrixInit(1); /* Citrix replay settings */ CtxSetConnectTimeout(60); CtxSetDisconnectTimeout(60); CtxSetWindowTimeout(30); CtxSetPingTimeout(20); CtxSetWaitPointTimeout(30); CtxSetWindowVerification(TRUE); CtxSetEnableCounters(FALSE); CtxSetWindowRetries(5, 5000); CtxSetEnableWildcardMatching(TRUE); SYNCHRONIZE(); BEGIN_TRANSACTION(); CtxConnect(CitrixServer, CitrixOutputMode); DO_MSLEEP(625); CtxPoint(130, 78); DO_MSLEEP(797); // Window CWI_1 ("Warning !!") created 1084811688.065 CtxWaitForWindowCreate(CWI_1); DO_MSLEEP(1813); CtxPoint(309, 365); DO_MSLEEP(203); CtxClick(CWI_1, 140, L_BUTTON, NONE); DO_MSLEEP(63); // Window CWI_2 ("Log On to Windows") created 1084811690.285 CtxWaitForWindowCreate(CWI_2); DO_MSLEEP(15); // Window CWI_1 ("Warning !!") destroyed 1084811690.300 CtxType(CWI_2, "citrix"); DO_MSLEEP(2375); CtxPoint(309, 364); CtxTypeVK(CWI_2, VK_TAB, NONE); DO_MSLEEP(813); CtxType(CWI_2, "citrix"); DO_MSLEEP(1844); CtxTypeVK(CWI_2, VK_TAB, NONE); DO_MSLEEP(328); CtxType(CWI_2, "q"); DO_MSLEEP(672); DO_MSLEEP(1281); CtxPoint(241, 317); 77 Usin g th e Player, Script Developm en t W orkben ch , an d An alyze DO_MSLEEP(125); CtxClick(CWI_2, 141, L_BUTTON, NONE); DO_MSLEEP(406); // Window CWI_2 ("Log On to Windows") destroyed 1084811698.289 DO_MSLEEP(828); CtxPoint(514, 358); DO_MSLEEP(125); // Window CWI_3 ("") created 1084811699.258 DO_MSLEEP(16); // Window CWI_4 ("Calculator") created 1084811699.258 /// Here is where we can determine that either the Calculator application /// exists in this session or it needs to be created. /// Scripting Step if(CtxWindowEventExists("WindowCreate", 4000, "Calculator", "")) /// If the window exists, the block below will be /// executed. BeginBlock(); /// Scripting Step 2: /// The following code was cut and pasted from the second script. /// Scripting Step 3: /// All Citrix window object name references have been reconciled with the /// correct Citrix window object definition. CtxWaitForWindowCreate(CWI_4); // Window CWI_5 ("Program Manager") created 1084811699.258 CtxWaitForWindowCreate(CWI_5); DO_MSLEEP(640); // Window CWI_6 ("ICA Seamless Host Agent") created 1084811699.899 CtxWaitForWindowCreate(CWI_6); DO_MSLEEP(1672); CtxPoint(200, 195); DO_MSLEEP(234); CtxClick(CWI_6, 141, L_BUTTON, NONE); DO_MSLEEP(16); // Window CWI_6 ("ICA Seamless Host Agent") destroyed 1084811701.962 DO_MSLEEP(672); CtxPoint(200, 205); DO_MSLEEP(125); CtxClick(CWI_3, 109, L_BUTTON, NONE); DO_MSLEEP(719); CtxPoint(275, 316); DO_MSLEEP(31); CtxMouseDown(CWI_4, L_BUTTON, NONE, 275, 316); 78 QALoad On lin e Help CtxMouseUp(CWI_4, L_BUTTON, NONE, 274, 316); DO_MSLEEP(812); CtxPoint(349, 376); DO_MSLEEP(172); CtxClick(CWI_4, 110, L_BUTTON, NONE); DO_MSLEEP(1297); CtxPoint(259, 313); DO_MSLEEP(46); CtxClick(CWI_4, 79, L_BUTTON, NONE); DO_MSLEEP(843); CtxPoint(387, 374); CtxMouseDown(CWI_4, L_BUTTON, NONE, 387, 374); CtxMouseUp(CWI_4, L_BUTTON, NONE, 387, 375); DO_MSLEEP(3782); CtxPoint(397, 160); DO_MSLEEP(1140); CtxClick(CWI_4, 125, L_BUTTON, NONE); /// Scripting Step 5: /// Here is the end of the code snippet, so an EndBlock goes here. EndBlock() /// /// /// /// Scripting Step 6: The original behavior has been put into the else section of the if conditional between BeginBlock and EndBlock commands. else BeginBlock(); DO_MSLEEP(1672); CtxPoint(200, 195); DO_MSLEEP(234); CtxClick(CWI_6, 141, L_BUTTON, NONE); DO_MSLEEP(3843); CtxPoint(112, 98); DO_MSLEEP(282); CtxDoubleClick(CWI_5); CtxWaitForWindowCreate(CWI_4); DO_MSLEEP(2672); CtxPoint(295, 48); DO_MSLEEP(672); CtxClick(CWI_4, 94, L_BUTTON, NONE); EndBlock(); DO_MSLEEP(16); // Window CWI_4 ("Calculator") destroyed 1084811712.045 DO_MSLEEP(1469); 79 Usin g th e Player, Script Developm en t W orkben ch , an d An alyze CtxPoint(235, 85); DO_MSLEEP(343); // Window CWI_5 ("Program Manager") destroyed 1084811713.858 // Window CWI_3 ("") destroyed 1084811713.858 // Window CWI_7 ("Please wait...") created 1084811714.359 //CtxWaitForWindowCreate(CWI_7); CtxDisconnect(); END_TRANSACTION(); delete delete delete delete delete delete delete CWI_1; CWI_2; CWI_3; CWI_4; CWI_5; CWI_6; CWI_7; // // // // // // // "Warning !!" "Log On to Windows" "" "Calculator" "Program Manager" "ICA Seamless Host Agent" "Please wait..." CitrixUninit(); REPORT(SUCCESS); EXIT(); return(0); } void abort_function(PLAYER_INFO *s_info) { RR__printf("Virtual User ABORTED."); CitrixUninit(); EXIT(); } M ovi n g Con n ect an d Di scon n ect Act i on s M odifyin g th e Script to M ove Con n ect an d Discon n ect Outside th e Tran saction Loop Load testin g for Citrix m ay require you to create ext en ded logon session s, in wh ich th e user rem ain s con n ected to th e Citrix server between tran saction s. W h en th is is n ecessary, you can m ove th e con n ect an d discon n ect action s outside th e tran saction loop so th at th e script does n ot logon an d off with each iteration th rough th e loop. To m odify th e script, you m ust: ! Modify the recording process to prepare for moving the connect and disconnect actions. ! Modify the script. To m od i f y t h e r ecor d i n g p r ocess: Prepare for m ovin g th e con n ect an d discon n ect acti on s outside th e tran saction loop by perform in g th e followin g steps durin g recordin g: 1. In sert a com m en t, such as “ Logged in to Citrix” , after th e Citrix logon but before an y win dows are open ed or an y application s are started. 2. En sure th at all application win dows are closed before discon n ectin g from th e Citrix session . 80 QALoad On lin e Help 3. In sert a com m en t, such as “ Ready to log off Citrix” , before th e Citrix logoff sequen ce is in itiated. You m ust place th e secon d com m en t after all application s h ave been closed but before th e user logs off. To m od i f y t h e scr i p t : 1. Com m en t out th e BEGIN_TRANSACTION an d END_TRANSACTION calls. 2. Add n ew BEGIN_TRANSACTION an d END_TRANSACTION calls wh ere th e com m en ts were placed in Step 1 an d Step 3 in the recordin g process descri bed above. 3. Com m en t out th e DO_SetTran saction Start an d DO_SetTran saction Clean up calls. Not e: Commenting out the calls instead of deleting them allows you to determine the original location of these commands for debugging purposes. Conclusion W h en you use th ese tech n iques, you can script a set of action s so th at th e script does n ot log on an d log off with each iteration th rough th e loop. Caut ion: You must take care when you perform this action. In the event of a failure, you must log off before using a transaction restart. Th e followin g sam ple scri pts illustrate th is process: Sam ple: Origin al Citrix Script for M odifyin g th e Tran saction Loop Th e followin g sam ple is an origin al Citrix script con verted from capture. Poin ts of in terest in th e script are sh own in bold. Sample Script /* * capCtxMoveLoop.cpp * * Script Converted on February 28, 2005 at 08:30:06 AM * Generated by Compuware QALoad convert module version 5.5.0 build 231 * * This script contains support for the following middlewares: * - Citrix */ /* Converted using the following options: * General: * Line Split : 80 characters * Sleep Seconds : 1 * Auto Checkpoints : No * Citrix * General Options : * Replay Output Mode : Normal * Enable Counters : No * Timeout Value Options : * Connect Timeout (s) : 60 * Disconnect Timeout (s) : 60 * Window Creation Timeout (s) : 30 * Ping Timeout (s) : 20 * Wait Point Timeout (s) : 30 * Input Options : 81 Usin g th e Player, Script Developm en t W orkben ch , an d An alyze * Combine Keyboard Input : Yes * Combine Mouse Input : Yes * Window Options : * Window Verification : Yes * Window Max Retries : 5 * Window Wait Retries (ms) : 5000 * Enable Wildcard Title Match : Yes */ #define CITRIX_CLIENT_VERSION "8.100.29670" #define CITRIX_ICO_VERSION "2.4" #define SCRIPT_VER 0x00000505UL #include <stdio.h> #include "smacro.h" #include "do_citrix.h" /* set function to call on abort*/ void abort_function(PLAYER_INFO *s_info); #ifndef NULL #define NULL 0 #endif extern "C" int rhobot_script(PLAYER_INFO *s_info) { /* Declare Variables */ const char *CitrixServer = "QACCitrix"; const char *CitrixUsername = "Citrix"; const char *CitrixPassword = "~encr~657E06726F697206"; const char *CitrixDomain = "QACCitrix"; const int CitrixOutputMode = OUTPUT_MODE_NORMAL; /* Citrix Window Information Objects */ CtxWI *CWI_1 = new CtxWI(0x1001c, "Warning !!", 107, 43, 427, 351); CtxWI *CWI_2 = new CtxWI(0x5001c, "Please wait...", 111, 112, 418, 145); CtxWI *CWI_3 = new CtxWI(0x40030, "Citrix License Warning Notice", 125, 198, 397, 127); CtxWI *CWI_4 = new CtxWI(0x4002e, "UsrLogon.Cmd", 0, 456, 161, 25); CtxWI *CWI_5 = new CtxWI(0x1003a, "", -2, 452, 645, 31); CtxWI *CWI_6 = new CtxWI(0x10066, "ICA Seamless Host Agent", 0, 0, 391, 224); CtxWI *CWI_7 = new CtxWI(0x10052, "Program Manager", 0, 0, 641, 481); CtxWI *CWI_8 = new CtxWI(0x1008c, "", 115, 0, 405, 457); CtxWI *CWI_9 = new CtxWI(0x2006c, "Calculator", 66, 66, 261, 253); SET_ABORT_FUNCTION(abort_function); DEFINE_TRANS_TYPE("capCtxMoveLoop.cpp"); CitrixInit(1); /* Citrix replay settings */ CtxSetConnectTimeout(60); CtxSetDisconnectTimeout(60); CtxSetWindowTimeout(30); CtxSetPingTimeout(20); CtxSetWaitPointTimeout(30); CtxSetWindowVerification(TRUE); CtxSetDomainLoginInfo(CitrixUsername, CitrixPassword, CitrixDomain); CtxSetEnableCounters(FALSE); CtxSetWindowRetries(5, 5000); CtxSetEnableWildcardMatching(TRUE); SYNCHRONIZE(); BEGIN_TRANSACTION(); DO_SetTransactionStart(); CtxConnect(CitrixServer, CitrixOutputMode); // Window CWI_1 ("Warning !!") created 1109597295.502 CtxWaitForWindowCreate(CWI_1, 2156); DO_MSLEEP(922); 82 QALoad On lin e Help CtxPoint(333, 233); //1109597296.611 DO_MSLEEP(188); CtxMouseDown(CWI_1, L_BUTTON, NONE, 333, 233); // 1109597296.611 CtxMouseUp(CWI_1, L_BUTTON, NONE, 332, 233); //1109597296.861 DO_MSLEEP(1250); CtxPoint(319, 360); //1109597297.938 DO_MSLEEP(78); CtxMouseDown(CWI_1, L_BUTTON, NONE, 319, 360); // 1109597297.938 CtxMouseUp(CWI_1, L_BUTTON, NONE, 320, 360); //1109597298.235 DO_MSLEEP(78); CtxPoint(320, 360); //1109597298.282 DO_MSLEEP(265); // Window CWI_1 ("Warning !!") destroyed 1109597298.282 CtxPoint(321, 358); //1109597298.469 // Window CWI_2 ("Please wait...") created 1109597298.469 CtxWaitForWindowCreate(CWI_2, 31); DO_MSLEEP(47); CtxPoint(324, 353); //1109597298.500 // Window CWI_2 ("Please wait...") destroyed 1109597298.500 CtxPoint(321, 325); //1109597298.578 // Window CWI_3 ("Citrix License Warning Notice") created 1109597298.578 CtxWaitForWindowCreate(CWI_3, 15); // Window CWI_4 ("UsrLogon.Cmd") created 1109597298.578 CtxWaitForWindowCreate(CWI_4, 0); DO_MSLEEP(16); // Window CWI_4 ("UsrLogon.Cmd") destroyed 1109597298.594 CtxPoint(307, 268); //1109597298.766 // Window CWI_5 ("") created 1109597298.766 DO_MSLEEP(63); // Window CWI_6 ("ICA Seamless Host Agent") created 1109597298.828 CtxWaitForWindowCreate(CWI_6, 62); // Window CWI_7 ("Program Manager") created 1109597298.828 CtxWaitForWindowCreate(CWI_7, 0); // Window CWI_8 ("") created 1109597301.123 DO_MSLEEP(2297); DO_MSLEEP(2797); // Window CWI_8 ("") destroyed 1109597303.918 83 Usin g th e Player, Script Developm en t W orkben ch , an d An alyze DO_MSLEEP(5438); CtxPoint(289, 212); //1109597309.524 DO_MSLEEP(171); CtxClick(CWI_3, 266, L_BUTTON, NONE); //1109597309.789 DO_MSLEEP(1109); CtxPoint(329, 295); //1109597310.944 DO_MSLEEP(47); CtxClick(CWI_3, 250, L_BUTTON, NONE); //1109597311.194 DO_MSLEEP(63); // Window CWI_3 ("Citrix License Warning Notice") destroyed 1109597311.257 DO_MSLEEP(984); CtxPoint(261, 132); //1109597312.475 DO_MSLEEP(235); CtxClick(CWI_6, 312, L_BUTTON, NONE); //1109597312.787 DO_MSLEEP(563); CtxPoint(208, 194); //1109597313.708 DO_MSLEEP(359); CtxClick(CWI_6, 281, L_BUTTON, NONE); //1109597313.989 DO_MSLEEP(78); // Window CWI_6 ("ICA Seamless Host Agent") destroyed 1109597314.067 /* After Logon */ DO_MSLEEP(29578); CtxPoint(101, 96); //1109597343.983 DO_MSLEEP(360); CtxDoubleClick(CWI_7); // 1109597344.186 CtxMouseUp(CWI_5, L_BUTTON, NONE, 100, 96); //1109597344.093 DO_MSLEEP(47); CtxPoint(100, 96); //1109597344.186 DO_MSLEEP(156); // Window CWI_9 ("Calculator") created 1109597344.327 CtxWaitForWindowCreate(CWI_9, 141); DO_MSLEEP(921); CtxPoint(181, 195); //1109597345.420 DO_MSLEEP(172); CtxMouseDown(CWI_9, L_BUTTON, NONE, 181, 195); // 1109597345.420 CtxMouseUp(CWI_9, L_BUTTON, NONE, 181, 196); //1109597345.529 DO_MSLEEP(438); CtxPoint(210, 196); //1109597345.857 CtxMouseDown(CWI_9, L_BUTTON, NONE, 210, 196); // 1109597345.857 CtxMouseUp(CWI_9, L_BUTTON, NONE, 211, 197); //1109597346.013 84 QALoad On lin e Help DO_MSLEEP(562); CtxPoint(252, 230); //1109597346.950 DO_MSLEEP(532); CtxClick(CWI_9, 140, L_BUTTON, NONE); //1109597347.091 DO_MSLEEP(531); CtxPoint(171, 222); //1109597347.653 DO_MSLEEP(32); CtxMouseDown(CWI_9, L_BUTTON, NONE, 171, 222); // 1109597347.653 CtxMouseUp(CWI_9, L_BUTTON, NONE, 172, 222); //1109597347.746 DO_MSLEEP(547); CtxPoint(231, 231); //1109597348.215 DO_MSLEEP(15); CtxMouseDown(CWI_9, L_BUTTON, NONE, 231, 231); // 1109597348.215 CtxMouseUp(CWI_9, L_BUTTON, NONE, 230, 231); //1109597348.340 DO_MSLEEP(953); CtxPoint(303, 293); //1109597349.370 DO_MSLEEP(188); CtxMouseDown(CWI_9, L_BUTTON, NONE, 303, 293); // 1109597349.370 CtxMouseUp(CWI_9, L_BUTTON, NONE, 302, 293); //1109597349.480 DO_MSLEEP(1859); CtxPoint(314, 79); //1109597351.494 DO_MSLEEP(281); CtxClick(CWI_9, 157, L_BUTTON, NONE); //1109597351.650 DO_MSLEEP(62); // Window CWI_9 ("Calculator") destroyed 1109597351.712 /* Before Logoff */ DO_MSLEEP(33781); CtxPoint(384, 13); //1109597396.040 DO_MSLEEP(10579); // Window CWI_7 ("Program Manager") destroyed 1109597396.040 // Window CWI_5 ("") destroyed 1109597396.040 DO_SetTransactionCleanup(); CtxDisconnect(); END_TRANSACTION(); delete CWI_1; // "Warning !!" delete CWI_2; // "Please wait..." delete CWI_3; // "Citrix License Warning Notice" delete CWI_4; // "UsrLogon.Cmd" delete CWI_5; // "" delete CWI_6; // "ICA Seamless Host Agent" delete CWI_7; // "Program Manager" delete CWI_8; // "" delete CWI_9; // "Calculator" CitrixUninit(); 85 Usin g th e Player, Script Developm en t W orkben ch , an d An alyze EXIT(); return(0); } void abort_function(PLAYER_INFO *s_info) { RR__printf("Virtual User ABORTED."); CitrixUninit(); EXIT(); } Sam ple: M odified Citrix Script for M odifyin g th e Tran saction Loop Th e followin g sam ple is a m odified Citrix script th at m oves th e tran saction loop. Ch an ges to th e origin al script are sh own in bold. Sample Script /* Converted using the following options: * General: * Line Split : 80 characters * Sleep Seconds : 1 * Auto Checkpoints : No * Citrix * General Options : * Replay Output Mode : Normal * Enable Counters : No * Timeout Value Options : * Connect Timeout (s) : 60 * Disconnect Timeout (s) : 60 * Window Creation Timeout (s) : 30 * Ping Timeout (s) : 20 * Wait Point Timeout (s) : 30 * Input Options : * Combine Keyboard Input : Yes * Combine Mouse Input : Yes * Window Options : * Window Verification : Yes * Window Max Retries : 5 * Window Wait Retries (ms) : 5000 * Enable Wildcard Title Match : Yes */ #define CITRIX_CLIENT_VERSION "8.100.29670" #define CITRIX_ICO_VERSION "2.4" #define SCRIPT_VER 0x00000505UL #include <stdio.h> #include "smacro.h" #include "do_citrix.h" /* set function to call on abort*/ void abort_function(PLAYER_INFO *s_info); #ifndef NULL #define NULL 0 #endif extern "C" int rhobot_script(PLAYER_INFO *s_info) { /* Declare Variables */ const char *CitrixServer = "QACCitrix"; const char *CitrixUsername = "Citrix"; const char *CitrixPassword = "~encr~657E06726F697206"; const char *CitrixDomain = "QACCitrix"; const int CitrixOutputMode = OUTPUT_MODE_NORMAL; /* Citrix Window Information Objects */ CtxWI *CWI_1 = new CtxWI(0x1001c, "Warning !!", 107, 43, 427, 351); 86 QALoad On lin e Help CtxWI CtxWI CtxWI CtxWI CtxWI CtxWI CtxWI CtxWI *CWI_2 *CWI_3 *CWI_4 *CWI_5 *CWI_6 *CWI_7 *CWI_8 *CWI_9 = = = = = = = = new new new new new new new new CtxWI(0x5001c, CtxWI(0x40030, CtxWI(0x4002e, CtxWI(0x1003a, CtxWI(0x10066, CtxWI(0x10052, CtxWI(0x1008c, CtxWI(0x2006c, "Please wait...", 111, 112, 418, 145); "Citrix License Warning Notice", 125, 198, 397, 127); "UsrLogon.Cmd", 0, 456, 161, 25); "", -2, 452, 645, 31); "ICA Seamless Host Agent", 0, 0, 391, 224); "Program Manager", 0, 0, 641, 481); "", 115, 0, 405, 457); "Calculator", 66, 66, 261, 253); SET_ABORT_FUNCTION(abort_function); DEFINE_TRANS_TYPE("capCtxMoveLoop.cpp"); CitrixInit(1); /* Citrix replay settings */ CtxSetConnectTimeout(60); CtxSetDisconnectTimeout(60); CtxSetWindowTimeout(30); CtxSetPingTimeout(20); CtxSetWaitPointTimeout(30); CtxSetWindowVerification(TRUE); CtxSetDomainLoginInfo(CitrixUsername, CitrixPassword, CitrixDomain); CtxSetEnableCounters(FALSE); CtxSetWindowRetries(5, 5000); CtxSetEnableWildcardMatching(TRUE); SYNCHRONIZE(); ///////////////////////////////////////////// // Remove the BEGIN_TRANSACTION(); // and place it after the logon comment // in the script ///////////////////////////////////////////// // BEGIN_TRANSACTION(); ///////////////////////////////////////////// // Remove the DO_SetTransactionStart(); // Restart transaction cannot be used if the // Transaction Loop has been moved ///////////////////////////////////////////// // DO_SetTransactionStart(); CtxConnect(CitrixServer, CitrixOutputMode); // Window CWI_1 ("Warning !!") created 1109597295.502 CtxWaitForWindowCreate(CWI_1, 2156); DO_MSLEEP(922); CtxPoint(333, 233); //1109597296.611 DO_MSLEEP(188); CtxMouseDown(CWI_1, L_BUTTON, NONE, 333, 233); // 1109597296.611 CtxMouseUp(CWI_1, L_BUTTON, NONE, 332, 233); //1109597296.861 DO_MSLEEP(1250); CtxPoint(319, 360); //1109597297.938 DO_MSLEEP(78); CtxMouseDown(CWI_1, L_BUTTON, NONE, 319, 360); // 1109597297.938 CtxMouseUp(CWI_1, L_BUTTON, NONE, 320, 360); //1109597298.235 87 Usin g th e Player, Script Developm en t W orkben ch , an d An alyze DO_MSLEEP(78); CtxPoint(320, 360); //1109597298.282 DO_MSLEEP(265); // Window CWI_1 ("Warning !!") destroyed 1109597298.282 CtxPoint(321, 358); //1109597298.469 // Window CWI_2 ("Please wait...") created 1109597298.469 CtxWaitForWindowCreate(CWI_2, 31); DO_MSLEEP(47); CtxPoint(324, 353); //1109597298.500 // Window CWI_2 ("Please wait...") destroyed 1109597298.500 CtxPoint(321, 325); //1109597298.578 // Window CWI_3 ("Citrix License Warning Notice") created 1109597298.578 CtxWaitForWindowCreate(CWI_3, 15); // Window CWI_4 ("UsrLogon.Cmd") created 1109597298.578 CtxWaitForWindowCreate(CWI_4, 0); DO_MSLEEP(16); // Window CWI_4 ("UsrLogon.Cmd") destroyed 1109597298.594 CtxPoint(307, 268); //1109597298.766 // Window CWI_5 ("") created 1109597298.766 DO_MSLEEP(63); // Window CWI_6 ("ICA Seamless Host Agent") created 1109597298.828 CtxWaitForWindowCreate(CWI_6, 62); // Window CWI_7 ("Program Manager") created 1109597298.828 CtxWaitForWindowCreate(CWI_7, 0); // Window CWI_8 ("") created 1109597301.123 DO_MSLEEP(2297); DO_MSLEEP(2797); // Window CWI_8 ("") destroyed 1109597303.918 DO_MSLEEP(5438); CtxPoint(289, 212); //1109597309.524 DO_MSLEEP(171); CtxClick(CWI_3, 266, L_BUTTON, NONE); //1109597309.789 DO_MSLEEP(1109); CtxPoint(329, 295); //1109597310.944 DO_MSLEEP(47); CtxClick(CWI_3, 250, L_BUTTON, NONE); //1109597311.194 DO_MSLEEP(63); // Window CWI_3 ("Citrix License Warning Notice") destroyed 1109597311.257 88 QALoad On lin e Help DO_MSLEEP(984); CtxPoint(261, 132); //1109597312.475 DO_MSLEEP(235); CtxClick(CWI_6, 312, L_BUTTON, NONE); //1109597312.787 DO_MSLEEP(563); CtxPoint(208, 194); //1109597313.708 DO_MSLEEP(359); CtxClick(CWI_6, 281, L_BUTTON, NONE); //1109597313.989 DO_MSLEEP(78); // Window CWI_6 ("ICA Seamless Host Agent") destroyed 1109597314.067 /* After Logon */ ///////////////////////////////////////////// // Move Begin Transaction Loop to after // the Logon comment created during capture // process You may want to reduce the sleep // time introduced into the process by adding // the comment ///////////////////////////////////////////// BEGIN_TRANSACTION(); DO_MSLEEP(2578); CtxPoint(101, 96); //1109597343.983 DO_MSLEEP(360); CtxDoubleClick(CWI_7); // 1109597344.186 CtxMouseUp(CWI_5, L_BUTTON, NONE, 100, 96); //1109597344.093 DO_MSLEEP(47); CtxPoint(100, 96); //1109597344.186 DO_MSLEEP(156); // Window CWI_9 ("Calculator") created 1109597344.327 CtxWaitForWindowCreate(CWI_9, 141); DO_MSLEEP(921); CtxPoint(181, 195); //1109597345.420 DO_MSLEEP(172); CtxMouseDown(CWI_9, L_BUTTON, NONE, 181, 195); // 1109597345.420 CtxMouseUp(CWI_9, L_BUTTON, NONE, 181, 196); //1109597345.529 DO_MSLEEP(438); CtxPoint(210, 196); //1109597345.857 CtxMouseDown(CWI_9, L_BUTTON, NONE, 210, 196); // 1109597345.857 CtxMouseUp(CWI_9, L_BUTTON, NONE, 211, 197); //1109597346.013 DO_MSLEEP(562); CtxPoint(252, 230); //1109597346.950 DO_MSLEEP(532); CtxClick(CWI_9, 140, L_BUTTON, NONE); //1109597347.091 89 Usin g th e Player, Script Developm en t W orkben ch , an d An alyze DO_MSLEEP(531); CtxPoint(171, 222); //1109597347.653 DO_MSLEEP(32); CtxMouseDown(CWI_9, L_BUTTON, NONE, 171, 222); // 1109597347.653 CtxMouseUp(CWI_9, L_BUTTON, NONE, 172, 222); //1109597347.746 DO_MSLEEP(547); CtxPoint(231, 231); //1109597348.215 DO_MSLEEP(15); CtxMouseDown(CWI_9, L_BUTTON, NONE, 231, 231); // 1109597348.215 CtxMouseUp(CWI_9, L_BUTTON, NONE, 230, 231); //1109597348.340 DO_MSLEEP(953); CtxPoint(303, 293); //1109597349.370 DO_MSLEEP(188); CtxMouseDown(CWI_9, L_BUTTON, NONE, 303, 293); // 1109597349.370 CtxMouseUp(CWI_9, L_BUTTON, NONE, 302, 293); //1109597349.480 DO_MSLEEP(1859); CtxPoint(314, 79); //1109597351.494 DO_MSLEEP(281); CtxClick(CWI_9, 157, L_BUTTON, NONE); //1109597351.650 DO_MSLEEP(62); // Window CWI_9 ("Calculator") destroyed 1109597351.712 /* Before Logoff */ ///////////////////////////////////////////// // Move End Transaction Loop to before // the Logoff comment created during capture // process You may want to reduce the sleep // time introduced into the process by adding // the comment ///////////////////////////////////////////// END_TRANSACTION(); DO_MSLEEP(3781); CtxPoint(384, 13); //1109597396.040 DO_MSLEEP(1079); // Window CWI_7 ("Program Manager") destroyed 1109597396.040 // Window CWI_5 ("") destroyed 1109597396.040 ///////////////////////////////////////////// // Remove the DO_SetTransactionCleanup(); // Restart transaction cannot be used if the // Transaction Loop has been moved ///////////////////////////////////////////// // DO_SetTransactionCleanup(); CtxDisconnect(); ///////////////////////////////////////////// // Remove the END_TRANSACTION(); 90 QALoad On lin e Help // and place it before the logoff comment // in the script ///////////////////////////////////////////// // END_TRANSACTION(); delete CWI_1; // "Warning !!" delete CWI_2; // "Please wait..." delete CWI_3; // "Citrix License Warning Notice" delete CWI_4; // "UsrLogon.Cmd" delete CWI_5; // "" delete CWI_6; // "ICA Seamless Host Agent" delete CWI_7; // "Program Manager" delete CWI_8; // "" delete CWI_9; // "Calculator" CitrixUninit(); EXIT(); return(0); } void abort_function(PLAYER_INFO *s_info) { RR__printf("Virtual User ABORTED."); CitrixUninit(); EXIT(); } Scri pt i n g M ouse Act i on s M odifyin g th e Script for Con trollin g M ouse Action s Ch an ges to screen resolution or server settin gs can cause th e appearan ce, size, an d location coordin ates of a win dow to differ from th e expected beh avi or in th e recorded scri pt. By sett in g Di spl ay coordi n at e t ool t i p on ri gh t -cl i ck opt i on i n val i dat i on w i n dow in th e Con vert Opt i on s dialog box, you can righ tclick th e m ouse at th e desired location to extract screen coordin ate values th at correspon d to button s an d oth er con trols in real tim e durin g validation . To m odify a scri pt to retri eve coordin at e values, you m ust: ! Validate the settings. ! Modify the script. To val i d at e t h e set t i n g s: 1. Click Opt i on s>Con vert , an d click th e Ci t ri x tab. 2. En sure th at th e Di spl ay coordi n at e t ool t i p on ri gh t -cl i ck opt i on i n val i dat i on w i n dow ch eckbox is selected. 3. Set Repl ay out put m ode to Norm al. 4. Click OK to con vert th e script. 91 Usin g th e Player, Script Developm en t W orkben ch , an d An alyze Durin g validation , a righ t m ouse-click results in a tooltip display of th e screen coordin ate values. You can use th ese values in a m an ually added CtxPoin t call to en sure th at th e m ouse is m oved to th ese coordin ates before an y subsequen t m ouse click action s. Tip: Make a note of these coordinate values, since this tooltip is not logged. 92 QALoad On lin e Help To m od i f y t h e scr i p t : On ce you det erm in e th e correct m ouse coordin ates from validation , m odify th e script. 1. 2. Add or modify the CtxPoint command. Insert the new values into the script. Conclusion Followin g th ese tech n iques, you can retrieve screen coordin ates at validation an d in sert th em in to a script. Th is corrects m ouse beh avior as a result of ch an ges to th e server settin gs or th e user session en viron m en t. Th e sam ple scri pts, sh owin g added CtxPoin t an d CtxM ouseClick, an d m odified CtxPoin t, illustrate th ese tech n iques. Sam ple: Script Sn ippet with Added CtxPoin t an d CtxClick Th e followin g sam ple sh ows a script extract with CtxPoin t an d CtxClick com m an ds added. Com m en ts an d added script lin es are h igh ligh ted in bold. Sample Script Snippet …beginning of script… DO_MSLEEP(687); /// This CtxPoint is for an intermittent window 93 Usin g th e Player, Script Developm en t W orkben ch , an d An alyze /// that appeared. A button is required to dismiss /// this window. Right-clicking on the button during /// validation gave the coordinates in a tooltip. CtxPoint(268, 60); /// A DO_MSLEEP will pause execution for a second. DO_MSLEEP(1000); /// This CtxSetWindowMatchTitle is for the intermittent window name. CtxSetWindowMatchTitle( CWI_9, "*" ); /// This CtxClick command is added to dismiss the window. CtxClick(CWI_9, 78, L_BUTTON, NONE); …end of script… Sam ple: Script Sn ippet with M odified CtxPoin t Th e followin g sam ple sh ows a script extract with a m odified CtxPoin t com m an d. Com m en ts an d added script lin es are h igh ligh ted in bold. Sample Script …beginning of script… DO_MSLEEP(1844); // Window CWI_10 ("") destroyed 1113840796.133 DO_MSLEEP(1828); /// /// /// /// Modifying a CtxPoint is easy once you have the target coordinates and have identified the CtxClick statement that was failing. Just insert the X and Y coordinates as the parameters. CtxPoint(200, 200); //1113840798.309 DO_MSLEEP(344); CtxClick(CWI_5, 78, L_BUTTON, NONE); //1113840798.387 …end of script… Ct x W ai t ForScreen Updat e Com m an d CtxW aitForScreen Update W aits for th e specified screen update to occur at th e specified coordin ates. Syntax void CtxWaitForScreenUpdate(long x, long y, long w, long h, long nmWait); Return Value Parameters 94 QALoad On lin e Help Par am et er Descri pt i on x X coordin ate y Y coordin at e w W idth of th e screen updat e h Heigh t of th e screen update nmWait Tim eout offset, in m illisecon ds. Am oun t to in crease or decrease th e wait tim e specified by CtxSetW aitPoin tTim eout. Example CtxWaitForScreenUpdate(154, 154, 253, 261, 500); M odifyin g th e Script with th e CtxW aitForScreen Update Com m an d W in dows in a Citrix session can take varyin g am oun ts of tim e to com plete screen updates. Th is can result in keyboard an d m ouse even ts n ot syn ch ron izin g with th e appropriate win dow. For exam ple, th e W in dows Start m en u is an un n am ed win dow. Th e am oun t of tim e it takes to appear depen ds on system resource usage. Addin g a CtxW aitForScreen Update com m an d before th e keyboard en try or m ouse click can en sure th at th e win dow h as en ough tim e to display before an y subsequen t m ouse cli cks or keyboard en tries take place. You can add th e com m an d wh ile recordin g a script or after a script h as been recorded. Not e: When recording a session with windows that load slowly, pay attention to the ScreenUpdate messages that scroll in the message panel. On ce th e win dow h as com pleted loadin g, add CtxW aitForScreen Update. To ad d Ct x W ai t For Scr een Up d at e w h i l e r ecor d i n g a sessi on : 1. Click I n sert W ai t Poi n t . An expan ded list of log en tries appears. 2. Select th e last Screen Update m essage in th e log en try to h igh ligh t th e lin e. 3. Click OK to in sert a statem en t in th e record session . Th e statem en t is con verted to a Ct x W ai t ForScreen Updat e com m an d in th e script, wh ich waits for th e screen update before proceedin g. Not e: An ytim e a win dow loads slowly or h as th e poten tial to load slowly duri n g a Citrix record session , such as wh en traffic is h eavy, con sider usin g th is tech n ique before perform in g an y keyboard or m ouse activity on th at wi n dow. 95 Usin g th e Player, Script Developm en t W orkben ch , an d An alyze To ad d Ct x W ai t For Scr een Up d at e t o an ex i st i n g scr i p t : M an ually en ter th e Ct x W ai t ForScreen Updat e before th e keyboard or m ouse even t th at is firin g prem aturely. Not e: To prevent playback problems in which a mouse click does not synchronize with its intended window, insert the command in the script after the action that causes the window to appear. You also can use CtxScreenEventExists to clear past events from the internal queue and ensure that the script waits for a specific screen update event. Th e param eters for th e CtxW aitForScreen Update com m an d correspon d to th e X an d Y coordin ates, an d th e width an d h eigh t of th e win dow. Det erm in e th e param eters from th e Citrix win dow object decl aration param eters. Conclusion Followin g th ese tech n iques, you can preven t probl em s with prem ature m ouse clicks an d keyboard en try statem en ts durin g replay. Th e followin g sam ple scri pts illustrate th is process: Sam ple: Usin g th e Com m an d After Recordin g Th e followin g sam ple sh ows a script with W aitPoin t in serted after recordin g is com pleted. Script ch an ges are h igh ligh ted in bold. 96 QALoad On lin e Help Sample Script /* * ctxwaitforscreenupdate.cpp * * Script Converted on April 19, 2005 at 02:44:44 PM * Generated by Compuware QALoad convert module version 5.5.0 build 256 * * This script contains support for the following middlewares: * - Citrix */ /* Converted using the following options: * General: * Line Split : 80 characters * Sleep Seconds : 1 * Auto Checkpoints : No * Citrix * General Options : * Replay Output Mode : Normal * Enable Counters : No * Timeout Value Options : * Connect Timeout (s) : 60 * Disconnect Timeout (s) : 60 * Window Creation Timeout (s) : 30 * Ping Timeout (s) : 20 * Wait Point Timeout (s) : 30 * Input Options : * Combine Keyboard Input : Yes * Combine Mouse Input : Yes * Window Options : * Window Verification : Yes * Window Max Retries : 5 * Window Wait Retries (ms) : 5000 * Enable Wildcard Title Match : Yes */ #define CITRIX_CLIENT_VERSION "7.100.21825" #define CITRIX_ICO_VERSION "2.3" #define SCRIPT_VER 0x00000505UL #include <stdio.h> #include "smacro.h" #include "do_citrix.h" /* set function to call on abort*/ void abort_function(PLAYER_INFO *s_info); #ifndef NULL #define NULL #endif 0 extern "C" int rhobot_script(PLAYER_INFO *s_info) { /* Declare Variables */ const char *CitrixServer = "qaccitrix"; const char *CitrixPassword = ""; const int CitrixOutputMode = OUTPUT_MODE_NORMAL; /* Citrix Window Information Objects */ CtxWI *CWI_1 = new CtxWI(0x1001c, "Warning !!", 107, 43, 427, 351); CtxWI *CWI_2 = new CtxWI(0x2001c, "Log On to Windows", 111, 65, 418, 285); CtxWI *CWI_3 = new CtxWI(0x5001c, "Please wait...", 111, 112, 418, 145); CtxWI *CWI_4 = new CtxWI(0x40030, "Citrix License Warning Notice", 125, 198, 397, 127); CtxWI *CWI_5 = new CtxWI(0x4002e, "UsrLogon.Cmd", 0, 456, 161, 25); CtxWI *CWI_6 = new CtxWI(0x1003a, "", -2, 452, 645, 31); CtxWI *CWI_7 = new CtxWI(0x10066, "ICA Seamless Host Agent", 0, 0, 391, 224); 97 Usin g th e Player, Script Developm en t W orkben ch , an d An alyze CtxWI CtxWI CtxWI CtxWI CtxWI CtxWI *CWI_8 = new CtxWI(0x10052, "Program Manager", 0, 0, 641, 481); *CWI_9 = new CtxWI(0x10088, "", 115, 0, 405, 457); *CWI_10 = new CtxWI(0x10134, "", 112, 116, 416, 248); *CWI_11 = new CtxWI(0x1012e, "Microsoft Word", 0, 0, 649, 461); *CWI_12 = new CtxWI(0x10176, "Microsoft Word", 162, 193, 322, 109); *CWI_13 = new CtxWI(0x7001c, "Please wait...", 111, 112, 418, 145); SET_ABORT_FUNCTION(abort_function); DEFINE_TRANS_TYPE("ctxwaitforscreenupdate.cpp"); CitrixInit(1); /* Citrix replay settings */ CtxSetConnectTimeout(60); CtxSetDisconnectTimeout(60); CtxSetWindowTimeout(30); CtxSetPingTimeout(20); CtxSetWaitPointTimeout(30); CtxSetWindowVerification(TRUE); CtxSetEnableCounters(FALSE); CtxSetWindowRetries(5, 5000); CtxSetEnableWildcardMatching(TRUE); SYNCHRONIZE(); BEGIN_TRANSACTION(); DO_SetTransactionStart(); CtxConnect(CitrixServer, CitrixOutputMode); CtxPoint(202, 89); //1113936216.354 // Window CWI_1 ("Warning !!") created 1113936216.354 CtxWaitForWindowCreate(CWI_1, 1953); DO_MSLEEP(1859); CtxPoint(320, 372); //1113936218.260 DO_MSLEEP(47); CtxClick(CWI_1, 78, L_BUTTON, NONE); //1113936218.338 // Window CWI_2 ("Log On to Windows") created 1113936218.479 CtxWaitForWindowCreate(CWI_2, 141); // Window CWI_1 ("Warning !!") destroyed 1113936218.479 CtxType(CWI_2, "citrix"); //1113936220.995 DO_MSLEEP(2312); CtxTypeVK(CWI_2, VK_TAB, NONE); DO_MSLEEP(281); CtxType(CWI_2, "citrix"); //1113936223.104 DO_MSLEEP(1782); CtxTypeVK(CWI_2, VK_TAB, NONE); DO_MSLEEP(297); CtxType(CWI_2, "q"); DO_MSLEEP(718); 98 //1113936221.073 //1113936223.151 //1113936224.354 QALoad On lin e Help DO_MSLEEP(1407); CtxPoint(243, 326); //1113936225.291 DO_MSLEEP(15); CtxClick(CWI_2, 63, L_BUTTON, NONE); //1113936225.354 DO_MSLEEP(78); // Window CWI_2 ("Log On to Windows") destroyed 1113936225.432 // Window CWI_3 ("Please wait...") created 1113936225.510 CtxWaitForWindowCreate(CWI_3, 78); DO_MSLEEP(78); // Window CWI_3 ("Please wait...") destroyed 1113936225.588 // Window CWI_4 ("Citrix License Warning Notice") created 1113936225.651 CtxWaitForWindowCreate(CWI_4, 63); // Window CWI_5 ("UsrLogon.Cmd") created 1113936225.666 CtxWaitForWindowCreate(CWI_5, 15); DO_MSLEEP(16); // Window CWI_5 ("UsrLogon.Cmd") destroyed 1113936225.682 // Window CWI_6 ("") created 1113936225.916 DO_MSLEEP(234); // Window CWI_7 ("ICA Seamless Host Agent") created 1113936225.963 CtxWaitForWindowCreate(CWI_7, 47); // Window CWI_8 ("Program Manager") created 1113936225.979 CtxWaitForWindowCreate(CWI_8, 16); DO_MSLEEP(953); CtxPoint(332, 299); //1113936226.963 DO_MSLEEP(31); CtxClick(CWI_7, 78, L_BUTTON, NONE); //1113936227.041 DO_MSLEEP(63); // Window CWI_4 ("Citrix License Warning Notice") destroyed 1113936227.104 DO_MSLEEP(328); CtxPoint(198, 203); //1113936227.588 DO_MSLEEP(156); CtxClick(CWI_7, 63, L_BUTTON, NONE); //1113936227.651 DO_MSLEEP(78); CtxPoint(208, 216); //1113936227.744 DO_MSLEEP(15); // Window CWI_7 ("ICA Seamless Host Agent") destroyed 1113936227.744 CtxPoint(266, 237); //1113936228.260 // Window CWI_9 ("") created 1113936228.260 DO_MSLEEP(453); 99 Usin g th e Player, Script Developm en t W orkben ch , an d An alyze DO_MSLEEP(3031); // Window CWI_9 ("") destroyed 1113936231.291 DO_MSLEEP(8531); CtxPoint(115, 170); //1113936240.182 DO_MSLEEP(360); CtxDoubleClick(CWI_8); // 1113936240.338 DO_MSLEEP(78); // Window CWI_10 ("") created 1113936240.463 DO_MSLEEP(125); CtxPoint(243, 205); //1113936240.619 // Window CWI_11 ("Microsoft Word") created 1113936240.619 CtxWaitForWindowCreate(CWI_11, 156); // Window CWI_10 ("") destroyed 1113936240.619 DO_MSLEEP(32); CtxPoint(250, 208); //1113936240.666 DO_MSLEEP(15); CWI_11->setTitle("Document1 - Microsoft Word"); //1113936240.869 CtxPoint(296, 0); /// /// /// /// /// //1113936245.916 This command was added to the script manually. The size parameters are from the Citrix window creation object, and the last parameter indicates that the wait time for completion of this screen update is set to 5 seconds. Note that this statement is placed before any mouse moves for that window. CtxWaitForScreenUpdate(0, 0, 649, 481, 5000); DO_MSLEEP(2094); CtxPoint(56, 201); //1113936248.260 DO_MSLEEP(250); CtxClick(CWI_11, 47, L_BUTTON, NONE); //1113936248.307 CtxType(CWI_11, "N"); DO_MSLEEP(1453); CtxPoint(68, 213); //1113936249.760 //1113936249.760 CtxType(CWI_11, "ow I"); //1113936251.041 DO_MSLEEP(1281); CtxType(CWI_11, " can type text!"); //1113936255.119 DO_MSLEEP(4078); DO_MSLEEP(2766); DO_MSLEEP(2094); CtxPoint(635, 5); //1113936260.010 DO_MSLEEP(31); CtxClick(CWI_11, 78, L_BUTTON, NONE); //1113936260.088 100 QALoad On lin e Help CtxPoint(634, 12); //1113936260.213 // Window CWI_12 ("Microsoft Word") created 1113936260.213 CtxWaitForWindowCreate(CWI_12, 16); DO_MSLEEP(875); CtxPoint(325, 275); //1113936261.088 CtxClick(CWI_12, 63, L_BUTTON, NONE); //1113936261.151 DO_MSLEEP(62); // Window CWI_12 ("Microsoft Word") destroyed 1113936261.213 DO_MSLEEP(16); // Window CWI_11 ("Document1 - Microsoft Word") destroyed 1113936261.229 DO_MSLEEP(1375); CtxPoint(385, 165); //1113936262.963 DO_MSLEEP(359); // Window CWI_8 ("Program Manager") destroyed 1113936262.963 // Window CWI_6 ("") destroyed 1113936262.979 // Window CWI_13 ("Please wait...") created 1113936263.244 CtxWaitForWindowCreate(CWI_13, 0); DO_SetTransactionCleanup(); CtxDisconnect(); END_TRANSACTION(); delete delete delete delete delete delete delete delete delete delete delete delete delete CWI_1; // "Warning !!" CWI_2; // "Log On to Windows" CWI_3; // "Please wait..." CWI_4; // "Citrix License Warning Notice" CWI_5; // "UsrLogon.Cmd" CWI_6; // "" CWI_7; // "ICA Seamless Host Agent" CWI_8; // "Program Manager" CWI_9; // "" CWI_10; // "" CWI_11; // "Microsoft Word" CWI_12; // "Microsoft Word" CWI_13; // "Please wait..." CitrixUninit(); EXIT(); return(0); } void abort_function(PLAYER_INFO *s_info) { RR__printf("Virtual User ABORTED."); CitrixUninit(); EXIT(); } 101 Usin g th e Player, Script Developm en t W orkben ch , an d An alyze Sam ple: Usin g th e Com m an d W h ile Recordin g Th e followin g sam ple sh ows a script with th e W aitPoin t com m an d in serted at record tim e. Poin ts of in terest in th e script are h igh ligh ted in bold. Sample Script /* * ctxwaitforscreenupdate.cpp * * Script Converted on April 19, 2005 at 02:44:44 PM * Generated by Compuware QALoad convert module version 5.5.0 build 256 * * This script contains support for the following middlewares: * - Citrix */ /* Converted using the following options: * General: * Line Split : 80 characters * Sleep Seconds : 1 * Auto Checkpoints : No * Citrix * General Options : * Replay Output Mode : Normal * Enable Counters : No * Timeout Value Options : * Timeout (s) : 60 * Disconnect Timeout (s) : 60 * Window Creation Timeout (s) : 30 * Ping Timeout (s) : 20 * Wait Point Timeout (s) : 30 * Input Options : * Combine Keyboard Input : Yes * Combine Mouse Input : Yes * Window Options : * Window Verification : Yes * Window Max Retries : 5 * Window Wait Retries (ms) : 5000 * Enable Wildcard Title Match : Yes */ #define CITRIX_CLIENT_VERSION "7.100.21825" #define CITRIX_ICO_VERSION "2.3" #define SCRIPT_VER 0x00000505UL #include <stdio.h> #include "smacro.h" #include "do_citrix.h" /* set function to call on abort*/ void abort_function(PLAYER_INFO *s_info); #ifndef NULL #define NULL #endif 0 extern "C" int rhobot_script(PLAYER_INFO *s_info) { /* Declare Variables */ const char *CitrixServer = "qaccitrix"; const char *CitrixPassword = ""; const int CitrixOutputMode = OUTPUT_MODE_NORMAL; /* Citrix Window Information Objects */ CtxWI *CWI_1 = new CtxWI(0x1001c, "Warning !!", 107, 43, 427, 351); 102 QALoad On lin e Help CtxWI CtxWI CtxWI CtxWI CtxWI CtxWI CtxWI CtxWI CtxWI CtxWI CtxWI CtxWI *CWI_2 = new CtxWI(0x2001c, "Log On to Windows", 111, 65, 418, 285); *CWI_3 = new CtxWI(0x5001c, "Please wait...", 111, 112, 418, 145); *CWI_4 = new CtxWI(0x40030, "Citrix License Warning Notice", 125, 198, 397, 127); *CWI_5 = new CtxWI(0x4002e, "UsrLogon.Cmd", 0, 456, 161, 25); *CWI_6 = new CtxWI(0x1003a, "", -2, 452, 645, 31); *CWI_7 = new CtxWI(0x10066, "ICA Seamless Host Agent", 0, 0, 391, 224); *CWI_8 = new CtxWI(0x10052, "Program Manager", 0, 0, 641, 481); *CWI_9 = new CtxWI(0x10088, "", 115, 0, 405, 457); *CWI_10 = new CtxWI(0x10134, "", 112, 116, 416, 248); *CWI_11 = new CtxWI(0x1012e, "Microsoft Word", -4, -4, 649, 461); *CWI_12 = new CtxWI(0x10176, "Microsoft Word", 162, 193, 322, 109); *CWI_13 = new CtxWI(0x7001c, "Please wait...", 111, 112, 418, 145); SET_ABORT_FUNCTION(abort_function); DEFINE_TRANS_TYPE("ctxwaitforscreenupdate.cpp"); CitrixInit(1); /* Citrix replay settings */ CtxSetConnectTimeout(60); CtxSetDisconnectTimeout(60); CtxSetWindowTimeout(30); CtxSetPingTimeout(20); CtxSetWaitPointTimeout(30); CtxSetWindowVerification(TRUE); CtxSetEnableCounters(FALSE); CtxSetWindowRetries(5, 5000); CtxSetEnableWildcardMatching(TRUE); SYNCHRONIZE(); BEGIN_TRANSACTION(); DO_SetTransactionStart(); CtxConnect(CitrixServer, CitrixOutputMode); CtxPoint(202, 89); //1113936216.354 // Window CWI_1 ("Warning !!") created 1113936216.354 CtxWaitForWindowCreate(CWI_1, 1953); DO_MSLEEP(1859); CtxPoint(320, 372); //1113936218.260 DO_MSLEEP(47); CtxClick(CWI_1, 78, L_BUTTON, NONE); //1113936218.338 // Window CWI_2 ("Log On to Windows") created 1113936218.479 CtxWaitForWindowCreate(CWI_2, 141); // Window CWI_1 ("Warning !!") destroyed 1113936218.479 CtxType(CWI_2, "citrix"); //1113936220.995 DO_MSLEEP(2312); CtxTypeVK(CWI_2, VK_TAB, NONE); DO_MSLEEP(281); CtxType(CWI_2, "citrix"); //1113936221.073 //1113936223.104 DO_MSLEEP(1782); 103 Usin g th e Player, Script Developm en t W orkben ch , an d An alyze CtxTypeVK(CWI_2, VK_TAB, NONE); DO_MSLEEP(297); CtxType(CWI_2, "q"); //1113936223.151 //1113936224.354 DO_MSLEEP(718); DO_MSLEEP(1407); CtxPoint(243, 326); //1113936225.291 DO_MSLEEP(15); CtxClick(CWI_2, 63, L_BUTTON, NONE); //1113936225.354 DO_MSLEEP(78); // Window CWI_2 ("Log On to Windows") destroyed 1113936225.432 // Window CWI_3 ("Please wait...") created 1113936225.510 CtxWaitForWindowCreate(CWI_3, 78); DO_MSLEEP(78); // Window CWI_3 ("Please wait...") destroyed 1113936225.588 // Window CWI_4 ("Citrix License Warning Notice") created CtxWaitForWindowCreate(CWI_4, 63); // Window CWI_5 ("UsrLogon.Cmd") created 1113936225.666 CtxWaitForWindowCreate(CWI_5, 15); DO_MSLEEP(16); // Window CWI_5 ("UsrLogon.Cmd") destroyed 1113936225.682 // Window CWI_6 ("") created 1113936225.916 DO_MSLEEP(234); // Window CWI_7 ("ICA Seamless Host Agent") created 1113936225.963 CtxWaitForWindowCreate(CWI_7, 47); // Window CWI_8 ("Program Manager") created 1113936225.979 CtxWaitForWindowCreate(CWI_8, 16); DO_MSLEEP(953); CtxPoint(332, 299); //1113936226.963 DO_MSLEEP(31); CtxClick(CWI_7, 78, L_BUTTON, NONE); //1113936227.041 DO_MSLEEP(63); // Window CWI_4 ("Citrix License Warning Notice") destroyed 1113936227.104 DO_MSLEEP(328); CtxPoint(198, 203); //1113936227.588 DO_MSLEEP(156); CtxClick(CWI_7, 63, L_BUTTON, NONE); //1113936227.651 DO_MSLEEP(78); CtxPoint(208, 216); //1113936227.744 DO_MSLEEP(15); // Window CWI_7 ("ICA Seamless Host Agent") destroyed 1113936227.744 104 QALoad On lin e Help CtxPoint(266, 237); //1113936228.260 // Window CWI_9 ("") created 1113936228.260 DO_MSLEEP(453); DO_MSLEEP(3031); // Window CWI_9 ("") destroyed 1113936231.291 DO_MSLEEP(8531); CtxPoint(115, 170); //1113936240.182 DO_MSLEEP(360); CtxDoubleClick(CWI_8); // 1113936240.338 DO_MSLEEP(78); // Window CWI_10 ("") created 1113936240.463 DO_MSLEEP(125); CtxPoint(243, 205); //1113936240.619 // Window CWI_11 ("Microsoft Word") created 1113936240.619 CtxWaitForWindowCreate(CWI_11, 156); // Window CWI_10 ("") destroyed 1113936240.619 DO_MSLEEP(32); CtxPoint(250, 208); //1113936240.666 DO_MSLEEP(15); CWI_11->setTitle("Document1 - Microsoft Word"); //1113936240.869 CtxPoint(296, 0); //1113936245.916 /// This command was added to the script by clicking on the /// ScreenUpdate message in the message panel, highlighting it, /// then clicking on the WaitPoint button CtxWaitForScreenUpdate(0, 0, 481, 641, 1406); DO_MSLEEP(2094); CtxPoint(56, 201); //1113936248.260 DO_MSLEEP(250); CtxClick(CWI_11, 47, L_BUTTON, NONE); //1113936248.307 CtxType(CWI_11, "N"); DO_MSLEEP(1453); CtxPoint(68, 213); //1113936249.760 //1113936249.760 CtxType(CWI_11, "ow I"); //1113936251.041 DO_MSLEEP(1281); CtxType(CWI_11, " can type text!"); //1113936255.119 DO_MSLEEP(4078); DO_MSLEEP(2766); DO_MSLEEP(2094); CtxPoint(635, 5); //1113936260.010 105 Usin g th e Player, Script Developm en t W orkben ch , an d An alyze DO_MSLEEP(31); CtxClick(CWI_11, 78, L_BUTTON, NONE); //1113936260.088 CtxPoint(634, 12); //1113936260.213 // Window CWI_12 ("Microsoft Word") created 1113936260.213 CtxWaitForWindowCreate(CWI_12, 16); DO_MSLEEP(875); CtxPoint(325, 275); //1113936261.088 CtxClick(CWI_12, 63, L_BUTTON, NONE); //1113936261.151 DO_MSLEEP(62); // Window CWI_12 ("Microsoft Word") destroyed 1113936261.213 DO_MSLEEP(16); // Window CWI_11 ("Document1 - Microsoft Word") destroyed 1113936261.229 DO_MSLEEP(1375); CtxPoint(385, 165); //1113936262.963 DO_MSLEEP(359); // Window CWI_8 ("Program Manager") destroyed 1113936262.963 // Window CWI_6 ("") destroyed 1113936262.979 // Window CWI_13 ("Please wait...") created 1113936263.244 CtxWaitForWindowCreate(CWI_13, 0); DO_SetTransactionCleanup(); CtxDisconnect(); END_TRANSACTION(); delete delete delete delete delete delete delete delete delete delete delete delete delete CWI_1; // "Warning !!" CWI_2; // "Log On to Windows" CWI_3; // "Please wait..." CWI_4; // "Citrix License Warning Notice" CWI_5; // "UsrLogon.Cmd" CWI_6; // "" CWI_7; // "ICA Seamless Host Agent" CWI_8; // "Program Manager" CWI_9; // "" CWI_10; // "" CWI_11; // "Microsoft Word" CWI_12; // "Microsoft Word" CWI_13; // "Please wait..." CitrixUninit(); EXIT(); return(0); } void abort_function(PLAYER_INFO *s_info) { RR__printf("Virtual User ABORTED."); CitrixUninit(); EXIT(); } 106 QALoad On lin e Help Cl eari n g Even t s f rom t h e I n t ern al Queue Clearin g Even ts from th e In tern al Queue In respon se to m ouse an d keyboard in put, th e Citrix server sen ds screen updat e even ts of th e updated screen im age to th e Citrix clien t appli cation . You can syn ch ron ize th ese screen update even ts with th e text or graph ic updat es in th e application by usin g CtxW aitForScreen Update to i n sert waitpoin ts in th e Citrix script. W h en n um erous m atch in g screen update even ts occur, such as th e flash in g edit cursor, th ey stay in th e in tern al queue in defin itely. Th is can cause th e CtxW aitForScreen Update fun ction to com pl ete prem at urely by m atch in g even ts with previ ously stored screen updates. You can clear th e in tern al queue by usin g th e CtxScreen Even tExists function in a sim ple loop. Th is flush es all past screen update even ts from th e in tern al queue, so a followin g CtxW aitForScreen Update can successfully wai t for th e n ext occurren ce of th e desired screen update even t. M odifyin g th e Script to Clear Even ts Syn ch ron ize keyboard an d m ouse even ts with th e appropri ate application even ts in a Citrix script, using CtxW aitForScreen Update to iden tify specific screen even ts an d CtxScreen Even tExists to flush all past screen update even ts from th e in tern al queue. Th is en ables a followin g CtxW aitForScreen Update to successfully wait for th e n ext occurren ce of th e desi red screen update even t. To m od i f y an ex i st i n g Ci t r i x scr i p t t h at con t ai n s on e or m or e Ct x W ai t For Scr een Up d at e com m an d s: 1. Open the script in QALoad Script Development Workbench. 2. If not already active, select View>Function Wizard. 3. Copy the existing CtxWaitForScreenUpdate command from the script, and paste it immediately above the existing command. 4. In the Command Definition pane, click the plus (+) or double-click the Citrix heading. The list of Citrix commands appears. 5. Click and drag the CtxScreenEventExists command from the Command Definition pane to the line above the first CtxWaitForScreenUpdate command. The CtxScreenEventExists function prototype appears and the suggested parameter EVT_STR_CTXSCREENUPDATE displays in a separate dialog box. 6. Double-click EVT_STR_CTXSCREENUPDATE. The parameter is inserted in the command. 7. After the EVT_STR_CTXSCREENUPDATE parameter, type: , 0, " ") 8. Inside the quotation marks, type the four numeric values from the CtxWaitForScreenUpdate command. Separate the values by spaces instead of commas, for example: "66 66 457 336" 9. Enclose the statement with the command: while ( ) In th is exam ple, th e script n ow appears as: while (CtxScreenEventExists(EVT_STR_CTXSCREENUPDATE, 0, "43 39 569 401")) CtxWaitForScreenUpdate(43, 39, 569, 401, 0); CtxWaitForScreenUpdate(43, 39, 569, 401, 3917); Not e: The timeout value for both the Ct xScreenEvent Exist s and Ct xWait ForScreenUpdat e commands is set to zero, since no actual waiting occurs in either command. 107 Usin g th e Player, Script Developm en t W orkben ch , an d An alyze Conclusion Use th is tech n ique to preven t problem s with extra screen update even ts causi n g prem ature m atch in g wh en usin g a CtxW aitForScreen Update com m an d durin g script replay. Th e followin g sam ple scripts illustrate th is process. Sam ple: Origin al Citrix Script usin g CtxW aitForScreen Update Th e followin g sam ple sh ows a script with th e CtxW aitForScreen Update in serted durin g th e script capture. Th e relevan t portion of th e script is h igh ligh ted in bold. Sample Script /* * CtxScreenEventExistsScript.cpp * * Script Converted on March 22, 2006 at 04:34:21 PM * Generated by Compuware QALoad convert module version 5.5.0 build 478 * Generated From: C:\Program Files\Compuware\QALoad\Middlewares\Citrix\Captures\CtxScreenEventExistsScript.cap * * * This script contains support for the following middlewares: - Citrix */ /* Converted using the following options: * General: * Line Split : 80 characters * Sleep Seconds : 1 * Auto Checkpoints : No * Citrix * General Options : * Replay Output Mode : Normal * Enable Counters : No * Timeout Value Options * Connect Timeout (s) : 60 * Disconnect Timeout (s) : 60 * Window Creation Timeout (s) : 30 * Ping Timeout (s) : 20 * Wait Point Timeout (s) : 30 * Input Options : : * Combine Keyboard Input : Yes * Combine Mouse Input : Yes * 108 Window Options : QALoad On lin e Help * Window Verification * Window Max Retries : 5 * Window Wait Retries (ms) : 5000 * : Yes Enable Wildcard Title Match : Yes */ #define CITRIX_CLIENT_VERSION "9.150.39151" #define CITRIX_ICO_VERSION "2.5" #define SCRIPT_VER 0x00000505UL #include <stdio.h> #include "smacro.h" #include "do_citrix.h" /* set function to call on abort*/ void abort_function(PLAYER_INFO *s_info); #ifndef NULL #define NULL 0 #endif extern "C" int rhobot_script(PLAYER_INFO *s_info) { /* Declare Variables */ const char *CitrixServer = "qaccitrix"; const char *CitrixPassword = ""; const int = OUTPUT_MODE_NORMAL; CitrixOutputMode /* Citrix Window Information Objects */ CtxWI *CWI_1 = new CtxWI(0x1001c, "Warning !!", 107, 43, 427, 351); CtxWI *CWI_2 = new CtxWI(0x2001c, "Log On to Windows", 111, 65, 418, 285); CtxWI *CWI_3 = new CtxWI(0x5001c, "Please wait...", 111, 112, 418, 145); CtxWI *CWI_4 = new CtxWI(0x30030, "Citrix License Warning Notice", 125, 198, 397, 127); CtxWI *CWI_5 = new CtxWI(0x40030, "Citrix License Warning Notice", 125, 198, 397, 127); CtxWI *CWI_6 = new CtxWI(0x4002e, "UsrLogon.Cmd", 0, 456, 161, 25); CtxWI *CWI_7 = new CtxWI(0x1003a, "", -2, 452, 645, 31); CtxWI *CWI_8 = new CtxWI(0x10066, "ICA Seamless Host Agent", 0, 0, 391, 224); CtxWI *CWI_9 = new CtxWI(0x10052, "Program Manager", 0, 0, 641, 481); CtxWI *CWI_10 = new CtxWI(0x10054, "", 2, 49, 205, 408); CtxWI *CWI_11 = new CtxWI(0x20068, "Run", 5, 269, 348, 180); CtxWI *CWI_12 = new CtxWI(0x10116, "", 65, 369, 254, 30); 109 Usin g th e Player, Script Developm en t W orkben ch , an d An alyze CtxWI *CWI_13 = new CtxWI(0x20114, "Untitled - Notepad", 43, 39, 569, 401); CtxWI *CWI_14 = new CtxWI(0x30068, "", 47, 80, 151, 144); CtxWI *CWI_15 = new CtxWI(0x40068, "Open", 47, 81, 564, 348); CtxWI *CWI_16 = new CtxWI(0x10130, "", 249, 386, 226, 30); CtxWI *CWI_17 = new CtxWI(0x7001c, "Please wait...", 111, 112, 418, 145); SET_ABORT_FUNCTION(abort_function); DEFINE_TRANS_TYPE("NotepadSampleForDoc.cpp"); CitrixInit(1); /* Citrix replay settings */ CtxSetConnectTimeout(60); CtxSetDisconnectTimeout(60); CtxSetWindowTimeout(30); CtxSetPingTimeout(20); CtxSetWaitPointTimeout(30); CtxSetWindowVerification(TRUE); CtxSetEnableCounters(FALSE); CtxSetWindowRetries(5, 5000); CtxSetEnableWildcardMatching(TRUE); CtxSetGracefulDisconnect(TRUE); SYNCHRONIZE(); BEGIN_TRANSACTION(); DO_SetTransactionStart(); CtxConnect(CitrixServer, CitrixOutputMode); CtxPoint(341, 298); //1143063207.863 // Window CWI_1 ("Warning !!") created 1143063207.863 CtxWaitForWindowCreate(CWI_1, 843); DO_MSLEEP(1094); CtxPoint(320, 366); //1143063209.160 DO_MSLEEP(203); CtxClick(CWI_1, 157, L_BUTTON, NONE); //1143063209.316 // Window CWI_1 ("Warning !!") destroyed 1143063209.395 110 QALoad On lin e Help CtxPoint(320, 365); //1143063209.473 // Window CWI_9 ("Program Manager") created 1143063210.348 CtxWaitForWindowCreate(CWI_9, 0); DO_MSLEEP(1437); CtxPoint(32, 469); //1143063214.676 DO_MSLEEP(94); CtxClick(CWI_7, 0, L_BUTTON, NONE); //1143063214.816 // Window CWI_10 ("") created 1143063214.816 DO_MSLEEP(125); DO_MSLEEP(1391); CtxPoint(52, 369); //1143063216.332 DO_MSLEEP(140); CtxClick(CWI_7, 125, L_BUTTON, NONE); //1143063216.457 // Window CWI_11 ("Run") created 1143063216.488 CtxWaitForWindowCreate(CWI_11, 31); DO_MSLEEP(16); // Window CWI_10 ("") destroyed 1143063216.504 CtxType(CWI_11, "notepad"); //1143063218.051 DO_MSLEEP(1312); DO_MSLEEP(63); // Window CWI_12 ("") destroyed 1143063219.426 111 Usin g th e Player, Script Developm en t W orkben ch , an d An alyze DO_MSLEEP(16); CtxTypeVK(CWI_11, VK_RETURN, NONE); //1143063219.582 DO_MSLEEP(140); // Window CWI_13 ("Untitled - Notepad") created 1143063219.582 CtxWaitForWindowCreate(CWI_13, 0); // Window CWI_11 ("Run") destroyed 1143063219.582 DO_MSLEEP(31); DO_MSLEEP(3563); CtxPoint(55, 71); //1143063223.316 DO_MSLEEP(141); CtxClick(CWI_13, 16, L_BUTTON, NONE); //1143063223.441 // Window CWI_14 ("") created 1143063223.426 DO_MSLEEP(109); DO_MSLEEP(1156); CtxPoint(74, 111); //1143063224.832 DO_MSLEEP(234); CtxClick(CWI_13, 72, L_BUTTON, NONE); // 1143063224.832 DO_MSLEEP(110); CtxPoint(74, 112); //1143063225.004 DO_MSLEEP(62); // Window CWI_14 ("") destroyed 1143063225.004 // Window CWI_15 ("Open") created 1143063225.176 CtxWaitForWindowCreate(CWI_15, 172); 112 QALoad On lin e Help CtxType(CWI_15, "bigfile.txt"); //1143063229.410 DO_MSLEEP(4000); CtxPoint(151, 149); //1143063229.410 // Window CWI_16 ("") created 1143063229.410 DO_MSLEEP(78); // Window CWI_16 ("") destroyed 1143063232.379 DO_MSLEEP(63); CtxTypeVK(CWI_15, VK_RETURN, NONE); //1143063234.441 DO_MSLEEP(1906); DO_MSLEEP(15); // Window CWI_15 ("Open") destroyed 1143063234.363 DO_MSLEEP(79); DO_MSLEEP(1218); CtxPoint(157, 1); //1143063235.926 DO_MSLEEP(266); CWI_13->setTitle("bigfile.txt - Notepad"); //1143063243.035 DO_MSLEEP(5453); CtxPoint(594, 48); //1143063244.441 /// /// This waitpoint was inserted during the Citrix session capture: /// CtxWaitForScreenUpdate(43, 39, 569, 401, 2406); 113 Usin g th e Player, Script Developm en t W orkben ch , an d An alyze DO_MSLEEP(657); CtxClick(CWI_13, 171, L_BUTTON, NONE); //1143063244.613 DO_MSLEEP(94); // Window CWI_13 ("bigfile.txt - Notepad") destroyed 1143063244.707 DO_MSLEEP(594); CtxPoint(567, 6); //1143063247.582 DO_MSLEEP(2281); // Window CWI_9 ("Program Manager") destroyed 1143063247.582 // Window CWI_7 ("") destroyed 1143063247.645 // Window CWI_17 ("Please wait...") created 1143063247.926 CtxWaitForWindowCreate(CWI_17, 0); DO_SetTransactionCleanup(); CtxDisconnect(); END_TRANSACTION(); delete CWI_1; // "Warning !!" delete CWI_2; // "Log On to Windows" delete CWI_3; // "Please wait..." delete CWI_4; // "Citrix License Warning Notice" delete CWI_5; // "Citrix License Warning Notice" delete CWI_6; // "UsrLogon.Cmd" delete CWI_7; // "" delete CWI_8; // "ICA Seamless Host Agent" delete CWI_9; // "Program Manager" delete CWI_10; // "" delete CWI_11; // "Run" delete CWI_12; // "" delete CWI_13; // "Untitled - Notepad" delete CWI_14; // "" 114 QALoad On lin e Help delete CWI_15; // "Open" delete CWI_16; // "" delete CWI_17; // "Please wait..." CitrixUninit(); EXIT(); return(0); } void abort_function(PLAYER_INFO *s_info) { RR__printf("Virtual User ABORTED."); CitrixUninit(); EXIT(); } Sam ple: M odified Citrix Script Clearin g Even ts Th e followin g sam ple sh ows th e script m odified to use th e CtxScreen Even tExists com m an d to flush past screen update even ts from th e in tern al queue. Script ch an ges are h igh ligh ted in bold. Sample Script /* * CtxScreenEventExistsScript.cpp * * Script Converted on March 22, 2006 at 04:34:21 PM * Generated by Compuware QALoad convert module version 5.5.0 build 478 * Generated From: C:\Program Files\Compuware\QALoad\Middlewares\Citrix\Captures\CtxScreenEventExistsScript.cap * * * This script contains support for the following middlewares: - Citrix */ /* Converted using the following options: * General: 115 Usin g th e Player, Script Developm en t W orkben ch , an d An alyze * Line Split : 80 characters * Sleep Seconds : 1 * Auto Checkpoints : No * Citrix * General Options : * Replay Output Mode : Normal * Enable Counters : No * Timeout Value Options * Connect Timeout (s) : 60 * Disconnect Timeout (s) : 60 * Window Creation Timeout (s) : 30 * Ping Timeout (s) : 20 * Wait Point Timeout (s) : 30 * : Input Options : * Combine Keyboard Input : Yes * Combine Mouse Input : Yes * Window Options : * Window Verification * Window Max Retries : 5 * Window Wait Retries (ms) : 5000 * : Yes Enable Wildcard Title Match : Yes */ #define CITRIX_CLIENT_VERSION "9.150.39151" #define CITRIX_ICO_VERSION "2.5" #define SCRIPT_VER 0x00000505UL #include <stdio.h> #include "smacro.h" #include "do_citrix.h" /* set function to call on abort*/ void abort_function(PLAYER_INFO *s_info); #ifndef NULL #define NULL 0 #endif extern "C" int rhobot_script(PLAYER_INFO *s_info) { /* Declare Variables */ const char *CitrixServer 116 = "qaccitrix"; QALoad On lin e Help const char *CitrixPassword = ""; const int = OUTPUT_MODE_NORMAL; CitrixOutputMode /* Citrix Window Information Objects */ CtxWI *CWI_1 = new CtxWI(0x1001c, "Warning !!", 107, 43, 427, 351); CtxWI *CWI_2 = new CtxWI(0x2001c, "Log On to Windows", 111, 65, 418, 285); CtxWI *CWI_3 = new CtxWI(0x5001c, "Please wait...", 111, 112, 418, 145); CtxWI *CWI_4 = new CtxWI(0x30030, "Citrix License Warning Notice", 125, 198, 397, 127); CtxWI *CWI_5 = new CtxWI(0x40030, "Citrix License Warning Notice", 125, 198, 397, 127); CtxWI *CWI_6 = new CtxWI(0x4002e, "UsrLogon.Cmd", 0, 456, 161, 25); CtxWI *CWI_7 = new CtxWI(0x1003a, "", -2, 452, 645, 31); CtxWI *CWI_8 = new CtxWI(0x10066, "ICA Seamless Host Agent", 0, 0, 391, 224); CtxWI *CWI_9 = new CtxWI(0x10052, "Program Manager", 0, 0, 641, 481); CtxWI *CWI_10 = new CtxWI(0x10054, "", 2, 49, 205, 408); CtxWI *CWI_11 = new CtxWI(0x20068, "Run", 5, 269, 348, 180); CtxWI *CWI_12 = new CtxWI(0x10116, "", 65, 369, 254, 30); CtxWI *CWI_13 = new CtxWI(0x20114, "Untitled - Notepad", 43, 39, 569, 401); CtxWI *CWI_14 = new CtxWI(0x30068, "", 47, 80, 151, 144); CtxWI *CWI_15 = new CtxWI(0x40068, "Open", 47, 81, 564, 348); CtxWI *CWI_16 = new CtxWI(0x10130, "", 249, 386, 226, 30); CtxWI *CWI_17 = new CtxWI(0x7001c, "Please wait...", 111, 112, 418, 145); SET_ABORT_FUNCTION(abort_function); DEFINE_TRANS_TYPE("NotepadSampleForDoc.cpp"); CitrixInit(1); /* Citrix replay settings */ CtxSetConnectTimeout(60); CtxSetDisconnectTimeout(60); CtxSetWindowTimeout(30); CtxSetPingTimeout(20); CtxSetWaitPointTimeout(30); CtxSetWindowVerification(TRUE); CtxSetEnableCounters(FALSE); CtxSetWindowRetries(5, 5000); CtxSetEnableWildcardMatching(TRUE); CtxSetGracefulDisconnect(TRUE); 117 Usin g th e Player, Script Developm en t W orkben ch , an d An alyze SYNCHRONIZE(); BEGIN_TRANSACTION(); DO_SetTransactionStart(); CtxConnect(CitrixServer, CitrixOutputMode); CtxPoint(341, 298); //1143063207.863 // Window CWI_1 ("Warning !!") created 1143063207.863 CtxWaitForWindowCreate(CWI_1, 843); DO_MSLEEP(1094); CtxPoint(320, 366); //1143063209.160 DO_MSLEEP(203); CtxClick(CWI_1, 157, L_BUTTON, NONE); //1143063209.316 // Window CWI_1 ("Warning !!") destroyed 1143063209.395 CtxPoint(320, 365); //1143063209.473 // Window CWI_9 ("Program Manager") created 1143063210.348 CtxWaitForWindowCreate(CWI_9, 0); DO_MSLEEP(1437); CtxPoint(32, 469); //1143063214.676 DO_MSLEEP(94); CtxClick(CWI_7, 0, L_BUTTON, NONE); //1143063214.816 // Window CWI_10 ("") created 1143063214.816 118 QALoad On lin e Help DO_MSLEEP(125); DO_MSLEEP(1391); CtxPoint(52, 369); //1143063216.332 DO_MSLEEP(140); CtxClick(CWI_7, 125, L_BUTTON, NONE); //1143063216.457 // Window CWI_11 ("Run") created 1143063216.488 CtxWaitForWindowCreate(CWI_11, 31); DO_MSLEEP(16); // Window CWI_10 ("") destroyed 1143063216.504 CtxType(CWI_11, "notepad"); //1143063218.051 DO_MSLEEP(1312); DO_MSLEEP(63); // Window CWI_12 ("") destroyed 1143063219.426 DO_MSLEEP(16); CtxTypeVK(CWI_11, VK_RETURN, NONE); //1143063219.582 DO_MSLEEP(140); // Window CWI_13 ("Untitled - Notepad") created 1143063219.582 CtxWaitForWindowCreate(CWI_13, 0); // Window CWI_11 ("Run") destroyed 1143063219.582 DO_MSLEEP(31); DO_MSLEEP(3563); CtxPoint(55, 71); //1143063223.316 119 Usin g th e Player, Script Developm en t W orkben ch , an d An alyze DO_MSLEEP(141); CtxClick(CWI_13, 16, L_BUTTON, NONE); //1143063223.441 // Window CWI_14 ("") created 1143063223.426 DO_MSLEEP(109); DO_MSLEEP(1156); CtxPoint(74, 111); //1143063224.832 DO_MSLEEP(234); CtxClick(CWI_13, 72, L_BUTTON, NONE); // 1143063224.832 DO_MSLEEP(110); CtxPoint(74, 112); //1143063225.004 DO_MSLEEP(62); // Window CWI_14 ("") destroyed 1143063225.004 // Window CWI_15 ("Open") created 1143063225.176 CtxWaitForWindowCreate(CWI_15, 172); CtxType(CWI_15, "bigfile.txt"); //1143063229.410 DO_MSLEEP(4000); CtxPoint(151, 149); //1143063229.410 // Window CWI_16 ("") created 1143063229.410 DO_MSLEEP(78); // Window CWI_16 ("") destroyed 1143063232.379 DO_MSLEEP(63); CtxTypeVK(CWI_15, VK_RETURN, NONE); 120 //1143063234.441 QALoad On lin e Help DO_MSLEEP(1906); DO_MSLEEP(15); // Window CWI_15 ("Open") destroyed 1143063234.363 DO_MSLEEP(79); DO_MSLEEP(1218); CtxPoint(157, 1); //1143063235.926 DO_MSLEEP(266); CWI_13->setTitle("bigfile.txt - Notepad"); //1143063243.035 DO_MSLEEP(5453); CtxPoint(594, 48); //1143063244.441 /// Flush all past screen update events for specified screen region (window) from the queue: while (CtxScreenEventExists(EVT_STR_CTXSCREENUPDATE, 0, "43 39 569 401")) CtxWaitForScreenUpdate(43, 39, 569, 401, 0); /// /// This waitpoint was inserted during the Citrix session capture. /// Wait 2.5 seconds for new update to the specified screen region/window: /// CtxWaitForScreenUpdate(43, 39, 569, 401, 2500); DO_MSLEEP(657); CtxClick(CWI_13, 171, L_BUTTON, NONE); //1143063244.613 DO_MSLEEP(94); // Window CWI_13 ("bigfile.txt - Notepad") destroyed 1143063244.707 DO_MSLEEP(594); CtxPoint(567, 6); //1143063247.582 121 Usin g th e Player, Script Developm en t W orkben ch , an d An alyze DO_MSLEEP(2281); // Window CWI_9 ("Program Manager") destroyed 1143063247.582 // Window CWI_7 ("") destroyed 1143063247.645 // Window CWI_17 ("Please wait...") created 1143063247.926 CtxWaitForWindowCreate(CWI_17, 0); DO_SetTransactionCleanup(); CtxDisconnect(); END_TRANSACTION(); delete CWI_1; // "Warning !!" delete CWI_2; // "Log On to Windows" delete CWI_3; // "Please wait..." delete CWI_4; // "Citrix License Warning Notice" delete CWI_5; // "Citrix License Warning Notice" delete CWI_6; // "UsrLogon.Cmd" delete CWI_7; // "" delete CWI_8; // "ICA Seamless Host Agent" delete CWI_9; // "Program Manager" delete CWI_10; // "" delete CWI_11; // "Run" delete CWI_12; // "" delete CWI_13; // "Untitled - Notepad" delete CWI_14; // "" delete CWI_15; // "Open" delete CWI_16; // "" delete CWI_17; // "Please wait..." CitrixUninit(); EXIT(); return(0); } 122 QALoad On lin e Help void abort_function(PLAYER_INFO *s_info) { RR__printf("Virtual User ABORTED."); CitrixUninit(); EXIT(); } .NET Overview of the QALoad .NET Session QALoad provides perform an ce testin g in .NET en viron m en ts n ot supported by a capture facility. It creates a tem plate C# script, or stub script, th at you can edit m an ually in a M icrosoft Visual Studio session . Not e: You must install Microsoft Visual Studio 2005, Microsoft .NET Framework v2.0 Service Pack 1, and the QALoad Add-In in order to use the QALoad .NET session. Use th e QALoad fun ction s provi ded in th e .NET session to create an d edit th e C# script from th e script tem plate. All stan dard QALoad fun ction ality is supported in th e .NET session , in cludin g datapools an d ch eckpoin ts, VU-specific data, such as VU n um ber, Tran saction n um ber, an d pacin g values. On ce you in sert custom code in to th e stub script, you com pile it, debug it, an d validate it usin g th e QALoad m en u option s provided in th e .NET session . You also can use th e com piler option s an d debuggin g capabilities available in Vi sual Studio. W h en th e source file is created, a solution file an d a project file also are creat ed. Th e source file, solution file, an d proj ect file are st ored togeth er in th eir own subdirectory in QALoad\Middlewares\DOTNET\Scripts. Not e: You can have only one solution file open at a time. If a solution is loaded, you must save any changes and close the file before you create and load a new script. Execute com piled scripts usin g th e QALoad Con ductor. W h en you create a n ew Con ductor session an d select th e DOTNET m iddl eware type in th e Test Con figuration W izard, your .NET scripts displ ay for selection . Starting a .NET Session Use th e followin g procedure to open a .NET session . To st ar t a .NET sessi on : From th e workben ch , cli ck Sessi on >.NET. Th is start s a M icrosoft Visual Studi o session with th e M an age QALoad Scripts di alog box displayed. From th is dialog box you can : ! Create a new script ! Edit a script ! Delete a script. Not es: 123 Usin g th e Player, Script Developm en t W orkben ch , an d An alyze ! ! You must install Microsoft Visual Studio 2005, Microsoft .NET Framework v2.0 Service Pack 1, and the QALoad Add-In before using the .NET session. In Microsoft Visual Studio, you can have only one solution file open at a time. If a solution is loaded, you are asked to save any changes and close the file before the new script is created and loaded. QALoad .NET M enu Th e followin g QALoad m en u option s are avail able from Tool s>QALoad wh en a QALoad .NET Session is open in M icrosoft Visual Studio. M an age QALoad Scri pt s: Use th is option to create a n ew C# script, edit an existin g script, or delete a script. Scripts are stored in \ QALoad\Middlewares\DOTNET\Scripts. I n sert Scri pt St at em en t : Displays th e com m an ds t h at you can in sert in to your script. Com m an ds are grouped in logical categories. Refer to .NET in th e Lan guage Referen ce Com m an ds folder in th e QALoad on lin e h elp for in form ation on th e in dividual com m an ds available for .NET session s. Com pi l e Scri pt : Available wh en a QALoad script is open . Th e QALoad script i s C# based an d th erefore m ust be com piled before it can be used. Scripts are com piled usin g th e curren t build con figuration (Release or Debug m ode). If you m ake ch an ges to an existin g script, you m ust re-com pile it before you can successfully use it in a test. Com piled scripts are stored in \ QALoad\Scripts. Val i dat e Scri pt : Available wh en a QALoad script is open . Th is option com pil es th e script usin g Release m ode. W h en th e com pil ation com pletes successfully, th e Validate session begin s with on e Virtual User (VU) for on e tran saction . Debug Scri pt : Available wh en a QALoad scri pt is open . Th is option com piles t h e script in Debug m ode so th at you can place breakpoin ts in your script. W h en th e com pilation com pletes successfully, th e validate session begin s with on e VU for on e tran saction . 124 QALoad On lin e Help Con duct or: Open s th e Con ductor to set up an d start a test. QALoad H el p: Open s th e m ain QALoad on lin e h elp for .NET session s. Managing QALoad .NET Scripts On ce you open a .NET session in Visual Studio, you can access, create, an d update QALoad scripts usin g th e M an age QALoad Scripts dialog box. To access t h e M an ag e QALoad d i al og b ox i n Vi sual St ud i o: W ith a .NET session open in Visual Studio, click Tool s>QALoad >M an age QALoad Scri pt s. Th e M an age QALoad Scripts di alog box appears. From th is dialog box you can : Create a scri pt Edit an existin g script Delete a script Compiling, Validating, and Debugging a QALoad .NET Script A QALoad .NET script is a real C#-based script, an d th erefore n eeds to be com piled before it can be used. On ce com piled, you can debug an d validate th e script. If you m ake ch an ges to an existin g script, you m ust re-com pile it before you can successfully use it in a test. Use th e QALoad m en u in Visual Studio to: Com pile a QALoad .NET Script Debug a QALoad .NET Script Validate a QALoad .NET Script .NET Command Reference Th e QALoad Lan guage Referen ce provi des com m an d referen ce in form ation for gen eral an d m iddlewarespecific fun ction s. Refer t o .NET in th e Lan guage Referen ce Com m an ds folder in th e QALoad on lin e h elp for in form ation on th e in dividual fun ction s available in .NET session s. Java Overview—About Java QALoad does n ot support recordin g of Java scripts. In stead, Java scri pts are created from scri pt tem plates th at you use to create a st ub script th at you can th en edit m an ually. Tem plat es are saved in th e QALoad\Middlewares\Java\Templates directory. QALoad supplies four default tem plates. QALoad uses a token n am e to represen t th e classpath — wh en you create a n ew Java scri pt, QALoad sim ply replaces th e token <classnamehere> with th e class/ script n am e you assign . You can also i n stall addition al tem plates usin g th e <classnamehere> token if you wish . Followin g is an exam ple of a Java tem plate with th e classn am e token (in bold): 125 Usin g th e Player, Script Developm en t W orkben ch , an d An alyze import com.compuware.qacenter.qaload.EasyScript.*; public class <classnamehere> implements EasyScript { /** optional - Class method runs once for each script when class is loaded */ public static void setup QALoad Test () throws Exception { } Use th e Script Developm en t W orkben ch to create a n ew EasyScript for Java script from th e provided stub scripts. Accessing JavaDoc QALoad provides JavaDoc for your referen ce. To access it from th e Script Developm en t W orkben ch m en u, ch oose H el p>EasyScri pt f or Jav a: Jav aDoc from a Java session . Creating a Java Script To cr eat e a Java scr i p t f or QALoad : 1. With a Java session open, choose File>New from the menu. 2. In the File area, click on the Middleware tree item. 3. In the Filename field, type a name for your new Java script. Note that Java file names do have special requirements, and QALoad enforces those requirements. For example, Java file names cannot contain spaces. If you try to include a space in your file name, QALoad gives you an error prompt. 4. Click OK. The Create Java Script dialog box opens. 5. Under the Script field is a selection box listing all the templates available in your \QALoad\Middlewares\Java\Templates directory. QALoad provides four default templates. If you click on a template name, a sample is shown in the right pane. The four templates are: ! lon g form at — Provides al l required an d option al m eth ods. ! n ew class — Creat es a class associated with th e script. ! old form at — Sh ows m odi fication s n eeded to run legacy scri pts. ! sh ort form at — Provides on ly th e m in im um required m eth ods. Select th e tem plate th at best suits your n eeds an d cl ick OK. QALoad creates a stub script by th e n am e you design ated an d open s it in th e W orkbook pan e for editin g. 6. Edit your script as necessary. You can use QALoad's Java Script Options dialog box to edit some script attributes. Not e: The main call in the script is used for debugging proposes and is not executed in the Conductor. Setting Classpaths in QALoad Player for EasyScript for Java W h en loadin g a class by n am e in th e QALoad Player durin g run tim e, do n ot use a class n am e on th e En terprise Java Bean (EJB) In itialCon text call. In stead, use a class in stan ce or add a lin e of code before th e JNDI lookup call. Refer to th e followin g exam ples: Using a class instance 126 QALoad On lin e Help Repl ace th e In itialCon text properties an d JNDI n am es in th e followin g exam ple with th e values th at are appropriate for your appli cation . Before: java.util.Hashtable ht = new java.util.Hashtable(); ht.put(javax.naming.Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory"); ht.put(javax.naming.Context.PROVIDER_URL, "fh12623:1099"); javax.naming.InitialContext ic = new javax.naming.InitialContext(ht); Object ref = ic.lookup("AddressMSvc"); After: org.jnp.interfaces.NamingContextFactory nf = new org.jnp.interfaces.NamingContextFactory(); java.util.Hashtable ht = new java.util.Hashtable(); ht.put(javax.naming.Context.PROVIDER_URL, "fh12623:1099"); javax.naming.Context ic = nf.getInitialContext(ht); Object ref = ic.lookup("AddressMSvc"); Adding a line of code before the JNDI lookup call Add th e followin g lin e before th e JNDI l ookup call: Thread.currentThread().setContextClassLoader(getClass().getClassLoader()); If it is a static m eth od, use th e followin g sam ple, replacin g CLASSNAME with the class n am e of th e code. Thread.currentThread().setContextClassLoader(CLASSNAME.class.getClassLoader()); Executing a Java Applet Java applets are h an dled by th e followin g process: 1. The browser makes a request to a Web server for an HTML document that contains embedded Java applets. 2. The browser downloads the Java applets, in the order in which they appear on the Web page, and immediately executes them. Ex am pl e W eb Page Th e followin g W eb page con tain s two section s th at referen ce Java applets. Notice th e param eters th at follow th e applet. Th e browser passes th ese param et ers wh en in vokin g an applet. <HTML> <HEAD> <TITLE>Java Example</TITLE></HEAD> <BODY> <center><h2>Java Applet Example</h2><hr> <applet code="LScrollText.class" width="500" height="20" > <PARAM NAME="MESSAGE" VALUE="Scrolling Text created by Java Applet... >>Click here to Download<< Use it FREE"> <PARAM NAME="FONTHEIGHT" VALUE="14"> <PARAM NAME="SPEED" VALUE="2"> <PARAM NAME="PIXELS" VALUE="1"> <PARAM NAME="FONTCOLOR" VALUE="0000FF"> <PARAM NAME="BACKCOLOR" VALUE="FFFF00"> <PARAM NAME="TARGET" VALUE="lscrolltext.zip"> </applet> <br><br><br> 127 Usin g th e Player, Script Developm en t W orkben ch , an d An alyze A scrolling message, with custom colors, font size, speed, and target URL.<br> The source (.ZIP) file can be downloaded by clicking the associated area in text window. <br><br><br><hr> <APPLET CODE="imagefader.class" WIDTH=80 HEIGHT=107> <PARAM name="demicron" value="www.demicron.se"> <PARAM name="reg" value="A00012"> <PARAM name="maxitems" value="3"> <PARAM name="width" value="80"> <PARAM name="height" value="107"> <PARAM name="bitmap0" value="anibal.jpg"> <PARAM name="bitmap1" value="jak.jpg"> <PARAM name="bitmap2" value="jan.jpg"> <PARAM name="url0" value=" "> <PARAM name="url1" value=" "> <PARAM name="url2" value=" "> <PARAM name="step" value="0.05"> <PARAM name="delay" value="20"> <PARAM name="sleeptime" value="2000"> </APPLET> <br><br><br> This applet is a very popular image fader that displays a series of images, and allows URLs to be associated with each image.<br><br><hr> </center> </BODY></HTML> Ex am pl e scri pt QALoad does n ot evaluate Java applets. Th ey appear as m ain requests. Th e exam ple script features th e followin g elem en ts: ! A DO_Http call to retrieve the main page. ! A DO_Http call to retrieve the scrolling text class. ! A DO_Http call to retrieve the image fader class Java applet. H ow I t W or k s: QALoad in teracts with th e W eb server with out execution of t h e Java applet program wi th in th e virtual browser. Th e browser accepts th e pages t h at con tain Java applets, but does n ot execute th e applet as part of th e load t est. Th e Java applets are n ot evaluated by QALoad an d appear as m ain requests in th e script. DO_InitHttp(s_info); ... ... BEGIN_TRANSACTION(); ... ... DO_Http("GET http://www.host.com/java.htm HTTP/1.0\r\n\r\n"); DO_VerifyDocTitle("Java Example", TITLE); /* Request: 2 */ DO_Http("GET http://www.host.com/LScrollText.class HTTP/1.0\r\n\r\n"); /* Request: 3 */ DO_Http("GET http://www.host.com/imagefader.class HTTP/1.0\r\n\r\n"); DO_Http("GET http://www.host.com/jak.jpg HTTP/1.0\r\n\r\n"); ... ... END_TRANSACTION(); 128 QALoad On lin e Help Oracle Forms Server Verifying Oracle Forms Server Window Creation Th e ofsW in dowCreated com m an d does two th in gs. First, it en sures th at for th e ofsSen dRecv() com m an d precedin g it, th e server in cludes in th e respon se th at a Form W in dow object with th e title specified is created. Th e script return s FALSE if th e object is n ot created. Secon d, th e origi n al (captured) con trol ID is associated with th e object represen tin g th e con trol i n OFS replay’s in tern al list of con trols, wh ich is in addition to th e (run tim e) con trol ID th at is tracked. Th is allows better trackin g of Form W in dow GUI con trols th at exist at run tim e by bein g able to m atch up both th e con trol n am e an d th e origin al con trol ID. Th e ofsW in dowCreated com m an d on ly h an dles objects of type Form W in dow. Usi n g t h e of sW i n dow Cr eat ed Scri pt Com m an d Th e followin g exam ple sh ows an exam pl e from a m odified OFS script: ofsSendRecv(1); //ClientSeqNo=1|MsgCount=1|1137439721.484 if (!ofsWindowCreated(11, "WINDOW_LARGE_GRAPH")) { // Only fail if this window was not created RR__FailedMsg(s_info, "WINDOW_LARGE_GRAPH was not created!"); } ofsWindowCreated(15, ofsWindowCreated(20, ofsWindowCreated(24, ofsWindowCreated(28, "WINDOW_START_APP"); "WINDOW_CONTROLSTEST"); "WINDOW_GRAPHICSTEST"); "WINDOW_DATABASETEST"); Understanding the C++ Script Oracle Form s Server scri pt s are produced for all Oracle E-Busin ess Suite an d Oracle Application s recordin gs. Th e C++ script executes OFS-related statem en ts by passin g th e statem en ts in th e script DLL to th e OFS Java en gin e th at perform s th e clien t activities an d th e cl ien t com m un ication with th e server. Because th e C++ script statem en ts are directly tied to correspon din g m eth ods in th e OFS Java en gin e, m odification s to th e script statem en ts are lim ited to ch an gin g th e property param eter values th rough variablization . An OFS C++ script con tain s th ree m ain section s: Con n ection , Application Body, an d Discon n ect. Th e QALoad tran saction loop i n cludes all th ree section s by default. Th e tran saction loop can be m oved usin g th e guidelin es described i n M ovin g th e OFS tran saction loop. An in tern al auto ch eckpoin t is created durin g con n ection statem en ts an d tran sm ission statem en ts. Th e C++ script statem en ts are a con den sed version of th e Java-style script stat em en ts. Th e C++ script statem en ts sh ow th e GUI con trols in th e OFS application an d th e con trol properties, wh ich are eith er con trol attributes or activities. For exam ple: ofsClickButton( "BUTTON", 52, OFS_ENDMSG, 325 ); In th is exam ple, th e user clicks (property 325) a button ( con trol ID 52). OFS_ENDM SG is a flag th at in dicates th at th e GUI act ivity en ds th e curren t OFS M essage. QALoad also allows OFS an d W W W statem en ts from a Un iversal session to be scripted in th e C++ script, provi din g th e ability to play back W W W an d OFS statem en ts. QALoad autom atically extracts ICX tickets an d an y n ecessary cookies from th e W W W m iddleware traffic an d passes th em to th e OFS m iddleware. 129 Usin g th e Player, Script Developm en t W orkben ch , an d An alyze Setting Oracle Forms Convert Options Use th e followin g procedures to set Oracle Form s con vert option s an d advan ced con vert option s. Use th e advan ced con vert option s to custom ize th e post-capture steps taken before con vertin g th e capture file t o a script, or to m an ually perform post-capture processin g of a proxycap (h exadecim al en coded) file. Th is produces a n ew cap file, postcapweb file, lon gcap file, an d sortedcap. Th is process overwrites th ese files wh en th ey already exist. To set con ver si on op t i on s f or Or acl e For m s i n a si n g l e sessi on : 1. Ch oose Opt i on s>Con vert in th e Script Developm en t W orkben ch toolbar. Th e Session Option s dialog box appears. 2. Select th e appropriate opt ion s, th en click OK. To set con ver si on op t i on s f or Or acl e For m s i n a Un i ver sal sessi on : 1. Choose Options>Convert in the Script Development Workbench toolbar. The Session Options dialog box appears with both Oracle Forms Server and WWW selected. 2. Click the Session Options tab. 3. Under Convert Options in the tree view, click Oracle Forms Convert Options. 4. Select the appropriate options, then click OK. To set Ad van ced con ver t op t i on s: 1. Choose Options>Convert in the Script Development Workbench toolbar to open the Session Options dialog box. 2. In the Convert Options tree view, click Advanced Convert Options. 3. Select the appropriate options, then click OK. Recording Oracle Forms Server Sessions You can record an Oracle Form s session in a sin gle session , or in a Un iversal session for Oracle E-Busin ess Suite 11i (EBS-11i) an d Oracle E-Busin ess Suite 12 (EBS-12). Select th e down arrow n ext to th e Oracl e Form s Server Sessi on but ton on th e toolbar, th en follow on e of th e procedures below. To b eg i n r ecor d i n g an OFS si n g l e sessi on : 1. Select Oracle Forms to activate a new OFS single session. 2. From the toolbar, select Options>Record, and select the appropriate options. 3. Click Record on the Session toolbar. To b eg i n r ecor d i n g OFS i n a Un i ver sal sessi on : 130 1. Select E-Business Suite 11i or E-Business Suite 12 to activate Universal session for Oracle Forms and WWW middlewares. 2. Click Record on the Session toolbar. The Session Options dialog box displays with the Middleware tab on top. Both WWW and Oracle Forms Server are selected. 3. Click the Session Options tab. QALoad On lin e Help 4. In the tree view under Record Options, select Oracle Forms Record Options. The Oracle Forms Record Options pane displays on the right. The session you initiated, either E-Business Suite 11i or E-Business Suite 12, automatically displays in the Forms Environment field. 5. Select the appropriate options, then click OK to begin recording. Not e: When you record EBS-12 using Internet Explorer 6, changing the Accessibility option on the EBS-12 login page from the default (None) requires modifications to your script in order for it to run properly. Refer to Changing Accessibility Options in Oracle EB-12 for more information. Oracle Forms Recording M odes QALoad supports recordin g Oracle E-Busin ess Suite (EBS) 12 an d 11i, an d Oracle Application s usin g Form s 10g, 9i, an d patch ed 6i (version s 6.0.8.14 an d up). Th ese application s m ay be recorded in HTTP m ode (also called Servl et m ode), SSL m ode (also called HTTPS or Secure Servlet m ode), an d socket m ode. Th ese recordin g types are descri bed briefly below. Recordi n g Servl et M ode Oracle Form s Appli cation s use HTTP to sen d Form s data across th e n etwork. To record in Servlet m ode, select Servlet in th e Con n ection M ode list in th e Record Option s dialog box before you start recordin g your application . Not e: When using server-side recording, you must perform steps to configure the server. See Using serverside recording for more information. Server-side recording is not available for EBS-12 or EBS-11i. Recordi n g SSL M ode To record an OFS applicat ion in Secure Servlet (SSL) m ode, select Secure Servl et in th e Con n ection M ode list in th e Record Option s dialog box. For n on -EBS-12 application s, you m ust specify a cert DB file by en terin g th e Jin itiator certDB file th at th e application uses. Th e certDB file verifies th e SSL Certificate Auth ority on th e clien t side prior t o th e Form s con n ection . Th is field is n ot required for EBS-12. Not e: SSL mode is not available with server-side recording. Recordi n g Sock et M ode For Socket M ode recordin g, QALoad m ust start your application for you th rough your browser. Before recordin g, en ter th e URL of th e Form s applet page i n th e URL field, an d th e Form s Serv er port in th e Port field. If you leave th e Port field blan k, or en ter an in correct port n um ber, your recordin g will on ly result in an em pty capture file. You m ay leave th e URL field blan k, but will be prom pted for th e Form s applet page on th e in itial browser page. From th e applet page, click th e lin k to your Form s appli cation . QALoad will take over recordin g at th is poin t. Checkpoints in Oracle Forms Server scripts EasyScript for Oracle Form s Server supports QALoad's autom atic m iddleware ch eckpoin t tim in gs in both HTTP an d socket m odes. Default ch eckpoin ts (Begin / En d Ch eckpoin t pairs) are n ot supported. Autom atic ch eckpoin ts are en abled from th e Con ductor on Tim in g Option s page of th e Scri pt Propert i es di al og box an d are en abl ed on a scri pt-by-script basis. At playback, autom atic ch eckpoin ts are executed durin g th e ofsSen dRecv statem en t. Debug dat a W h en th e Debug Data option is en abled on th e Con figure Script Developm en t W orkben ch dialog box for validation , or th e Con ductor's Debug Trace option i s en abled for pl ayback, executed scri pt statem en ts will be displayed. For exam ple: 131 Usin g th e Player, Script Developm en t W orkben ch , an d An alyze VU VU VU VU VU VU 0 0 0 0 0 0 : : : : : : Line:90, Line:91, Line:92, Line:93, Line:94, Line:95, ofsSetWindowSize( "FORMWINDOW" ,6, OFS_ENDMSG, 137, 750, 600 ) ofsActivateWindow( "WINDOW_START_APP" ,11, OFS_ENDMSG, 247 ) ofsShowWindow( "WINDOW_START_APP" ,11, OFS_ENDMSG, 173 ) ofsFocus( "BUTTON" ,51, OFS_ENDMSG, 174 ) ofsSetWindowSize( "FORMWINDOW" ,6, OFS_ENDMSG, 137, 750, 600 ) ofsSendRecv( 1 ) //ClientSeqNo=2|MsgCount=6 Oracle Forms Server method reference QALoad provides descri ption s an d exam ples of th e various m eth ods an d fun ct ion s available for an Oracl e Form s Server script. For details, refer to th e Lan guage Referen ce Help section for Oracle Form s Server. Using the certDB File for OFS Replay In som e Oracle Application Server an d Oracle E-Busi n ess Suite 11i en viron m en ts, th e certificates n eeded for th e SSL h an dsh ake with th e server are n ot in th e default wallet used durin g replay. Th is causes th e SSL h an dsh ake to fail. You can use th e cert DB fil e used by JIn itiator for OFS replay. To do th is for Script Validation , pl ace th e certdb.txt file in th e Bin aryFiles direct ory. To use t h e cer t DB f i l e f or OFS r ep l ay i n Con d uct or : 1. In the Conductor's Visual Designer, select the script icon for the appropriate script to display the Script Properties panel on the right-hand of the window. 2. In the External Data area, click the browse [...] button in the Attached Files field. The Attached Files page of the Script Properties dialog box appears. 3. Click Add. The Choose a File to Attach dialog box displays. 4. From the BinaryFiles folder, select certdb.txt, then click Open. 5. Click OK. Connection Statements Th e con n ection scri pt lin es in th e C++ script vary depen din g on th e type of Form s con n ection m ode th at is active. You ch oose th e Form s con n ection m ode on th e Oracle Form s Record Option s dialog box. Form s con n ection m odes in clude server-side recordin g, HTTP, HTTPS, or socket. Server-side recordin g is lim ited to application s th at use Form s 9i (application s run n in g in Oracle 9iAS Release 2 an d above). HTTP con n ection m ode is avai lable for application s usin g Form s 9i an d for application s usin g th e pat ch ed Form s 6i version con figured with th e HTTP servlet. HTTPS con n ection m ode is strictly for SSL-en abled application s th at use Form s 9i. Socket con n ection m ode is for applicati on s th at use Form s 6i an d lower version s, such as Oracle 11i. 132 QALoad On lin e Help Server-si de recordi n g con n ect i on s Server-side recordin g m ode con tain s on ly on e con n ection statem en t. Th e fun ction th at is used – ofsSetServletM ode – con tain s th e listen er servlet value th at you en tered on t h e Oracl e Form s Ser ver Recordi n g Opt i on s dialog box. Th e first param eter defin es th e HTTP or HTTPS con figuration of th e application en viron m en t. Th e secon d param eter defin es th e n am e of th e Form s Listen er Servlet used by th e application . To con n ect, QALoad in tern ally in vokes Oracle’s dispatch calls usin g th e two param eters. Oracle’s proprietary classes provide th e im plem en tation for th e HTTP or HTTPS con n ection . For exam ple: ofsSetServletMode(OFS_HTTP, "http://ntsap45b:7779/forms90/l90servlet" ); H TTP con n ect i on s HTTP con n ection m ode con tain s m ultiple con n ecti on statem en ts. To con n ect, QALoad in tern ally perform s Java calls to accom plish th e followin g tasks: ! Define HTTP header properties ! Connect to the Forms Servlet (an HTTP-GET request) ! Set the parameters of the Forms Listener Servlet ! Connect to the Forms Listener Servlet (an HTTP-GET request) ! Set additional HTTP header property for the Listener Servlet ! Connect to the Forms Listener Servlet (an HTTP-POST request). The last connection statement also initiates the required Forms “handshake” and determines the Forms encryption used by the application environment. For exam ple: ofsHTTPSetHdrProperty("User-Agent", "Java1.3.1.9" ); ofsHTTPSetHdrProperty("Host", "ntsap45b:7779" ); ofsHTTPSetHdrProperty("Accept", "text/html, image/gif, image/jpeg, *; q=.2, "*/*; q=.2" ); ofsHTTPSetHdrProperty("Connection", "Keep-alive" ); ofsHTTPConnectToFormsServlet( "http://ntsap45b:7779/forms90/f90servlet?ifcmd=startsession" ); ofsHTTPSetListenerServletParms( "?ifcmd=getinfo&ifhost=C104444D01&ifip= "192.168.234.1" ); ofsHTTPConnectToListenerServlet( "http://ntsap45b:7779/forms90/l90servlet"); ofsHTTPSetHdrProperty("Content-type", "application/x-www-form-urlencoded" ); ofsHTTPInitialFormsConnect(); H TTPS con n ect i on s HTTPS con n ection m ode uses th e sam e con n ection statem en ts as HTTP m ode. Sock et con n ect i on s Socket m ode con tain s on ly on e con n ection statem en t. Th e fun ction th at is used – ofsCon n ectToSocket – con tain s th e port n um ber an d th e URL you en tered on th e Oracle Form s Record Option s dialog box to start OFS capture. Th e port val ue is th e port on wh ich th e Form s Server directly list en s for Form s traffic. To con n ect, QALoad uses Java calls to open a Java socket usin g th e param eters, in itiate th e required Form s "h an dsh ake” , an d determ i n e th e Form s en cryption used by th e application en viron m en t. For exam pl e: ofsConnectToSocket("10.10.0.167", 9002 ); Application Statements Th e application statem en t s in th e C++ script con sist of property statem en ts an d tran sm ission statem en ts. Property st atem en ts descri be th e attributes an d activities of GUI con trols in th e application . Tran sm ission statem en ts sen d th e GUI con trols an d th eir properti es as Form s M essage data t o th e server. Th ere is on ly on e tran sm ission statem en t: ofsSen dRecv. QALoad creates an in tern al auto ch eckpoin t wh en th is statem en t 133 Usin g th e Player, Script Developm en t W orkben ch , an d An alyze is executed. In th e followi n g exam ple, th e first two (property) statem en ts set th e location an d size of a Form W in dow GUI con trol. Th e ofsSen dRecv statem en t sen ds th e GUI con trol properties to th e server. ofsSetWindowLocation( "FORMWINDOW", 6, OFS_ENDMSG, 135, 0, 0); ofsSetWindowSize( "FORMWINDOW", 6, OFS_ENDMSG, 137, 650, 500); ofsSendRecv(1 ); //Transmission //Property //Property Par am et er s of a propert y st at em en t : Th e param eters of a property statem en t are arran ged in th e followin g sequen ce: 1. Captured control name. If the name is not available, this value is the class name to which the control belongs. 2. Captured control ID. 3. Action type. This flag indicates if the property is to be added to the current Forms Message or if the property ends the current Forms Message. During playback, each control is treated as a Forms Message. When the current Message ends, QALoad translates the control and its properties to binary format. The valid values are: OFS_ADD – add th e property to th e curren t M essage. OFS_ENDM SG – add th e propert y to th e curren t M essage an d en d th e M essage. OFS_STARTSUBM SG – add th e property of th e succeedin g n ested M essage to th e curren t M essage. 4. Property ID. The Forms version-specific ID of the property. 5. Property value. Captured value of the property (optional) 6. Property value. Captured value of the property (optional) For exam ple: ofsSetWindowSize( "FORMWINDOW", 6, OFS_ENDMSG, 137, 650, 500); In th is exam ple, con trol ID 6, wh ich belon gs to GUI class FORM W INDOW , is resized (PROPERTY 137) to h ave coordin ates 650 an d 500. Th is m arks th e en d of th e curren t M essage. Form s en viron m en t statem en ts: Th e in itial set of statem en ts in th e Form s script describes th e Form s application en viron m en t. In th is set, th e "version ” an d th e “ cm dlin e” properties are th e m ost im portan t. Th e versi on property sh ows th e Form s Builder version used by th e application . Th e version in dicates th e capabilities of th e application . For exam ple, som e version s can n ot support HTTP con n ection s. Th e cm dlin e property sh ows th e Form s con figuration param eters passed t o th e server by th e Form s applet. Th e param eter “ record=n am es” in dicates th at th e applicat ion en ables GUI con trol n am es to be captured. Con t rol n am es are preferred in m ulti-th readed playback. Th e “ ICX” param eter in dicates th at th e application uses a Person al Hom e Page. In th e sam ple script below, th e Form s builder versi on is 90290 (th e version used in Oracle 9iAS Release 2, un patch ed). Th e cm dlin e property sh ows “ record=form s” wh ich defaults “ record=n am es” . Th e cm dlin e property does n ot h ave th e “ ICX” ticket param eter. ofsSetInitialVersion( "RUNFORM", 1, OFS_ADD, 268, "90290" ); ofsSetScreenResolution( "RUNFORM", 1, OFS_ADD, 263, 96, 96); ofsSetDisplaySize( "RUNFORM", 1, OFS_ADD, 264, 1024, 768); ofsInitSessionCmdLine("RUNFORM", 1, OFS_ADD, 265, "server module=test1.fmx userid= sso_userid= debug=no buffer_records=no debug_" "messages=no array=no query_only=no quiet=yes render=no host=ntsap45b.prodti.com" "puware.com port= record=forms tracegroup=debug log=run1 term=" ); ofsSetColorDepth( "RUNFORM", 1, OFS_ADD, 266, "256" ); ofsColorAdd( "RUNFORM", 1, OFS_ADD, 284, "0" ); ofsColorAdd( "RUNFORM", 1, OFS_ADD, 284, "8421504" ); ofsSetFontName( "RUNFORM", 1, OFS_ADD, 383, "Dialog" ); ofsSetFontSize( "RUNFORM", 1, OFS_ADD, 377, "900" ); ofsSetFontStyle( "RUNFORM", 1, OFS_ADD, 378, "0" ); ofsSetFontWeight( "RUNFORM", 1, OFS_ADD, 379, "0" ); ofsSetScaleInfo( "RUNFORM", 1, OFS_ADD, 267, 8, 20); 134 QALoad On lin e Help ofsSetNoRequiredVAList( "RUNFORM", 1, OFS_ADD, 291 ); ofsSetPropertyString( "RUNFORM", 1, OFS_ENDMSG, 530, "America/New_York" ); ofsSendRecv(1 ); //ClientSeqNo=1|CapTime=1086884188.281|MsgCount=1 Sen din g m essages to th e server: Th e ofsSen dRecv statem en t sen ds th e accum ulated GUI con trols an d th eir properties to th e Form s Server as bin ary data. Th is statem en t represen ts th e poin t at wh ich th e clien t sen ds a Form s Term in al M essage to th e server. In Oracle Form s, t h e clien t an d th e server m ust en d each data block with a Term in al M essage before an y tran sm ission occurs. In tern ally, QALoad varies th e bin ary data tran sm issi on depen din g on th e con n ection m ode: ! For server-side recording mode, QALoad sends the binary data by invoking Oracle’s dispatch calls. Oracle’s own classes provide the implementation for the HTTP transmission. ! For HTTP or HTTPS mode, QALoad wraps the binary data inside an HTTP stream and invokes Java’s HTTP calls. ! For socket mode, QALoad sends the binary data directly to the Java socket opened at the connection point. Th e ofsSen dRecv statem en t h as on e param eter: th e respon se code of th e capt ured Term in al M essage. Th e possible values for th is param eter are 1 (add), 2 (update), an d 3 (close). Typically, wh en th e respon se code is 3, th e Form s Server reacts by rem ovin g th e GUI con trols associated with th e clien t m essage from th e server cach e. A com m en t lin e appears after each ofsSen dRecv stat em en t th at con tain s script-trackin g in form ation . Th e in form ation on th e com m en t lin e is also foun d in th e capture file in each ofsSen dRecv capture lin e. Th e com m en t lin e sh ows th e relative sequen ce of each clien t request, as represen t ed by a Term in al M essage, from th e start of th e application (e.g. Clien tSeqNo=1). Th e com m en t lin e also sh ows th e tim in g m ark of th e captured Term in al M essage (e.g. CapTim e=1086884188.281) an d th e n um ber of Form s m essages con tain ed in th e request (e.g. M sgCoun t=1). Th e n um ber of M essages can be verified by coun tin g th e precedin g ENDM SG an d STARTSUBM SG flags in th e request block. Th e com m en t lin e is useful for debuggin g playback issues because it readily sh ows t h e clien t request sequen ce n um ber wh ere th e issue is occurrin g. Gettin g th e server reply: Durin g th e execution of ofsSen dRecv, QALoad also obtain s th e server’s reply an d tran slates th e bin ary Form s data in to Form s con trol values an d con trol properties. Th e values are also written to th e playback log file (in capture file form at) if script loggin g is enabled. Th e followin g sam ple is a server repl y: VU VU VU VU VU 0 0 0 0 0 : : : : : M|S|2|0|1 P|S|322|java.lang.Integer|0|151000320 P|S|279|java.lang.Boolean|0|false P|S|525|java.lang.String|AMERICAN_AMERICA.WE8MSWIN1252 T|S|1|ServerSeqNo=1|MsgCount=76 Th e first lin e in dicates th e start of a Form s M essage from th e server (M |S). Th e th ird param et er is an acti on code (1= add, 2= update, 3= delete, 4= get propert y value). Th e fourth param eter is th e Class Code of th e con trol (0 = root cl ass). Th e fifth param eter is th e Con trol ID (1= Run Form ). Th e secon d, th ird an d fourth lin es are property lin es related to th e above Form s M essage from th e server (P|S). Th e th ird param eter of each lin e is th e propert y ID (322). Th e fourth param eter is th e data type of th is property (java.lan g.In teger). Th e fifth param eter is th e data value. If th e value is 0, th e data value is in a sixth param eter (false). Th e th ird lin e is th e term in al m essage lin e from th e server (T|S). Th e th ird param eter is th e respon se code associated with th e term in al m essage (1= add, 2= update, = cl ose). Th e fourt h param eter is th e relative sequen ce of th e server reply, as represen ted by a Term in al M essage, from th e start of th e application (e.g. ServerSeqNo= 1). Th e fifth param eter is th e n um ber of Form s m essages con tain ed in th e reply (e.g. M sgCoun t = 1). Th e n um ber of M essages m ay be verified by coun tin g th e precedin g M |S flags in th e reply block. Th e fourth an d fifth param eters are scri pt-trackin g in form ation , wh ich can be useful for debuggin g 135 Usin g th e Player, Script Developm en t W orkben ch , an d An alyze a playback issue. If loggin g is en abled, th e log file sh ows th e trackin g in form ation , wh ich can m ake th e com parison between server respon ses an d captured respon ses easier. Processin g large data an d delayed respon se scen arios: W h en HTTP or HTTPS con n ection m ode is used, Form s data is wrapped in side th e HTTP reply stream . QALoad ch ecks th e HTTP h eader of th e reply before processin g th e Form s dat a. Th e HTTP h eader som etim es in dicates th at th e clien t n eeds to perform addition al HTTP POST requests to obtain th e com plete Form s dat a. Th is in dication occurs wh en th e con ten t-len gth of th e reply is 64000 (a large dat a scen ario), or th e con ten t-type is "text/ pl ain ” an d th e HTTP h eader con tain s an “ iferror: ” strin g (a delayed respon se/ re-post scen ario). QALoad perform s th e n ecessary POST requests to obtain th e com plete reply data, an d th en tran slates t h e accum ulated repl y dat a to Form s con trols an d properties. Disconnect statements Th e discon n ect scri pt lin es vary depen din g on th e Form s con n ection m ode. ! In server-side recording mode, the ofsServerSideDisconnect script statement internally invokes Oracle’s dispatch calls to disconnect. ! In HTTP mode, the ofsHTTPDisconnect statement internally makes Java calls to disconnect the main URL connection from the servlet. ! In socket mode, the ofsSocketDisconnect statement closes the socket on which the Forms Server listens for traffic. Using Script Logging as a Debugging tool You can debug a playback issue in a C++ script by en ablin g replay loggin g. Th e option for en ablin g replay loggin g is located on th e Debug page of th e Script Properties di alog box of th e Con ductor. For m ore in form ation about en ablin g log file gen eration , see Debuggin g a script. W h en loggin g is en abled, QALoad writes th e clien t requests an d server replies to th e playback log file in th e sam e form at as th e capture file. Th e playback log file is foun d in th e \QALoad\LogFiles directory. W h en th ere is an issue durin g playback, such as th e server n ot respon din g to a clien t request, you can com pare th e capture files an d ch eck th e differen ces in th e server reply data. Both th e capture file an d th e log file con tain trackin g in form at ion appen ded to th e server’s term in al m essages. Th e trackin g data con tain s th e relative sequen ce n um ber of th e server reply from th e start of th e Form s session an d th e tim in g m ark. Th e trackin g data also sh ows th e n um ber of Form s m essages con tain ed in th e reply block. Th e n um ber of m essages are based on th e n um ber of “ M |S” lin es prior to th e “ T|S” lin es. In th e followin g exam ple, th e first set of statem en ts sh ows th e logged statem en ts an d th e secon d set of statem en ts sh ows th e capt ured statem en ts. Th e ServerSeqNo value sh ows th at th is is th e 8th reply from th e server. Th e M sgCoun t val ue of 1 sh ows th at on ly on e Form s M essage is in cluded in th is reply block. 1087419810.000|ofsShowWindow|WINDOW_START_APP|11|OFS_ENDMSG|173|PROPERTY_VISIBLE|java.lang.B oolean|true 1087419810.000|ofsSendRecv|1|ClientSeqNo=8|CapTime=1087419810.000|MsgCount=1 1087419810.000|M|S|2|0|30 1087419810.000|P|S|135|java.awt.Point|0|java.awt.Point[x=0,y=0] 1087419810.000|P|S|137|java.awt.Point|0|java.awt.Point[x=706,y=464] 1087419810.000|P|S|139|java.awt.Point|0|java.awt.Point[x=0,y=0] 1087419810.000T|S|1|ServerSeqNo=8|CapTime=1087419810.000|MsgCount=1 1087402349.296|ofsShowWindow|WINDOW_START_APP|11|OFS_ENDMSG|173|PROPERTY_VISIBLE|java.lang.B oolean|true 1087402349.296|ofsSendRecv|1|ClientSeqNo=8|CapTime=1087402349.296|MsgCount=1 136 QALoad On lin e Help 1087402349.296|M|S|2|0|30 1087402349.296|P|S|135|java.awt.Point|0|java.awt.Point[x=0,y=0] 1087402349.296|P|S|137|java.awt.Point|0|java.awt.Point[x=706,y=464] 1087402349.296|P|S|139|java.awt.Point|0|java.awt.Point[x=0,y=0] 1087402349.296|T|S|1|ServerSeqNo=8|CapTime=1087402349.296|MsgCount=1 Moving the OFS Transaction Loop To en able m ovem en t of th e QALoad tran saction loop in th e C++ script, you m ust first record a full busin ess tran saction an d a partial busin ess tran saction . Th e busin ess tran saction is th e activity th at you would like to repeat durin g QALoad playback. In sert QALoad capture com m en ts (usin g th e I n sert Com m an d button on th e Recordin g toolbar) at th e start an d en d of a busin ess tran saction . Th ese com m en ts will h elp you fin d th e spots in th e script wh ere you woul d like to reposition th e BEGIN_TRANSACTION() an d END_TRANSACTION() statem en ts. Th en re-start th e busin ess tran saction . QALoad's OFS script presen ts a sequen ce of Form s GUI objects. Th e GUI obj ects con tain con text depen den cies. For exam pl e, wh en a win dow is open ed, th e button s, text fields an d edit boxes in side th at win dow are logically depen den t on th e state of th at win dow. W h en on ly on e busin ess tran saction is captured an d th e correspon din g script’s tran saction loop is m oved, th e sequen ce of th e GUI obj ects is broken durin g th e secon d iteration of th e tran saction loop. Th e broken sequen ce results in a broken con text, wh ich causes th e server to respon d un predi ctably durin g playback on th e secon d an d subsequen t iteration s of th e tran sacti on loop. W h en th e busin ess tran saction is restarted durin g capture, th e Form s GUI objects th at com pose th e n ew tran saction are used to an ch or in to th e n ew tran saction loop with out breakin g th e con text depen den cies of GUI obj ects. W h en m odifyin g th e script, use th e com m en t lin es as guides in m ovin g th e END_TRANSACTION() an d BEGIN_TRANSACTION() statem en ts. En sure th at there is a con textual flow from th e n ew position of th e END_TRANSACTION() statem en t to th e n ew position of th e BEGIN_TRANSACTION() statem en t. Th e set of GUI objects th at belon g t o th e ofsSen dRecv() statem en t just before th e n ew END_TRANSACTION() statem en t m ust be th e sam e as th e set of GUI objects th at belon g to th e ofsSen dRecv() statem en t prior t o th e n ew BEGIN_TRANSACTION() statem en t. Durin g playback, m odify t h e Con ductor settin g for Script Pacin g to allow th e database to process each n ew busin ess tran saction . Th e followin g exam ple sh ows a m odified OFS tran saction loop: New position of th e BEGIN_TRANSACTION statem en t /* NewSales */ DO_SLEEP(13); ofsEdit( "ORDER_SOLD_TO_0", 562, OFS_ADD, 131, "B" ); ofsSetSelection( "ORDER_SOLD_TO_0", 562, OFS_ADD, 195, 1, 1); ofsSetCursorPosition( "ORDER_SOLD_TO_0", 562, OFS_ENDMSG, 193, "1" ); ofsIndexKey( "ORDER_SOLD_TO_0", 562, OFS_ENDMSG, 175, 97, 0); DO_SLEEP(6); ofsSendRecv(1); //ClientSeqNo=31|MsgCount=2|1093981339.921 BEGIN_TRANSACTION(); ofsEdit( "ORDER_SOLD_TO_0", 562, OFS_ADD, 131, "Business World" ); ofsSetSelection( "ORDER_SOLD_TO_0", 562, OFS_ADD, 195, 14, 14); ofsSetCursorPosition( "ORDER_SOLD_TO_0", 562, OFS_ENDMSG, 193, "14" ); ofsRemoveFocus( "ORDER_SOLD_TO_0", 562, OFS_ENDMSG, 174 ); ofsSetSelection( "ORDER_CUSTOMER_NUMBER_0", 564, OFS_ADD, 195, 0, 0); ofsSetCursorPosition( "ORDER_CUSTOMER_NUMBER_0", 564, OFS_ENDMSG, 193, "0" ); ofsFocus( "ORDER_CUSTOMER_NUMBER_0", 564, OFS_ENDMSG, 174 ); 137 Usin g th e Player, Script Developm en t W orkben ch , an d An alyze DO_SLEEP(6); ofsSendRecv(1); //ClientSeqNo=32|MsgCount=4|1093981347.296 New position of th e END_TRANSACTION statem en t /* EndTrans */ DO_SLEEP(39); ofsSendRecv(1); //ClientSeqNo=61|MsgCount=4|1093981458.031 ofsSetCursorPosition( "ORDER_SOLD_TO_0", 562, OFS_ENDMSG, 193, "14" ); ofsSelectMenuItem( "Sales Orders", 257, OFS_ENDMSG, 477, "MENU_11059" ); DO_SLEEP(26); ofsSendRecv(1); //ClientSeqNo=62|MsgCount=2|1093981485.265 ofsEdit( "ORDER_SOLD_TO_0", 562, OFS_ADD, 131, "B" ); ofsSetSelection( "ORDER_SOLD_TO_0", 562, OFS_ADD, 195, 1, 1); ofsSetCursorPosition( "ORDER_SOLD_TO_0", 562, OFS_ENDMSG, 193, "1" ); ofsIndexKey( "ORDER_SOLD_TO_0", 562, OFS_ENDMSG, 175, 97, 0); DO_SLEEP(3); ofsSendRecv(1); //ClientSeqNo=63|MsgCount=2|1093981488.437 END_TRANSACTION(); ofsEdit( "ORDER_SOLD_TO_0", 562, OFS_ADD, 131, "Business World" ); ofsSetSelection( "ORDER_SOLD_TO_0", 562, OFS_ADD, 195, 14, 14); ofsSetCursorPosition( "ORDER_SOLD_TO_0", 562, OFS_ENDMSG, 193, "14" ); ofsIndexSKey( "ORDER_SOLD_TO_0", 562, OFS_ENDMSG, 176, 10, 0); DO_SLEEP(13); ofsSendRecv(1); //ClientSeqNo=64|MsgCount=2|1093981502.640 Tips: During capture, the OFS configuration parameter "record=names" must be enabled to produce control names that may be included in the converted script. Control names persist throughout the Forms session, unlike control IDs, whose values may change at runtime. Add the “ record=names” parameter in the Formsweb.cfg file or add this parameter to the startup servlet URL. Control IDs can create problems when the transaction loop is moved. Some of the control IDs that have been instantiated by the server prior to the new transaction loop lose context during iterations of the new loop. For example, in a second loop iteration, the server assumes that these client controls are new, generates new control IDs, and eventually cannot find the proper context. Then the server stops responding. If control names are used, Forms objects that have been instantiated before the new transaction loop are maintained through all iterations of the loop because the control name persists throughout the application session. During playback, ensure that the sleep factor is at 100% and that the transaction pacing is set to a large enough value for the server to process the business transaction that is contained in the new loop. These options can be set using the Script Properties panel of the Conductor's Visual Designer. OFS Script Samples Oracl e Form s Ser ver Scri pt Sam pl es You can address specific si tuation s or resolve certain problem s by m odifyin g con verted Oracle Form s Server (OFS) scripts. Th e sam ples sh own h ere in clude a description of th e problem , th e procedure for im plem en tin g th e m odification , an d sam ples of a m odified script. Scri pt m odification s are discussed for: Param eterization of Login Creden tials Ch an gin g Accessibility Option s in Oracle EBS-12 138 QALoad On lin e Help M odi f yi n g t h e OFS Scri pt t o Param et eri ze Logon Creden t i al s If your load testin g en viron m en t for Oracle Form s Server preven ts a user from bein g logged in m ultiple tim es con curren tly, you m ay n eed to param eterize th e logon in form ation . Th is m ean s creatin g un ique values for th e usern am e an d password of each virtual user (VU) an d tran sacti on . To scr i p t p ar am et er s f or l og on i n f or m at i on : 1. Create a datapool th at con tain s user n am es an d passwords for th e system you are testin g. 2. M odify th e scri pt to open th e datapool, read th e usern am e an d password from th e datapool, an d use th e values in th e ofsSetLogon UserNam e() an d ofsSetLogon PassW ord() scri pt com m an ds. Con clusion Th e sam ple scri pt illustrates th e param eterization of logon creden tials. Ch an gi n g t h e Accessi bi l i t y Opt i on i n Oracl e EBS-12 W h en recordin g EBS-12, th e login page appears wit h th e default option , Non e, selected in th e Accessibility field. W h en you capture usin g In tern et Explorer 6 an d you select a differen t Accessibility option (Screen Reader Optim ized or Stan dard Accessibility), a n ew request is m ade usin g JavaScript, to display th e login page with th e n ew option selected. You m ust m odify th e resultin g script in order to successfully login to th e en viron m en t. Th e followin g procedure sh ows th e n ecessary m odification s wh en you select th e Stan dard Accessibility option . To m od i f y t h e scr i p t f or al t er n at e Accessi b i l i t y op t i on s: 1. Modify the Accessibility parameter in POST data in the initial request for the login page. //Note: Comment out the GET statement that extracts the value for Accessibility option "None". Add //a GET statement that extracts the value for the Accessibility options"Standard Accessibility". //__Extract_Accessibility = Get(REPLY, // STRING, // name=\"Accessibility\"><option selected " // "value=\"", // "\""); __Extract_Accessibility = Get(REPLY, STRING, "Screen Reader Optimized</option>” “<option value=\"", "\">Standard Accessibility"); 2. Modify the _FORM_SUBMIT_BUTTON parameter in the initial request for the login page to use a blank string instead of the extracted parameter. // NOTE: Change the value used for the Form Submit Button parameter to // an empty string, since that is what happened at capture time. //Set(NEXT_REQUEST_ONLY, // POST_DATA, // "_FORM_SUBMIT_BUTTON", // ___FORM_SUBMIT_BU); Set(NEXT_REQUEST_ONLY, POST_DATA, "_FORM_SUBMIT_BUTTON", ""); 139 Usin g th e Player, Script Developm en t W orkben ch , an d An alyze 3. Select the new Accessibility option and comment out the GET command for the Accessibility parameter in the second POST request for the login page so that the previously extracted value is used. // NOTE: Comment out the Get for Accessibility. The value extracted // previously can be used here. //__Extract_Accessibility = Get(REPLY, // STRING, // "name=\"Accessibility\"><option selected " // "value=\"", "\""); Th e sam ple scri pt sh ows a com plete script with th e n ecessary m odification s m ade. Sam pl e: Par am et eri zat i on of OFS Logon Creden t i al s Th e followin g is a sam ple script from an Oracle Form s Server Session th at tests Oracle 10g Application Server an d uses a cen tral datapool to en sure th at usern am e an d passwords are un ique. Th e code n ecessary to param eterize th e usern am e an d password is in bold. Sam ple Script /* * sample_parameterization.cpp * * Script Converted on July 06, 2007 at 11:14:51 AM * Generated by Compuware QALoad convert module version 5.6.0 build 95 * Generated From: C:\Program Files\Compuware\QALoad\Middlewares\Oracle Forms Server\Captures\sample_parameterization.cap * * This script contains support for the following middlewares: * - Oracle Forms Server */ /* Converted using the following options: * General: * Line Split : 80 characters * Sleep Seconds : 1 * Auto Checkpoints : No * Oracle Forms Server * Stop for server error messages : Yes * Stop if server msg is matched : No */ #define SCRIPT_VER 0x00000605UL #include <stdio.h> extern "C" { #include "smacro.h" #include "do_OFS.h" } /* set function to call on abort*/ void abort_function(PLAYER_INFO *s_info); #ifndef NULL #define NULL 0 #endif extern "C" int rhobot_script(PLAYER_INFO *s_info) { /* Declare Variables */ //------------------------------------------------// Pointers to use for username and password values // returned from VARDATA(). //------------------------------------------------char *username = NULL; char *password = NULL; SET_ABORT_FUNCTION(abort_function); 140 QALoad On lin e Help DEFINE_TRANS_TYPE("sample_parameterization.cpp"); ofsSetRunOptions(FORMS_OAS, OFS_HTTP, 0, OFS_CHECKMSGS); SYNCHRONIZE(); BEGIN_TRANSACTION(); //------------------------------------------------// Request QALoad Conductor to send the next // datapool record to the script. //------------------------------------------------GET_DATA(); ofsHTTPSetHdrProperty("User-Agent", "Java1.3.1.22-internal" ); ofsHTTPSetHdrProperty("Host", "hostname.com" ); ofsHTTPSetHdrProperty("Accept", "text/html, image/gif, image/jpeg, *; q=.2, */*; " "q=.2" ); ofsHTTPSetHdrProperty("Connection", "Keep-alive" ); ofsHTTPConnectToFormsServlet("http://hostname.com/forms/frmservlet?acceptLanguage=" "en-us&ifcmd=startsession"); ofsHTTPSetListenerServletParms( "ifcmd=getinfo&ifhost=test32d11&ifip=" "10.10.10.10"); ofsHTTPConnectToListenerServlet("http://hostname.com/forms/lservlet" ); DO_SLEEP(1); ofsHTTPSetHdrProperty("Content-type", "application/octet-stream" ); ofsHTTPInitialFormsConnect(); DO_SLEEP(1); ofsSetInitialVersion("RUNFORM", 1, OFS_ADD, 268, "1012000"); ofsSetScreenResolution("RUNFORM", 1, OFS_ADD, 263, 96, 96); ofsSetDisplaySize("RUNFORM", 1, OFS_ADD, 264, 1600, 1200); ofsInitSessionCmdLine("RUNFORM", 1, OFS_ADD, 265, "server escapeParams=true module=test1.fmx userid= sso_userid=%20 sso_formsid=" "f" "ormsApp.hostname.com_E11FD4617E1A11CBAFA485E1AE302DEE sso" "_subDN= sso_usrDN= debug=no host= port= buffer_records=no debug_messages=no arr" "ay=no obr=no query_only=no quiet=yes render=no record= tracegroup= log= term=" ); ofsSetColorDepth("RUNFORM", 1, OFS_ADD, 266, "256"); ofsColorAdd("RUNFORM", 1, OFS_ADD, 284, "0"); ofsColorAdd("RUNFORM", 1, OFS_ADD, 284, "255"); ofsColorAdd("RUNFORM", 1, OFS_ADD, 284, "65535"); ofsColorAdd("RUNFORM", 1, OFS_ADD, 284, "4210752"); ofsColorAdd("RUNFORM", 1, OFS_ADD, 284, "8421504"); 141 Usin g th e Player, Script Developm en t W orkben ch , an d An alyze ofsColorAdd("RUNFORM", 1, OFS_ADD, 284, "65280"); ofsColorAdd("RUNFORM", 1, OFS_ADD, 284, "12632256"); ofsColorAdd("RUNFORM", 1, OFS_ADD, 284, "16711935"); ofsColorAdd("RUNFORM", 1, OFS_ADD, 284, "16762880"); ofsColorAdd("RUNFORM", 1, OFS_ADD, 284, "16756655"); ofsColorAdd("RUNFORM", 1, OFS_ADD, 284, "16711680"); ofsColorAdd("RUNFORM", 1, OFS_ADD, 284, "16777215"); ofsColorAdd("RUNFORM", 1, OFS_ADD, 284, "16776960"); ofsSetFontName("RUNFORM", 1, OFS_ADD, 383, "Dialog"); ofsSetFontSize("RUNFORM", 1, OFS_ADD, 377, "900"); ofsSetFontStyle("RUNFORM", 1, OFS_ADD, 378, "0"); ofsSetFontWeight("RUNFORM", 1, OFS_ADD, 379, "0"); ofsSetScaleInfo("RUNFORM", 1, OFS_ADD, 267, 8, 20); ofsSetNoRequiredVAList("RUNFORM", 1, OFS_ADD, 291); ofsInitSessionTimeZone("RUNFORM", 1, OFS_ENDMSG, 530, "America/New_York"); ofsSendRecv(1); //ClientSeqNo=1|MsgCount=1|1183734844.209 ofsWindowCreated(15, "WINDOW_START_APP"); ofsWindowCreated(20, "WINDOW_MAIN"); DO_SLEEP(2); ofsSetWindowLocation("FORMWINDOW", 6, OFS_ENDMSG, 135, 0, 0); ofsSetWindowSize("FORMWINDOW", 6, OFS_ENDMSG, 137, 750, 600); ofsSetWindowSize("FORMWINDOW", 6, OFS_ENDMSG, 137, 750, 600); ofsSendRecv(1); //ClientSeqNo=2|MsgCount=3|1183734846.053 ofsSetWindowSize("FORMWINDOW", 6, OFS_ENDMSG, 137, 750, 600); ofsSendRecv(1); //ClientSeqNo=3|MsgCount=1|1183734846.084 DO_SLEEP(9); //------------------------------------------------// Get values from the datapool. Column 1 contains // the username and column 2 the password. //------------------------------------------------username = VARDATA(1); password = VARDATA(2); RR__printf("username=\"%s\"", username); RR__printf("password=\"%s\"", password); //------------------------------------------------// Pass the username and password retrieved from // the datapool into the OFS script commands that 142 QALoad On lin e Help // specify the login credentials. //------------------------------------------------ofsSetLogonUserName("Logon", 42, OFS_ADD, 433, username); ofsSetLogonPassWord("Logon", 42, OFS_ADD, 434, password); // ofsSetLogonUserName("Logon", 42, OFS_ADD, 433, "scott"); // ofsSetLogonPassWord("Logon", 42, OFS_ADD, 434, "tiger"); ofsSetLogonDatabase("Logon", 42, OFS_ENDMSG, 435, "asi10g"); ofsSendRecv(1); //ClientSeqNo=4|MsgCount=1|1183734854.631 ofsActivateWindow("WINDOW_START_APP", 15, OFS_ENDMSG, 247); ofsFocus("BUTTON", 60, OFS_ENDMSG, 174); ofsSendRecv(1); //ClientSeqNo=5|MsgCount=2|1183734854.881 ofsSetWindowSize("FORMWINDOW", 6, OFS_ENDMSG, 137, 750, 600); ofsSendRecv(1); //ClientSeqNo=6|MsgCount=1|1183734854.912 ofsShowWindow("WINDOW_START_APP", 15, OFS_ENDMSG, 173); ofsSendRecv(1); //ClientSeqNo=7|MsgCount=1|1183734854.943 DO_SLEEP(2); ofsRemoveFocus("BUTTON", 60, OFS_ENDMSG, 174); ofsFocus("BUTTON", 61, OFS_ENDMSG, 174); ofsSendRecv(1); //ClientSeqNo=8|MsgCount=2|1183734856.834 ofsClickButton("BUTTON", 61, OFS_ENDMSG, 325); ofsSendRecv(1); //ClientSeqNo=9|MsgCount=1|1183734856.928 DO_SLEEP(1); ofsHTTPDisconnect(); RESTART_TRANSACTION_BOTTOM(); // do not modify this statement Clear Clear Clear Clear Clear Clear (ALL_COOKIES); (CACHE); (CONNECTION); (REFERER); (BASIC_AUTH_FLAG); (PROXY_AUTH_FLAG); END_TRANSACTION(); EXIT(); return(0); } void abort_function(PLAYER_INFO *s_info) { RR__printf("Virtual User ABORTED."); EXIT(); } ofsSetLogon PassW ord() 143 Usin g th e Player, Script Developm en t W orkben ch , an d An alyze SAP Overview of SAP Use QALoad's SAP m iddleware to load test system s th at run SAP 6.20, 6.40, and 7.10. W h at i s SAP? Th e SAP GUI fron t-en d is a m iddleware th at allows users to access SAP servers from W in dows. Th e SAP servers run various SAP busin ess application s, such as appli cation s for custom er relation sh ip m an agem en t, h um an resources, an d supply ch ain m an agem en t. Con n ect i n g t o t h e SAP Server On ce you h ave con n ected to a m ach in e th at is run n in g th e SAP server, you can log on an d in teract with th e SAP application s. Performance issues with SAP or Citrix scripts If you experien ce perform an ce issues with SAP or Citrix scripts, in crease your system pagin g file size to a fixed size of at least four tim es th e am oun t of RAM on th e m ach in e. Compiler Errors with SAP Scripts If you recei ve a type m ism atch error wh en com pilin g an SAP script, you m ust rem ove th e quotation m arks aroun d th e last param eter of th e affected com m an d. For exam ple: error C2664: '<FuncName>' : cannot convert parameter n from 'char [n]' to 'long' Th is com piler error, wh i ch can occur in com m an ds th at m an ipulate colum n width s, in dicates a data type error an d can be corrected by rem ovin g th e quotation m arks aroun d th e last param eter. Th e followin g exam ple sh ows th e lin es in a script th at could cause an error, an d th e corrected version of th e sam e lin es: Scri pt t h at prod uces t h e error: SAPGuiPropIdStr("wnd[0]/shellcont[1]/shell"); SAPGuiCmd2(GuiCtrlTree, SetColumnWidth, "REPNAME", "218"); Correct ed scri pt : SAPGuiPropIdStr("wnd[0]/shellcont[1]/shell"); SAPGuiCmd2(GuiCtrlTree, SetColumnWidth, "REPNAME", 218); Linking Errors During Validation or Compilation of SAP Scripts W h en you re-record SAP scripts, you m ust click Bui l d SAP Li brari es on th e SAP Con vert Option s dialog box. Th is button gen erates n ew libraries based on t h e version of SAP th at is curren tly in stalled. If you h ave upgraded to a n ewer versi on of SAP an d do n ot update th e libraries, you m ay experien ce vari ous lin kin g errors durin g validation or com pilation . SAP Script Validation Fails If your SAP script fails durin g validation it perform an y of th e followin g procedures to resol ve th e problem . Disable Autom atic Proxy Con figuration in In tern et Explorer 144 QALoad On lin e Help To d i sab l e aut om at i c p r ox y con f i g ur at i on : You m ay n eed to disable autom atic proxy con figuration in In tern et Explorer. 1. In Internet Explorer, click Tools>Internet Options. 2. On the Connections tab, click LAN Settings. 3. Ensure that the Use automatic configuration script check box is cleared. In crease th e Scri pt Execution Tim eout Value To i n cr ease t h e t i m eout val ue: If disablin g th e autom atic proxy con figuration does n ot solve th e problem , con sider in creasin g th e script execution tim eout value t o 100 secon ds or to th e len gth of th e capture file (i n secon ds), wh ich ever is greater. 1. With an SAP session open in the Script Development Workbench, click Options>Workbench. 2. On the Script Validation tab, type the new value in the Wait up to field. 3. Click OK. Do Not M in im ize th e SAP W in dow To m ax i m i ze t h e SAP w i n d ow : Durin g validation of SAP scripts, do n ot m in im ize th e SAP win dow. If th e win dow is m in im ized, th e validation m ay fail. Th is problem does n ot occur if you do th e followin g: 1. In Conductor, select the script icon to display the Script Properties panel on the right-hand side of the Visual Designer window. 2. In the Middleware Options area, click the arrow in the Hide Citrix/SAP GUI field, and select True. Configuring an SAP Client for Load Testing Before you can record an SAP session , you m ust h ave an SAP clien t th at is con figured to en able QALoad to access th e SAP server. Con figure th e SAP clien t th rough th e SAP Logon application . To con f i g ur e an SAP cl i en t f or l oad t est i n g : 1. Start the SAP Logon application. From the taskbar, click Start>Programs>SAP Front End>SAPlogon. 2. Click New... on the SAP Logon dialog box. The New Entry dialog box appears. 3. Type values in the Description, Application Server, and System number fields. 145 Usin g th e Player, Script Developm en t W orkben ch , an d An alyze Not e: QALoad uses the value in the Descript ion field to connect to the server. 4. Click OK. The new SAP server entry appears in the list in the SAP Logon dialog box. SAP Recording Options Save Server Descri pt i on : Select to specify an d save th e server description (n am e) to wh ich you wan t to con n ect durin g recordin g. If th is ch eck box is n ot selected, you are prom pted for a server description durin g th e log on process. Recording an SAP Session An SAP server con n ection m ust be con figured before you can con n ect with QALoad. See Con figurin g an SAP Clien t for Load Testing for m ore in form ation . Addition ally, your SAP adm in istrator m ust set th e SAPGUI/User_Scripting security profile param et er to TRUE to successfully record a scri pt. For m ore in form ation about SAP security settin gs, refer to th e SAP publication titled "Sapgui Scripting Security". To r ecor d an SAP sessi on : 146 1. If you have not already chosen SAP as the session type, click SAP Session to activate a new SAP session. 2. In the Script Development Workbench, click Record on the Session toolbar. 3. If you have not selected the Save Server Description Record option, the SAP Server Description dialog box appears. Type the name of the SAP server to which you want to connect. This value is the same as the Description field that displays in the SAP Logon configuration application. Press Enter. A logon dialog box appears. QALoad On lin e Help 4. Type a user ID in the User field and the password in the Password field. Press Enter. The SAP application starts. 5. In the SAP application, turn off the scripting and notification options. Click Customizing of local layout and choose Options. The Options dialog box appears. On the Scripting tab, select Enable Scripting and clear the two Notify check boxes. 6. Begin recording actions in SAP. SAP Convert Options Save Passw ord: Select to save th e en crypted password. If th is ch eck box is n ot selected, you are prom pt ed for a password durin g con version . VB Scri pt : Select to gen erate Visual Basic Scri pt for debuggin g outside QALoad. If th is option is n ot selected, you recei ve C++ scripts th at can be used for playback with in QALoad. I n sert SAP con t rol com m en t s: Select on e of th e followin g to in sert SAP con trol lists as com m en ts in your script. ! None: There is no control information shown as a comment in the script. ! Textfields and Statusbars: Control types GuiTextField or GuiStatusbar will be in the script as comments with information: type, name, and id string. ! All controls: All controls will be in the script as comments with information: type, name, and id string. Bui l d SAP Li brari es: Click Bui l d to gen erate th e QALoad SAP libraries based on your versi on of SAP. If you receive lin kin g errors wh ile validatin g or com pilin g, you sh ould click th is button . SAP Command Reference QALoad provides descri ption s an d exam ples of th e various com m an ds available for an SAP script. For details, refer to SAP Lan guage Referen ce Com m an ds. Viewing the SAP Control Log Assist your scriptin g by usin g th e SAP capture con trol log file to view th e in form ation th at was presen t at capture . Th e log file is in XM L form at. 147 Usin g th e Player, Script Developm en t W orkben ch , an d An alyze To op en t h e con t r ol l og : 1. In the Script Development Workbench Workspace, click the Captures tab or the Scripts tab, then right-click on an SAP script or capture file. OR Open an SAP script or capture file, th en righ t-click on th e open file. 2. From the right-click menu, choose View Control Log. Overview: Handling SAPGuiCheckScreen Errors Th e SAP screen return ed from th e SAP server durin g playback can differ from th e screen status of th e session durin g record. Th e SAPGuiCh eckScreen call return s a Boolean value th at in dicates wh eth er th e screen status is expected or un expected. By ch eckin g th e status return ed from th is call, you can build m ore exten sive error h an dlin g capability in to th e script. Create custom error h an dl in g code by pl acin g th e SAPGuiCh eckScreen call wi th in an If con dition al th at ch ecks th e return value, t h en writin g custom error h an dlin g code for th e fun ction s th at fail with in th at con dition al block. Th e sam ple scri pt sh ows th e code for creatin g error code blocks to use with ch eckin g th e status of a return ed SAP screen . Overview: Checking the Status Bar Th e SAP status bar displays error an d status m essages. W h en run n in g an SAP script, you can ch eck th e status bar to determ in e wh eth er th e script is execut in g properly. 148 QALoad On lin e Help Con cl usi on Use th e SAPGuiCh eckStatusbar com m an d to test for certain status respon ses in th e SAP en viron m en t an d take action s based on m essages return ed from th e SAP server. Th e sam ple scri pt illustrates th is procedure. Overview: Extracting a String from a SAP Control W h en run n in g an SAP script, you m ay wan t to get th e con trol’s text. For exam ple, in th e followin g screen , after Ch ild1 Col. 2 is selected, th e right table is filled in with data by th e SAP server. You can use th e in form ation as n eeded. 149 Usin g th e Player, Script Developm en t W orkben ch , an d An alyze Use th e SAPGuiGetCon trolText com m an d to extract data from a SAP server ret urn ed con trol. Th e sam ple script illustrates th is procedure. Overview: Extracting a Unique String from a SAP Control W h en run n in g an SAP script, you m ay wan t to get th e un ique strin g from th e con trol’s text between two strin gs. Use th e SAPGuiGetUn iqueStrin g com m an d to extract data from an SAP server return ed con trol th at occurs between th e left an d righ t in put strin gs. Th e sam ple script illustrates th is procedure. 150 QALoad On lin e Help Modifying the Script for Multiple Logons Load testin g requirem en ts for SAP m ay in clude allowin g for m ultiple logon s in a script session . W h en you in corporate m ultiple logon fun ction ality for an SAP script, you m ust add a code block to th e scri pt to see if th e m ultiple logon option is available, an d wh eth er th e user h as selected th e radio button th at allows con curren t con n ection s from th e sam e user. To m od i f y a scr i p t t o h an d l e m ul t i p l e l og on s: 1. Fin d th e followin g lin e of code in a script you just captured. Tip: This line of code should be near the top of the script after the logon commands. SAPGuiCheckScreen("S000","SAPMSYST","SAP"); 2. After th is lin e of code, add th e followin g code block. Th is sh ows wh eth er th e m ultiple logon option is available an d if th e user h as pressed th e Al l ow Con curren t Con n ect i on s f r om t h e Sam e User radio button on th e SAP logon screen . SAPGuiPropIdStrExists("wnd[1]/usr/radMULTI_LOGON_OPT2"); DO_SLEEP(20); SAPGuiCmd0(GuiRadioButton,Select); SAPGuiCmd0(GuiRadioButton,SetFocus); SAPGuiPropIdStr("wnd[1]/tbar[0]/btn[0]"); SAPGuiCmd0(GuiButton,Press); SAPGuiCheckScreen("S000","SAPMSYST","License Information for Multiple Logon"); SAPGuiPropIdStrExistsEnd("wnd[1]/usr/radMULTI_LOGON_OPT2"); SAPGuiPropIdStr("wnd[0]"); // sets focus back to wind[0] Th is code acts like an If con dition al th at is n ot in a con trol loop. It can be stat ed as follows: ! IF th e m ulti-logon screen appears, select radio butt on option 2. In th is code sn ippet, radio button 2 tells th e server to allow con curren t con n ection s from th e sam e user. ! THEN ch eck to m ake certai n th e script is syn ced to t h e "Licen se In form ation for M ultiple Logon ” section . ! ELSE do n oth in g an d con tin ue with th e script. Con cl usi on Th is tech n ique en ables support for m ultiple SAP logon session s in a script. It asks SAP wh eth er th e m ultilogon radio button is selected an d, if it is, sim ulates selectin g th e button durin g replay. Th is allows you to run th e sam e script with m an y virtual users un der a sin gle SAP logon ID. Th e sam ple origin al script an d sam ple m odified scri pt illustrate th is process. Overview: Implementing Content Check of a SAP Control W h en run n in g an SAP script, you m ay wan t to ch eck con ten t of a con trol’s text propert y. 151 Usin g th e Player, Script Developm en t W orkben ch , an d An alyze Con cl usi on Use th e SAPGuiCon ten tCh eck com m an d to com pares data from an SAP server return ed con trol with in put strin g based on th e com parison option s. Th e sam ple script illustrates th is procedure. Overview: Transaction Restart Commands If your load testin g requirem en ts in clude supportin g tran saction restarts, revi ew th e followin g com m an ds an d en sure th at th ose required to support tran saction restart are presen t. Not e: These are automatically added during the script conversion process. Scri pt i n g Required com m an ds an d associated code statem en t s for th e SAP script are: ! SAPGuiApplication(RegisterROT) - This command sets or resets the SAP runtime object library (ROT). Executing this command ensures the SAP environment is in an initial state at the beginning of the script. ! SAPGuiApplication(RevokeROT) - This command clears the SAP runtime object library (ROT). Executing this command ensures the memory SAP environment is de-allocated. ! SAPGui_error_handler(s_info, buffer) - When scripting an error code block, be sure to use the SAPGui_error_handler command instead of the RR__FailedMsg command if the Transaction Restart option is used. Not e: These functions are required, but additional SAP script commands are also essential to run an SAP script. Con cl usi on If un expected playback errors occur wh en playin g back an edited script with Tran saction Restart en abl ed, perform a review of th e com m an ds to en sure th at th ose required to support tran saction restart are presen t. Th e sam ple scri pt sh ows th e com m an ds used in th e script. Overview: Required SAP Script Commands Certain com m an ds m ust be presen t in an SAP script. Th ese com m an ds are created aut om atically durin g th e con version process. M ost of th e com m an ds are before th e BEGIN_TRANSACTION statem en t. Review th is section if you are h avin g un expected issues after script editin g. 152 QALoad On lin e Help Not e: If the SAP script supports transaction restarting, review Required Commands for Supporting Transaction Restart in SAP. Requi red Scri pt Com m an ds Required com m an ds an d associated code statem en t s for th e SAP script are: SET_ABORT_FUNCTION(abort fun ction ); DEFINE_TRANS_TYPE("capture.cpp"); HRESULT h r = CoIn itialize(0); if( h r != ERROR_SUCCESS ) RR__FailedM sg(s_in fo, "ERROR in itializin g COM "); SAPGuiSetCh eckScreen W ildcard(‘*’); SYNCHRONIZE(); Not e: These functions are required, but additional SAP API script commands are also essential to run an SAP script. Con cl usi on W h en en coun terin g un expected com piler errors aft er script editin g, review th e script to en sure all requi red com m an ds are presen t. Th is m igh t reveal a problem created by th e script edits, especially wh en m ovi n g th e tran saction loop. You m ust take care wh en doin g exten sive script editin g n ot to acciden tally rem ove critical com m an ds. Recordin g th e tran saction again an d doin g a win diff com parison can also h elp wh en un expected com piler errors occur. Th e sam ple scri pt sh ows th e statem en ts used in th e script. Modifying the Script to Retrieve SAP Counter Data SAP scripts can retrieve custom er coun ter in form ati on for each virtual user. By in sertin g code sn ippets th at use th e SAPGui scriptin g API in to th e SAP script, you can obtain an d save SAP server in form ation . To m od i f y t h e scr i p t t o r et r i eve SAP coun t er d at a: 1. Declare and initialize the counter identification (ID) variables using the int data type. You should declare a variable for each counter value to be extracted. The DEFINE_COUNTER macro initializes the declared counter identifier variable and creates a holder for the value in the timing file. 2. Declare and initialize the variable to hold the actual SAP counter value. You should declare the variable using a datatype that can hold any expected value for the counter. Usually a long is appropriate. 3. Retrieve the counter information from the SAP server using the SAPGuiSessionInfo command. The value is placed in the variable you created in Step 2. The first parameter is the SAP property object corresponding to the counter. The second parameter is the variable to hold the value. 4. Save the counter value to the timing file. The COUNTER_VALUE macro command extracts the value from the server. The value is extracted to the variable created in Step 2. It is stored in the timing file using the associated ID created in Step 1. Con cl usi on Followin g th ese tech n iques, you can obt ain custom er coun ter in form ation from th e SAP server, save it to th e virtual user’s tim in g file, an d view it in An alyze. Th e sam ple origin al script an d sam ple m odified script illustrate th is m odification . 153 Usin g th e Player, Script Developm en t W orkben ch , an d An alyze Adding Custom Counters to Retrieve Server Information Th e followin g exam ple adds custom coun ters to obt ain an d save th e SAP Server in form ation th at is available th rough th e SAP Gui Scriptin g API. Notice th at SAPGuiSession In fo is called before loggin g off , because th e data is n ot available after loggin g off. int id1, id2, id3, id4; long lRoundTrips,lFlushes; // "Counter Group", "Counter Name", "Counter Units // (Optional)", Data Type, Counter Type. id1 = DEFINE_COUNTER("Cumulative Group", "Cumulative RoundTrips", 0, DATA_LONG, COUNTER_CUMULATIVE); id2 = DEFINE_COUNTER("Cumulative Group", "Cumulative Flushes", 0, DATA_LONG, COUNTER_CUMULATIVE); id3 = DEFINE_COUNTER("Instance Group", "Instance RoundTrips", 0, DATA_LONG, COUNTER_INSTANCE); id4 = DEFINE_COUNTER("Instance Group", "Instance Flushes", 0, DATA_LONG, COUNTER_INSTANCE); SYNCHRONIZE(); BEGIN_TRANSACTION(); try{ SAPGuiConnect( s_info,"qacsapdb2"); ... SAPGuiSessionInfo(GetRoundTrips,lRoundTrips); SAPGuiSessionInfo(GetFlushes,lFlushes); SAPGuiPropIdStr("wnd[1]/usr/btnSPOP-OPTION1"); SAPGuiCmd0(GuiButton,Press); SAPGuiCheckScreen( "SESSION_MANAGER", "SAPLSPO1", "Log Off" ); COUNTER_VALUE( COUNTER_VALUE( COUNTER_VALUE( COUNTER_VALUE( id1,lRoundTrips); id2,lFlushes); id3,lRoundTrips); id4,lFlushes); } // end try catch (_com_error e){ char buffer[1024]; sprintf(buffer,"SAP: EXCEPTION 0x%x %s for VU(%i)\n",e.Error(), (char *)e.Description(), S_task_id); RR__FailedMsg(s_info,buffer); } // end catch END_TRANSACTION(); Error Handling and Reporting A try/ cat ch block is autom atically gen erated for th e com m an ds between th e BEGIN_TRANSACTION an d END_TRANSACTION stat em en ts. Th is con struct provides error h an dlin g an d reportin g from th e script. BEGIN_TRANSACTION(); try{ SAPGuiConnect( s_info,"qacsapdb2"); SAPGuiVerCheckStr("6204.119.32"); //Set SapApplication = CreateObject("Sapgui.ScripingCtrl.1") //SapApplication.OpenConnection ("qacsapdb") //Set Session = SapApplication.Children(0).Children(0) DO_SLEEP(3); 154 QALoad On lin e Help SAPGuiPropIdStr("wnd[0]"); SAPGuiCmd3(GuiMainWindow, ResizeWorkingPane, 83, 24, false); DO_SLEEP(6); SAPGuiPropIdStr("wnd[0]/usr/txtRSYST-BNAME"); SAPGuiCmd1(GuiTextField,PutText,"qaload1"); SAPGuiPropIdStr("wnd[0]/usr/pwdRSYST-BCODE"); SAPGuiCmd1Pwd(GuiPasswordField, PutText,"~encr~1211616261"); SAPGuiCmd0(GuiPasswordField,SetFocus); SAPGuiCmd1(GuiPasswordField,PutCaretPosition,3); SAPGuiPropIdStr("wnd[0]"); SAPGuiCmd1(GuiMainWindow,SendVKey,0); SAPGuiCheckScreen("S000","SAPMSYST","SAP"); ... DO_SLEEP(10); SAPGuiPropIdStr("wnd[0]/usr/cntlIMAGE_CONTAINER/shellcont/shell/shellcont[0]/shell"); SAPGuiCmd1(GuiCtrlTree, ExpandNode, "0000000003"); SAPGuiCmd1(GuiCtrlTree, PutSelectedNode, "0000000004"); SAPGuiCmd1(GuiCtrlTree, PutTopNode, "Favo"); SAPGuiCmd1(GuiCtrlTree, DoubleClickNode, "0000000004"); SAPGuiCheckScreen("SESSION_MANAGER", "SAPLSMTR_NAVIGATION", "SAP Easy Access"); SAPGuiPropIdStr("wnd[1]/usr/btnSPOP-OPTION1"); SAPGuiCmd0(GuiButton,Press); SAPGuiCheckScreen("SESSION_MANAGER","SAPLSPO1","Log Off"); } // end try catch (_com_error e){ char buffer[1024]; sprintf (buffer," EXCEPTION 0x%x %s for VU(%i)\n",e.Error(), (char *)e.Description(), S_task_id); RR__FailedMsg(s_info,buffer); } // end catch END_TRANSACTION(); To in clude th e log on with in th e tran saction loop, m ove th e SAPGuiCon n ect call in side th e try block as sh own in th e followin g exam ple: SET_ABORT_FUNCTION(abort_function); DEFINE_TRANS_TYPE("capture.cpp"); RESULT hr = CoInitialize(0); if( hr != ERROR_SUCCESS ) RR__FailedMsg(s_info,"ERROR initializing COM"); SAPGuiSetCheckScreenWildcard('*'); SYNCHRONIZE(); BEGIN_TRANSACTION(); try{ SAPGuiConnect( s_info,"qacsapdb2"); SAPGuiVerCheckStr("6204.119.32"); ... SAPGuiPropIdStr("wnd[1]/usr/btnSPOP-OPTION1"); SAPGuiCmd0(GuiButton,Press); SAPGuiCheckScreen("SESSION_MANAGER","SAPLSPO1","Log Off"); } // end try catch (_com_error e){ 155 Usin g th e Player, Script Developm en t W orkben ch , an d An alyze char buffer[1024]; sprintf(buffer," EXCEPTION 0x%x %s for VU(%i)\n",e.Error(), (char *)e.Description(), S_task_id); RR__FailedMsg(s_info,buffer); } // end catch END_TRANSACTION(); To in clude th e log on outside th e tran saction loop, m ove th e log off section so th at it follows th e END_TRANSACTION stat em en t. However, en sure t h at th e recordin g with in th e tran saction loop begin s an d en ds in th e sam e location in th e m en u system . For exam ple: SET_ABORT_FUNCTION(abort_function); DEFINE_TRANS_TYPE("capture.cpp"); HRESULT hr = CoInitialize(0); if( hr != ERROR_SUCCESS ) RR__FailedMsg(s_info,"ERROR initializing COM"); SAPGuiSetCheckScreenWildcard('*'); SYNCHRONIZE(); SAPGuiConnect( s_info,"qacsapdb2"); SAPGuiPropIdStr("wnd[0]/usr/txtRSYST-BNAME"); SAPGuiCmd1(GuiTextField,PutText,"qaload1"); SAPGuiPropIdStr("wnd[0]/usr/pwdRSYST-BCODE"); SAPGuiCmd1Pwd(GuiPasswordField,PutText,"~encr~1211616261"); SAPGuiCmd0(GuiPasswordField,SetFocus); SAPGuiCmd1(GuiPasswordField,PutCaretPosition,3); SAPGuiPropIdStr("wnd[0]"); SAPGuiCmd1(GuiMainWindow,SendVKey,0); SAPGuiCheckScreen("S000","SAPMSYST","SAP"); BEGIN_TRANSACTION(); try{ SAPGuiVerCheckStr("6204.119.32"); ... } // end try catch (_com_error e){ char buffer[1024]; sprintf(buffer," EXCEPTION 0x%x %s for VU(%i)\n",e.Error(), (char *)e.Description(), S_task_id); RR__FailedMsg(s_info,buffer); } // end catch END_TRANSACTION(); SAPGuiPropIdStr("wnd[1]/usr/btnSPOP-OPTION1"); SAPGuiCmd0(GuiButton,Press); SAPGuiCheckScreen("SESSION_MANAGER","SAPLSPO1","Log Off"); Object Life Span W h en ever a script is run , all objects on th e SAP GUI win dow are deleted an d re-created. Th ese objects, wh ich are created in th e SAP en viron m en t an d can disappear with out user in teraction , can cause script failure if th e script referen ces th e objects after th ey h ave disappeared. 156 QALoad On lin e Help For m ore troublesh ootin g in form ation , refer to SAP’s publication titled “ SAP GUI Scripting API for the W indows and Java Platforms” . SAP Script Samples Sam pl e: SAP Scri pt w i t h SAPGui Ch eck Screen Er r or H an dl er Th e followin g sh ows an SAP script sn ippet with SAPGuiCh eckScreen Error Han dler. Poin ts of in terest in th e script are h igh ligh ted in bold. Sam ple Script Sn ippet …beginning of script… SAPGuiPropIdStr("wnd[0]/usr/subSA_0100_1:SAPLEXAMPLE_ENTRY_SCREEN:0200/subSA_200_1:SAPLEXAMP LE_ENTRY_SCREEN:0800/cntlCC_HTML_INDEX/shellcont/shell"); SAPGuiCmd3(GuiCtrlHTMLViewer, SapEvent, "","","sapevent:FLD_SHORT?FLD" ); /// In this small example, if any of the following are FALSE /// OKCode == “BIBS” /// screen name == “SAPLEXAMPLE_ENTRY_SCREEN” /// title == "Style Guide: Dropdown list" /// …then the block of error code is processed! BOOL bRetSts = SAPGuiCheckScreen ( "BIBS", "SAPLEXAMPLE_ENTRY_SCREEN", "Style Guide: Dropdown list" ); if (bRetSts != TRUE) { RR__printf("Style Guide: Dropdown list not found"); SAPGui_error_handler(s_info, "Error: Style Guide: Dropdown list"); } DO_SLEEP(9); SAPGuiCmd3(GuiCtrlHTMLViewer, SapEvent, "","","sapevent:PUB_SHORT?PUB" ); …end of script… Sam pl e Scri pt : Ch eck i n g t h e SAP St at us Bar Th e SAPGuiCh eckStatusbar com m an d is used in th e followin g script exam pl e to test for certain status respon ses. Th e code added to ch eck th e status bar i s sh own in bold. Sam ple Script ... SAPGuiPropIdStr("wnd[0]");//1109615021.466 SAPGuiCmd1(GuiMainWindow,SendVKey,4); SAPGuiCheckScreen("PA40","SAPMP50A","Personnel Actions"); //1109615021.481 DO_SLEEP(15); SAPGuiPropIdStr("" "wnd[1]/usr/tabsG_SELONETABSTRIP/tabpTAB001/ssubSUBSCR_PRESEL:SAPLSDH4:0220/sub:" "SAPLSDH4:0220/txtG_SELFLD_TAB-LOW[0,24]" ); //1109615036.231 SAPGuiCmd1(GuiTextField,PutText,"pan"); SAPGuiCmd1(GuiTextField,PutCaretPosition,3); 157 Usin g th e Player, Script Developm en t W orkben ch , an d An alyze SAPGuiPropIdStr("wnd[1]/tbar[0]/btn[0]");//1109615036.246 SAPGuiCmd0(GuiButton,Press); SAPGuiCheckScreen("PA40","SAPLSDH4","Restrict Value Range"); //1109615036.246 // Check to determine if the name we chose is found in db // If not stop the script should not continue BOOL bRetSts = SAPGuiCheckStatusbar("wnd[0]/sbar", "No values for this selection"); if (bRetSts) { RR__printf(" No such last name in Database"); SAPGui_error_handler(s_info," End Now No such name in Database"); } ... Sam pl e: Ex t r act i n g a St ri n g f rom a SAP Con t rol Th e followin g sam ple scri pt sh ows th e SAP com m an ds required to extract a data strin g from a return ed con trol in an SAP en viron m en t. You can use SAPGuiGetCon trolText to get the con ten t of th e Even t n am e textfield. Use con vert option I ns er t SAP c ont r ol c omment s : al l c ont r ol s to output all con trol s as com m en t. Sam ple Script SAPGuiPropIdStr("wnd[0]/usr/cntlTREE_CONTAINER/shellcont/shell" );//1152817068.134 SAPGuiCmd2(GuiCtrlTree,SelectItem,"Child1","Column2"); SAPGuiCmd2(GuiCtrlTree,EnsureVisibleHorizontalItem,"Child1","Column2"); SAPGuiCmd2(GuiCtrlTree,PressButton,"Child1","Column2"); SAPGuiCheckScreen("DWDM","SAPCOLUMN_TREE_CONTROL_DEMO","SAP");//1152817068.321 // // // // // *SAP* *SAP* *SAP* *SAP* *SAP* GuiMenubar name="mbar" Id="wnd[0]/mbar" GuiMenu name="System" Id="wnd[0]/mbar/menu[0]" GuiMenu name="Create Session" Id="wnd[0]/mbar/menu[0]/menu[0]" GuiMenu name="End Session" Id="wnd[0]/mbar/menu[0]/menu[1]" GuiMenu name="User Profile" Id="wnd[0]/mbar/menu[0]/menu[2]" ….. // *SAP* GuiLabel name="%#AUTOTEXT004" Id="wnd[0]/usr/lbl%#AUTOTEXT004" // *SAP* GuiTextField name="G_EVENT" Id="wnd[0]/usr/txtG_EVENT" // *SAP* GuiLabel name="%#AUTOTEXT002" Id="wnd[0]/usr/lbl%#AUTOTEXT002" // *SAP* GuiTextField name="G_NODE_KEY" Id="wnd[0]/usr/txtG_NODE_KEY" // *SAP* GuiLabel name="%#AUTOTEXT005" Id="wnd[0]/usr/lbl%#AUTOTEXT005" // *SAP* GuiTextField name="G_ITEM_NAME" Id="wnd[0]/usr/txtG_ITEM_NAME" // *SAP* GuiLabel name="%#AUTOTEXT006" Id="wnd[0]/usr/lbl%#AUTOTEXT006" // *SAP* GuiTextField name="G_HEADER_NAME" Id="wnd[0]/usr/txtG_HEADER_NAME" // *SAP* GuiStatusbar name="sbar" Id="wnd[0]/sbar" // *SAP* GuiStatusPane name="pane[0]" Id="wnd[0]/sbar/pane[0]" // *SAP* GuiStatusPane name="pane[1]" Id="wnd[0]/sbar/pane[1]" // *SAP* GuiStatusPane name="pane[2]" Id="wnd[0]/sbar/pane[2]" // *SAP* GuiStatusPane name="pane[3]" Id="wnd[0]/sbar/pane[3]" // *SAP* GuiStatusPane name="pane[4]" Id="wnd[0]/sbar/pane[4]" // *SAP* GuiStatusPane name="pane[5]" Id="wnd[0]/sbar/pane[5]" // Check the event name char * strEvent = SAPGuiGetControlText("wnd[0]/usr/txtG_EVENT", "GuiTextField"); RR__printf(" The Event Name: %s", strEvent); free(strEvent); Sam pl e: Ex t r act i n g a Un i que St ri n g f rom a SAP Con t rol 158 QALoad On lin e Help Th e followin g sam ple scri pt sh ows th e SAP com m an ds required t o extract a data strin g from a return ed con trol in an SAP en viron m en t. You can use SAPGuiGetUn iqueStrin g to get th e un ique strin g of th e Even t n am e text field between ITEM an d CLICK. Use con vert option Insert SAP control comments: Textfields and Statusbars to output textfield an d statusbar as com m en ts in th e script. Sam ple Script SAPGuiPropIdStr("wnd[0]/usr/cntlTREE_CONTAINER/shellcont/shell" );//1152820409.712 SAPGuiCmd1(GuiCtrlTree,ExpandNode,"Root"); SAPGuiCmd1(GuiCtrlTree,ExpandNode,"Child1"); SAPGuiCmd2(GuiCtrlTree,SelectItem,"New1","4"); SAPGuiCmd2(GuiCtrlTree,EnsureVisibleHorizontalItem,"New1","4"); SAPGuiCmd1(GuiCtrlTree,PutTopNode,"Root"); SAPGuiCmd2(GuiCtrlTree,DoubleClickItem,"New1","4"); SAPGuiCheckScreen("DWDM","SAPTLIST_TREE_CONTROL_DEMO","SAP");//1152820409.915 // // // // *SAP* *SAP* *SAP* *SAP* GuiTextField GuiTextField GuiTextField GuiStatusbar name="G_EVENT" Id="wnd[0]/usr/txtG_EVENT" name="G_NODE_KEY" Id="wnd[0]/usr/txtG_NODE_KEY" name="G_ITEM_NAME" Id="wnd[0]/usr/txtG_ITEM_NAME" name="sbar" Id="wnd[0]/sbar" DO_SLEEP(5); // Check the unique string char* strUniqueString = SAPGuiGetUniqueString("wnd[0]/usr/txtG_EVENT", "GuiTextField", "ITEM", "CLICK"); RR__printf(" the unique string between ITEM and CLICK is: %s", strUniqueString); free(strUniqueString); Sam pl e: Ori gi n al SAP Scri pt f or M ul t i pl e Logon s Th e followin g sam ple sh ows an origin al script con verted from capture. Poin ts of in terest in th e script are h igh lighted in bold. Sam ple Script /* * * * * * * * */ multilogon.cpp Script Converted on July 20, 2004 at 08:43:23 AM Generated by Compuware QALoad convert module version 5.2.0 build 73 This script contains support for the following middlewares: - SAP /* Converted using the following options: * General: * Line Split : 132 characters * Sleep Seconds : 1 * Constants to Variables : Yes * Remove Quotes : No * Tabs To Spaces : No * Auto Checkpoints : No * SAP * Version : 6204.119.32 */ 159 Usin g th e Player, Script Developm en t W orkben ch , an d An alyze #define SCRIPT_VER 0x00000205UL #include #include #include #include #include #include #include #include #include #include #include <stdio.h> <windows.h> <atlbase.h> <objbase.h> "do_SAPCCOM.h" <atlwin.h> <atlcom.h> <atlhost.h> "cscript.h" "do_SapGui.h" "mwCommon.h" extern "C" { #include "smacro.h" } /* set function to call on abort*/ void abort_function(PLAYER_INFO *s_info); #ifndef NULL #define NULL #endif 0 extern "C" int rhobot_script(PLAYER_INFO *s_info) { /* Declare Variables */ SET_ABORT_FUNCTION(abort_function); DEFINE_TRANS_TYPE("capture.cpp"); HRESULT hr = CoInitialize(0); if( hr != ERROR_SUCCESS ) RR__FailedMsg(s_info,"SAP: ERROR initializing COM"); SAPGuiSetCheckScreenWildcard('*'); SYNCHRONIZE(); BEGIN_TRANSACTION(); DO_SetTransactionStart(); try{ SAPGuiConnect( s_info,"testsap620"); SAPGuiApplication(RegisterROT); SAPGuiVerCheckStr("6204.119.32"); //Set SapApplication = CreateObject("Sapgui.ScriptingCtrl.1") //SapApplication.OpenConnection ("testsap620") //Set Session = SapApplication.Children(0).Children(0) DO_SLEEP(18); SAPGuiPropIdStr("wnd[0]");//1057828784.513 SAPGuiCmd3(GuiMainWindow,ResizeWorkingPane,92,34,false); DO_SLEEP(16); SAPGuiPropIdStr("wnd[0]/usr/txtRSYST-BNAME");//1057828800.786 SAPGuiCmd1(GuiTextField,PutText,"qaload1"); 160 QALoad On lin e Help SAPGuiPropIdStr("wnd[0]/usr/pwdRSYST-BCODE");//1057828800.796 SAPGuiCmd1Pwd(GuiPasswordField,PutText,"~encr~0000x_'9d"); SAPGuiCmd0(GuiPasswordField,SetFocus); SAPGuiCmd1(GuiPasswordField,PutCaretPosition,3); SAPGuiPropIdStr("wnd[0]");//1057828800.836 SAPGuiCmd1(GuiMainWindow,SendVKey,0); SAPGuiCheckScreen("S000","SAPMSYST","SAP");//1057828800.856 DO_SLEEP(6); SAPGuiCmd3(GuiMainWindow,ResizeWorkingPane,92,34,false); DO_SLEEP(3); SAPGuiPropIdStr("wnd[0]/tbar[0]/btn[15]");//1057828809.839 SAPGuiCmd0(GuiButton,Press); /// This is the command to look for. The parameters indicate that this /// SAP Easy Access session screen. SAPGuiCheckScreen("SESSION_MANAGER","SAPLSMTR_NAVIGATION","SAP Easy Access");//1057828809.859 DO_SLEEP(2); SAPGuiPropIdStr("wnd[1]/usr/btnSPOP-OPTION1");//1057828811.382 SAPGuiCmd0(GuiButton,Press); SAPGuiCheckScreen("SESSION_MANAGER","SAPLSPO1","Log Off");//1057828811.402 } // end try catch (_com_error e){ char buffer[1024]; sprintf(buffer,"SAP: EXCEPTION 0x%x %s for VU(%i)\n",e.Error(), (char *)e.Description(), S_task_id); SAPGui_error_handler(s_info,buffer); } // end catch DO_SetTransactionCleanup(); SAPGuiApplication(RevokeROT); END_TRANSACTION(); REPORT(SUCCESS); EXIT(); return(0); } void abort_function(PLAYER_INFO *s_info) { RR__printf("Virtual User ABORTED."); EXIT(); } Sam pl e: M odi f i ed SAP Scri pt f or M ul t i pl e Logon s Th e followin g sam ple sh ows a SAP script m odified t o h an dle m ultiple logon session s. Added code sn ippet an d related com m en ts are h igh ligh ted in bold. Sam ple Script /* * * * multilogon.cpp Script Converted on July 20, 2004 at 08:43:23 AM 161 Usin g th e Player, Script Developm en t W orkben ch , an d An alyze * Generated by Compuware QALoad convert module version 5.2.0 build 73 * * This script contains support for the following middlewares: * - SAP */ /* Converted using the following options: * General: * Line Split : 132 characters * Sleep Seconds : 1 * Constants to Variables : Yes * Remove Quotes : No * Tabs To Spaces : No * Auto Checkpoints : No * SAP * Version : 6204.119.32 */ #define SCRIPT_VER 0x00000205UL #include #include #include #include #include #include #include #include #include #include #include <stdio.h> <windows.h> <atlbase.h> <objbase.h> "do_SAPCCOM.h" <atlwin.h> <atlcom.h> <atlhost.h> "cscript.h" "do_SapGui.h" "mwCommon.h" extern "C" { #include "smacro.h" } /* set function to call on abort*/ void abort_function(PLAYER_INFO *s_info); #ifndef NULL #define NULL #endif 0 extern "C" int rhobot_script(PLAYER_INFO *s_info) { /* Declare Variables */ SET_ABORT_FUNCTION(abort_function); DEFINE_TRANS_TYPE("multilogon.cpp"); HRESULT hr = CoInitialize(0); if( hr != ERROR_SUCCESS ) RR__FailedMsg(s_info,"SAP: ERROR initializing COM"); SAPGuiSetCheckScreenWildcard('*'); SYNCHRONIZE(); BEGIN_TRANSACTION(); DO_SetTransactionStart(); try{ SAPGuiConnect( s_info,"testsap620"); 162 QALoad On lin e Help SAPGuiApplication(RegisterROT); SAPGuiVerCheckStr("6204.119.32"); //Set SapApplication = CreateObject("Sapgui.ScriptingCtrl.1") //SapApplication.OpenConnection ("testsap620") //Set Session = SapApplication.Children(0).Children(0) DO_SLEEP(18); SAPGuiPropIdStr("wnd[0]");//1057828784.513 SAPGuiCmd3(GuiMainWindow,ResizeWorkingPane,92,34,false); DO_SLEEP(16); SAPGuiPropIdStr("wnd[0]/usr/txtRSYST-BNAME");//1057828800.786 SAPGuiCmd1(GuiTextField,PutText,"qaload1"); SAPGuiPropIdStr("wnd[0]/usr/pwdRSYST-BCODE");//1057828800.796 SAPGuiCmd1Pwd(GuiPasswordField,PutText,"~encr~0000x_'9d"); SAPGuiCmd0(GuiPasswordField,SetFocus); SAPGuiCmd1(GuiPasswordField,PutCaretPosition,3); SAPGuiPropIdStr("wnd[0]");//1057828800.836 SAPGuiCmd1(GuiMainWindow,SendVKey,0); /// Scripting: Step 1 /// Here is the command to look for in the script. Note the parameters /// of the call, they are consistent in every SAP script. SAPGuiCheckScreen("S000","SAPMSYST","SAP");//1057828800.856 /// Scripting: Step 2 /// Add this code snippet in bold after the SAPGuiCheckScreen which /// confirms the login screen is present. SAPGuiPropIdStrExists("wnd[1]/usr/radMULTI_LOGON_OPT2"); DO_SLEEP(20); SAPGuiCmd0(GuiRadioButton,Select); SAPGuiCmd0(GuiRadioButton,SetFocus); SAPGuiPropIdStr("wnd[1]/tbar[0]/btn[0]"); SAPGuiCmd0(GuiButton,Press); SAPGuiCheckScreen("S000","SAPMSYST","License Information for Multiple Logon"); SAPGuiPropIdStrExistsEnd("wnd[1]/usr/radMULTI_LOGON_OPT2"); SAPGuiPropIdStr("wnd[0]"); // sets focus back to wind[0] DO_SLEEP(6); SAPGuiCmd3(GuiMainWindow,ResizeWorkingPane,92,34,false); DO_SLEEP(3); SAPGuiPropIdStr("wnd[0]/tbar[0]/btn[15]");//1057828809.839 SAPGuiCmd0(GuiButton,Press); SAPGuiCheckScreen("SESSION_MANAGER","SAPLSMTR_NAVIGATION","SAP Easy Access");//1057828809.859 DO_SLEEP(2); SAPGuiPropIdStr("wnd[1]/usr/btnSPOP-OPTION1");//1057828811.382 SAPGuiCmd0(GuiButton,Press); SAPGuiCheckScreen("SESSION_MANAGER","SAPLSPO1","Log Off");//1057828811.402 163 Usin g th e Player, Script Developm en t W orkben ch , an d An alyze } // end try catch (_com_error e){ char buffer[1024]; sprintf(buffer,"SAP: EXCEPTION 0x%x %s for VU(%i)\n",e.Error(), (char *)e.Description(), S_task_id); SAPGui_error_handler(s_info,buffer); } // end catch DO_SetTransactionCleanup(); SAPGuiApplication(RevokeROT); END_TRANSACTION(); REPORT(SUCCESS); EXIT(); return(0); } void abort_function(PLAYER_INFO *s_info) { RR__printf("Virtual User ABORTED."); EXIT(); } Sam pl e: I m pl em en t i n g Con t en t Ch eck of a SAP Con t rol Th e followin g sam ple scri pt sh ows th e SAP com m an ds n eeded to validate th e in form ation in th e SAP clien t durin g replay. You can use SAPGuiCon ten tCh eck to ch eck if th e text field for Even t n am e con tain s th e strin g double. Th e SAPGuiCon ten tCh eck com m an d h as th e option to ch eck th e en tire strin g, prefix strin g, substrin g an d suffix string. It also h as the option to use a case-sen sitive com parison or case-insen sitive com parison . Th e followin g exam ple uses th e case in sen sitive com parison an d substrin g ch eck option . Use con vert option Insert SAP control comments: Textfields and Statusbars to output textfield an d statusbar as com m en ts in th e script. Sam ple Script SAPGuiPropIdStr("wnd[0]/usr/cntlTREE_CONTAINER/shellcont/shell" );//1152820409.712 SAPGuiCmd1(GuiCtrlTree,ExpandNode,"Root"); SAPGuiCmd1(GuiCtrlTree,ExpandNode,"Child1"); SAPGuiCmd2(GuiCtrlTree,SelectItem,"New1","4"); SAPGuiCmd2(GuiCtrlTree,EnsureVisibleHorizontalItem,"New1","4"); SAPGuiCmd1(GuiCtrlTree,PutTopNode,"Root"); SAPGuiCmd2(GuiCtrlTree,DoubleClickItem,"New1","4"); SAPGuiCheckScreen("DWDM","SAPTLIST_TREE_CONTROL_DEMO","SAP");//1152820409.915 int nResult = SAPGuiContentCheck("wnd[0]/usr/txtG_EVENT", "GuiTextField", "double", false, SUBSTRING); RR__printf("Does the textfield content contains string \"double\"? -- %s", nResult==0?"YES":"NO"); Sam pl e: SAP Scri pt w i t h Com m an ds Th e followin g sam ple is a SAP Script with required com m an ds. Required com m an ds in th e script are h igh lighted in bold. 164 QALoad On lin e Help Sam ple Script /* * * * * * * * */ capture.cpp Script Converted on July 20, 2004 at 08:43:23 AM Generated by Compuware QALoad convert module version 5.2.0 build 73 This script contains support for the following middlewares: - SAP /* Converted using the following options: * General: * Line Split : 132 characters * Sleep Seconds : 1 * Constants to Variables : Yes * Remove Quotes : No * Tabs To Spaces : No * Auto Checkpoints : No * SAP * Version : 6204.119.32 */ #define SCRIPT_VER 0x00000205UL #include #include #include #include #include #include #include #include #include #include #include <stdio.h> <windows.h> <atlbase.h> <objbase.h> "do_SAPCCOM.h" <atlwin.h> <atlcom.h> <atlhost.h> "cscript.h" "do_SapGui.h" "mwCommon.h" extern "C" { #include "smacro.h" } /* set function to call on abort*/ void abort_function(PLAYER_INFO *s_info); #ifndef NULL #define NULL #endif 0 extern "C" int rhobot_script(PLAYER_INFO *s_info) { /* Declare Variables */ /// These script functions in bold must be present and /// before the SYNCHRONIZE command in every SAP script. ACTION(); SET_ABORT_FUNCTION(abort_function); DEFINE_TRANS_TYPE("capture.cpp"); HRESULT hr = CoInitialize(0); if( hr != ERROR_SUCCESS ) RR__FailedMsg(s_info,"SAP: ERROR initializing COM"); 165 Usin g th e Player, Script Developm en t W orkben ch , an d An alyze SAPGuiSetCheckScreenWildcard('*'); SYNCHRONIZE(); BEGIN_TRANSDO_SetTransactionStart(); try{ SAPGuiConnect( s_info,"testsap620"); SAPGuiApplication(RegisterROT); SAPGuiVerCheckStr("6204.119.32"); //Set SapApplication = CreateObject("Sapgui.ScriptingCtrl.1") //SapApplication.OpenConnection ("testsap620") //Set Session = SapApplication.Children(0).Children(0) DO_SLEEP(18); SAPGuiPropIdStr("wnd[0]");//1057828784.513 SAPGuiCmd3(GuiMainWindow,ResizeWorkingPane,92,34,false); DO_SLEEP(16); SAPGuiPropIdStr("wnd[0]/usr/txtRSYST-BNAME");//1057828800.786 SAPGuiCmd1(GuiTextField,PutText,"qaload1"); SAPGuiPropIdStr("wnd[0]/usr/pwdRSYST-BCODE");//1057828800.796 SAPGuiCmd1Pwd(GuiPasswordField,PutText,"~encr~0000x_'9d"); SAPGuiCmd0(GuiPasswordField,SetFocus); SAPGuiCmd1(GuiPasswordField,PutCaretPosition,3); SAPGuiPropIdStr("wnd[0]");//1057828800.836 SAPGuiCmd1(GuiMainWindow,SendVKey,0); SAPGuiCheckScreen("S000","SAPMSYST","SAP");//1057828800.856 DO_SLEEP(6); SAPGuiCmd3(GuiMainWindow,ResizeWorkingPane,92,34,false); DO_SLEEP(3); SAPGuiPropIdStr("wnd[0]/tbar[0]/btn[15]");//1057828809.839 SAPGuiCmd0(GuiButton,Press); SAPGuiCheckScreen("SESSION_MANAGER","SAPLSMTR_NAVIGATION","SAP Easy Access");//1057828809.859 DO_SLEEP(2); SAPGuiPropIdStr("wnd[1]/usr/btnSPOP-OPTION1");//1057828811.382 SAPGuiCmd0(GuiButton,Press); SAPGuiCheckScreen("SESSION_MANAGER","SAPLSPO1","Log Off");//1057828811.402 } // end try catch (_com_error e){ char buffer[1024]; sprintf(buffer,"SAP: EXCEPTION 0x%x %s for VU(%i)\n",e.Error(), (char *)e.Description(), S_task_id); SAPGui_error_handler(s_info,buffer); } // end catch DO_SetTransactionCleanup(); SAPGuiApplication(RevokeROT); 166 QALoad On lin e Help END_TRANSACTION(); REPORT(SUCCESS); EXIT(); return(0); } void abort_function(PLAYER_INFO *s_info) { RR__printf("Virtual User ABORTED."); EXIT(); } Sam pl e: Ori gi n al SAP Scri pt w i t h Coun t ers Th e followin g sam ple sh ows an origin al SAP script extract with coun ters. Poin ts of in terest in th e script are h igh lighted in bold. Sam ple Script /* * * * * * * * */ counters.cpp Script Converted on July 20, 2004 at 08:43:23 AM Generated by Compuware QALoad convert module version 5.2.0 build 73 This script contains support for the following middlewares: - SAP /* Converted using the following options: * General: * Line Split : 132 characters * Sleep Seconds : 1 * Constants to Variables : Yes * Remove Quotes : No * Tabs To Spaces : No * Auto Checkpoints : No * SAP * Version : 6204.119.32 */ #define SCRIPT_VER 0x00000205UL #include #include #include #include #include #include #include #include #include #include #include <stdio.h> <windows.h> <atlbase.h> <objbase.h> "do_SAPCCOM.h" <atlwin.h> <atlcom.h> <atlhost.h> "cscript.h" "do_SapGui.h" "mwCommon.h" extern "C" { #include "smacro.h" } /* set function to call on abort*/ void abort_function(PLAYER_INFO *s_info); #ifndef NULL #define NULL #endif 0 167 Usin g th e Player, Script Developm en t W orkben ch , an d An alyze extern "C" int rhobot_script(PLAYER_INFO *s_info) { /* Declare Variables */ /// Declare the SAP custom counter variable IDs /// Also declare any SAP counter value variables. SET_ABORT_FUNCTION(abort_function); DEFINE_TRANS_TYPE("counters.cpp"); HRESULT hr = CoInitialize(0); if( hr != ERROR_SUCCESS ) RR__FailedMsg(s_info,"SAP: ERROR initializing COM"); SAPGuiSetCheckScreenWildcard('*'); /// Initialize the SAP custom counter variable IDs. SYNCHRONIZE(); BEGIN_TRANSACTION(); DO_SetTransactionStart(); try{ SAPGuiConnect( s_info,"testsap620"); SAPGuiApplication(RegisterROT); SAPGuiVerCheckStr("6204.119.32"); //Set SapApplication = CreateObject("Sapgui.ScriptingCtrl.1") //SapApplication.OpenConnection ("testsap620") //Set Session = SapApplication.Children(0).Children(0) DO_SLEEP(18); SAPGuiPropIdStr("wnd[0]");//1057828784.513 SAPGuiCmd3(GuiMainWindow,ResizeWorkingPane,92,34,false); DO_SLEEP(16); SAPGuiPropIdStr("wnd[0]/usr/txtRSYST-BNAME");//1057828800.786 SAPGuiCmd1(GuiTextField,PutText,"qaload1"); SAPGuiPropIdStr("wnd[0]/usr/pwdRSYST-BCODE");//1057828800.796 SAPGuiCmd1Pwd(GuiPasswordField,PutText,"~encr~0000x_'9d"); SAPGuiCmd0(GuiPasswordField,SetFocus); SAPGuiCmd1(GuiPasswordField,PutCaretPosition,3); SAPGuiPropIdStr("wnd[0]");//1057828800.836 SAPGuiCmd1(GuiMainWindow,SendVKey,0); SAPGuiCheckScreen("S000","SAPMSYST","SAP");//1057828800.856 DO_SLEEP(6); SAPGuiCmd3(GuiMainWindow,ResizeWorkingPane,92,34,false); DO_SLEEP(3); SAPGuiPropIdStr("wnd[0]/tbar[0]/btn[15]");//1057828809.839 SAPGuiCmd0(GuiButton,Press); 168 QALoad On lin e Help SAPGuiCheckScreen("SESSION_MANAGER","SAPLSMTR_NAVIGATION","SAP Easy Access");//1057828809.859 DO_SLEEP(2); SAPGuiPropIdStr("wnd[1]/usr/btnSPOP-OPTION1");//1057828811.382 SAPGuiCmd0(GuiButton,Press); /// This is where we would like to retrieve the RoundTrips /// and Flushes counter. Here the SAPGuiSessionInfo command /// will be inserted to retrieve these SAP counter values from the server. SAPGuiCheckScreen("SESSION_MANAGER","SAPLSPO1","Log Off");//1057828811.402 /// Here is where the counter information will actually be /// written to the timing file. } // end try catch (_com_error e){ char buffer[1024]; sprintf(buffer,"SAP: EXCEPTION 0x%x %s for VU(%i)\n",e.Error(), (char *)e.Description(), S_task_id); SAPGui_error_handler(s_info,buffer); } // end catch DO_SetTransactionCleanup(); SAPGuiApplication(RevokeROT); END_TRANSACTION(); REPORT(SUCCESS); EXIT(); return(0); } void abort_function(PLAYER_INFO *s_info) { RR__printf("Virtual User ABORTED."); EXIT(); } Sam pl e: M odi f i ed SAP Scri pt w i t h Cust om Coun t ers Th e followin g sam ple sh ows a m odified SAP script with SAP custom coun ters. Ch an ges to Origin al script are h igh ligh ted in bold. Sam ple Script /* * * * * * * * */ counters.cpp Script Converted on July 20, 2004 at 08:43:23 AM Generated by Compuware QALoad convert module version 5.2.0 build 73 This script contains support for the following middlewares: - SAP /* Converted using the following options: * General: 169 Usin g th e Player, Script Developm en t W orkben ch , an d An alyze * Line Split * Sleep Seconds * Constants to Variables * Remove Quotes * Tabs To Spaces * Auto Checkpoints * SAP * Version */ : : : : : : 132 characters 1 Yes No No No : 6204.119.32 #define SCRIPT_VER 0x00000205UL #include #include #include #include #include #include #include #include #include #include #include <stdio.h> <windows.h> <atlbase.h> <objbase.h> "do_SAPCCOM.h" <atlwin.h> <atlcom.h> <atlhost.h> "cscript.h" "do_SapGui.h" "mwCommon.h" extern "C" { #include "smacro.h" } /* set function to call on abort*/ void abort_function(PLAYER_INFO *s_info); #ifndef NULL #define NULL #endif 0 extern "C" int rhobot_script(PLAYER_INFO *s_info) { /* Declare Variables */ /// Scripting: Step 1 int id1, id2, id3, id4; long lRoundTrips,lFlushes; SET_ABORT_FUNCTION(abort_function); DEFINE_TRANS_TYPE("counters.cpp"); HRESULT hr = CoInitialize(0); if( hr != ERROR_SUCCESS ) RR__FailedMsg(s_info,"SAP: ERROR initializing COM"); SAPGuiSetCheckScreenWildcard('*'); /// Scripting: Step 2 // "Counter Group", "Counter Name", "Counter Units // (Optional)", Data Type, Counter Type. id1 = DEFINE_COUNTER("Cumulative Group", "Cumulative RoundTrips", 0, DATA_LONG, COUNTER_CUMULATIVE); id2 = DEFINE_COUNTER("Cumulative Group", "Cumulative Flushes", 0, DATA_LONG, COUNTER_CUMULATIVE); 170 QALoad On lin e Help id3 = DEFINE_COUNTER("Instance Group", "Instance RoundTrips", 0, DATA_LONG, COUNTER_INSTANCE); id4 = DEFINE_COUNTER("Instance Group", "Instance Flushes", 0, DATA_LONG, COUNTER_INSTANCE); SYNCHRONIZE(); BEGIN_TRANSACTION(); DO_SetTransactionStart(); try{ SAPGuiConnect( s_info,"testsap620"); SAPGuiApplication(RegisterROT); SAPGuiVerCheckStr("6204.119.32"); //Set SapApplication = CreateObject("Sapgui.ScriptingCtrl.1") //SapApplication.OpenConnection ("testsap620") //Set Session = SapApplication.Children(0).Children(0) DO_SLEEP(18); SAPGuiPropIdStr("wnd[0]");//1057828784.513 SAPGuiCmd3(GuiMainWindow,ResizeWorkingPane,92,34,false); DO_SLEEP(16); SAPGuiPropIdStr("wnd[0]/usr/txtRSYST-BNAME");//1057828800.786 SAPGuiCmd1(GuiTextField,PutText,"qaload1"); SAPGuiPropIdStr("wnd[0]/usr/pwdRSYST-BCODE");//1057828800.796 SAPGuiCmd1Pwd(GuiPasswordField,PutText,"~encr~0000x_'9d"); SAPGuiCmd0(GuiPasswordField,SetFocus); SAPGuiCmd1(GuiPasswordField,PutCaretPosition,3); SAPGuiPropIdStr("wnd[0]");//1057828800.836 SAPGuiCmd1(GuiMainWindow,SendVKey,0); SAPGuiCheckScreen("S000","SAPMSYST","SAP");//1057828800.856 DO_SLEEP(6); SAPGuiCmd3(GuiMainWindow,ResizeWorkingPane,92,34,false); DO_SLEEP(3); SAPGuiPropIdStr("wnd[0]/tbar[0]/btn[15]");//1057828809.839 SAPGuiCmd0(GuiButton,Press); SAPGuiCheckScreen("SESSION_MANAGER","SAPLSMTR_NAVIGATION","SAP Easy Access");//1057828809.859 DO_SLEEP(2); SAPGuiPropIdStr("wnd[1]/usr/btnSPOP-OPTION1");//1057828811.382 SAPGuiCmd0(GuiButton,Press); /// Scripting: Step 3 SAPGuiSessionInfo(GetRoundTrips,lRoundTrips); SAPGuiSessionInfo(GetFlushes,lFlushes); SAPGuiCheckScreen("SESSION_MANAGER","SAPLSPO1","Log Off");//1057828811.402 171 Usin g th e Player, Script Developm en t W orkben ch , an d An alyze /// Scripting: Step 4 COUNTER_VALUE( COUNTER_VALUE( COUNTER_VALUE( COUNTER_VALUE( id1,lRoundTrips); id2,lFlushes); id3,lRoundTrips); id4,lFlushes); } // end try catch (_com_error e){ char buffer[1024]; sprintf(buffer,"SAP: EXCEPTION 0x%x %s for VU(%i)\n",e.Error(), (char *)e.Description(), S_task_id); SAPGui_error_handler(s_info,buffer); } // end catch DO_SetTransactionCleanup(); SAPGuiApplication(RevokeROT); END_TRANSACTION(); REPORT(SUCCESS); EXIT(); return(0); } void abort_function(PLAYER_INFO *s_info) { RR__printf("Virtual User ABORTED."); EXIT(); } Winsock How QALoad handles DO_WSK_Send commands QALoad displ ays th e con t en ts of a DO_W SK_Sen d com m an d as a strin g in a W in sock script. Som e of t h ese strin gs are very large, wh i ch can cause a com piler error (fatal error C1076: com piler lim it: in tern al h eap lim it reach ed) if th ere are several large strin gs in a sin gle script. To avoi d th is com pilation error, QALoad does n ot al low strin gs th at are displayed in a W in sock scri pt to be m ore th an 12,000 ch aract ers. If a DO_W SK_Sen d com m an d h as a sen d buffer larger th an 12,000 ch aract ers, its buffer is broken in to sm aller strin gs durin g th e con version . Th ese sm aller strin gs are th en copied in to a ch ar buffer n am ed "Sen dBuffer", wh ich is sen t in the DO_W SK_Sen d com m an d. Th e size of th e Sen dBuffer variable, by default, is declared as th e size of th e largest DO_W SK_Sen d + 1000. For exam ple: int rhobot_script(s_info) PLAYER_INFO *s_info; { /* Declare Variables */ char SendBuffer[22139]; //Largest send is 21139 + 1000 ... ... ... strcpy(SendBuffer, "$$ ...."); //Assume a large string, shortened for this example strcat(SendBuffer, "$$ ...."); /* 12675 bytes */ DO_WSK_Send(S1, SendBuffer); ... ... 172 QALoad On lin e Help strcpy(SendBuffer, "$$ ...."); //SendBuffer is reused strcat(SendBuffer, "$$ ...."); strcat(SendBuffer, "$$ ...."); /* 21139 bytes */ DO_WSK_Send(S1, SendBuffer); ... ... REPORT(SUCCESS); EXIT(); return(0); } Handling Winsock application data flow Frequen tly, server program s return un ique values (for exam ple, a session ID) th at vary with each execution of th e script an d m ay be vital to th e success of subsequen t tran saction s. To create scripts th at in clude th ese values, you n eed to substitute th e h ard-coded values return ed by th e server with variables. Th e followin g origin al an d m odified code exam ples dem on strate t h is tech n ique. Ori gi n al code In th is script, th e server sen ds a session ID in respon se to a con n ection by th e clien t. Th is session ID is required t o successfully com plete subsequen t tran saction s. /* * wsk-AdvancedTechniques_original.c * * This script contains support for the following * middlewares: * - Winsock */ /* Converted using the following options: * General: * Line Split : 80 characters * Sleep Seconds : 1 * Auto Checkpoints : Yes */ #define SCRIPT_VER 0x00000005UL #include <stdio.h> #include "smacro.h" #include "do_wsk.h" /* set function to call on abort*/ void abort_function(PLAYER_INFO *s_info); #ifndef NULL #define NULL 0 #endif int rhobot_script(s_info) PLAYER_INFO *s_info; { /* Declare Variables */ SET_ABORT_FUNCTION(abort_function); DEFINE_TRANS_TYPE("wsk-AdvancedTech_1.c"); // Checkpoints have been included by the convert process DefaultCheckpointsOn(); 173 Usin g th e Player, Script Developm en t W orkben ch , an d An alyze DO_WSK_Init(s_info); SetTimeout(20); /* Wait up to 20 seconds for each expected pattern */ SYNCHRONIZE(); BEGIN_TRANSACTION(); DO_WSK_Socket(S1, AF_INET, SOCK_STREAM, IPPROTO_IP); DO_WSK_Bind(S1, ANY_ADDR, ANY_PORT); DO_WSK_Connect(S1, "172.22.24.125", 2100, AF_INET); ///////////////////////////////////////////////////// // The session id returned by the server is // unique to each connection ///////////////////////////////////////////////////// /* 21bytes: SessionID=jrt90847\r\n */ DO_WSK_Expect(S1, "\n"); ////////////////////////////////////////////////////// // This unique id is then used for subsequent // requests ////////////////////////////////////////////////////// /* 34 bytes */ DO_WSK_Send(S1, "SessionID=jrt90847\r\n:^B^@^@^@^B^@^@^@^A^@^@^@"); /* 15 bytes: ID Accepted#^@\r\n */ DO_WSK_Expect(S1, "\n"); DO_WSK_Closesocket(S1); END_TRANSACTION(); REPORT(SUCCESS); EXIT(); return(0); } void abort_function(PLAYER_INFO *s_info) { RR__printf("Virtual User %i:ABORTED.", S_task_id); EXIT(); } M odi f i ed code If th e origin al script (wsk-Advan cedTech n iques_origin al.c sh own above) is replayed, it will fail because t h e session ID will n ot be un ique; rath er, it will be th e session ID th at is coded in th e script. To use th e un ique session ID recei ved from th e server, variable substitution m ust be used. /* * wsk-AdvancedTechniques_modified.c * * This script contains support for the following * middlewares: * - Winsock */ /* Converted using the following options: * General: * Line Split : 80 characters * Sleep Seconds : 1 * Auto Checkpoints : Yes */ 174 QALoad On lin e Help #define SCRIPT_VER 0x00000005UL #include <stdio.h> #include "smacro.h" #include "do_wsk.h" /* set function to call on abort*/ void abort_function(PLAYER_INFO *s_info); #ifndef NULL #define NULL 0 #endif int rhobot_script(s_info) PLAYER_INFO *s_info; { /* Declare Variables */ char Buffer[64]; char SendBuffer[64]; int nBytesReceived = 0; SET_ABORT_FUNCTION(abort_function); DEFINE_TRANS_TYPE("wsk-AdvancedTech_1.c"); // Checkpoints have been included by the convert process DefaultCheckpointsOn(); DO_WSK_Init(s_info); SetTimeout(20); /* Wait up to 20 seconds for each expected pattern */ SYNCHRONIZE(); BEGIN_TRANSACTION(); DO_WSK_Socket(S1, AF_INET, SOCK_STREAM, IPPROTO_IP); DO_WSK_Bind(S1, ANY_ADDR, ANY_PORT); DO_WSK_Connect(S1, "172.22.24.125", 2100, AF_INET); ////////////////////////////////////////////////////// // The reply from the server is read into // the Buffer variable. We will then have // the unique Session ID for this connection. // Also need to null-terminate the buffer // after receiving. ////////////////////////////////////////////////////// DO_WSK_Recv(S1, Buffer, 64, 0, &nBytesReceived); Buffer[nBytesRecieved] = '\0'; /* 21bytes: SessionID=jrt90847\r\n */ //DO_WSK_Expect(S1, "\n"); ////////////////////////////////////////////////////// // Finally, substitute the Session ID received from // the server with the one coded in the script. ////////////////////////////////////////////////////// sprintf(SendBuffer, "%s:^B^@^@^@^B^@^@^@^A^@^@^@", Buffer); DO_WSK_Send(S1, SendBuffer); /* 34 bytes */ //DO_WSK_Send(S1, "SessionID=jrt90847:^B^@^@^@^B^@^@^@^A^@^@^@"); /* 15 bytes: ID Accepted#^@\r\n */ DO_WSK_Expect(S1, "\n"); DO_WSK_Closesocket(S1); 175 Usin g th e Player, Script Developm en t W orkben ch , an d An alyze END_TRANSACTION(); REPORT(SUCCESS); EXIT(); return(0); } void abort_function(PLAYER_INFO *s_info) { RR__printf("Virtual User %i:ABORTED.", S_task_id); EXIT(); } Winsock Recording Options User St art ed: Select th is option if you wan t to start your application m an uall y for recordin g, eith er before or after you start recordin g. Because th is m eth od m ay fail to record your appl ication ’s in itial calls, Com puware recom m en ds you use th e Aut om at i c option in stead. Select th e User Started option wh en you do n ot kn ow th e full application startup n am e an d com m an d option param et ers or wh en th e application spawn s off processes th at gen erate traffic th at you wan t recorded. Not es: If you run a character-based application in a DOS window, the Script Development Workbench does not record the API calls. If you choose this option and the application under test generates traffic before the first Windows screen displays, you must also select the Capt ure Init ializat ion Phase check box on the Workbench Options dialog box. Aut om at i c: Select th is option if you wan t QALoad t o autom atically start your W in sock-based clien t, allowin g you to record early application startup acti vity. Th is is th e recom m en ded m eth od of recordin g because it takes advan t age of QALoad’s en h an ced abilities to h an dle various m ulti-th readed program m in g tech n iques. W h en you sel ect th is option , th e QALoad Script Devel opm en t W orkben ch records th e API calls th at occur before th e clien t en ters its m essage loop. Select th is option to record traffic from just on e application . Th is option li m its th e recordin g output to just th e traffic gen erated by th e application , n ot in cludin g th e traffic th at is gen erated by processes spawn ed by th e application . Com m an d Li n e: En ter the com m an d lin e of your W in sock-based clien t. Not e th at if you en ter th e full path , QALoad autom atical ly en ters th e path in th e W or k i n g Di rect or y field. W or k i n g Di rect or y: En ter th e workin g directory of your W in sock-based clien t, if n ecessary. Capt ure: Select th e W in sock version to record. Set I P Addresses: Click th is button to open th e Add/ Delete IP Addresses di alog box, wh ich you can use to specify th e IP addresses an d ports on wh ich you wan t to record W in sock API calls or th at you wish to exclude from recordin g. Winsock Conversion Options Th ere are n o specialized con version option s for W in sock. Winsock Command Reference QALoad provides descri ption s an d exam ples of th e various com m an ds available for a W in sock scri pt. For details, refer to th e Lan guage Referen ce Help section for W in sock. 176 QALoad On lin e Help Winsock Running Out of Socket Resources You m ay en coun ter a problem run n in g out of socket resources on NT or Solaris wh en th ere are large n um bers of sh ort-lived con n ection s. W h en TCP/ IP con n ection s are sh utdown , th ey go i n to a TIM E_W AIT state waitin g for th e specified in terval to expire. W h ile in th at state th e con n ection is lookin g for an y stray packets t h at m ay h ave been sen t to th is con n ection an d rem ain un ackn owledged. If th is process was skipped, it would be possible for a n ew con n ection to be open ed usin g th e sam e address an d port as th e previous con n ection an d to in correctly receive data th at was in ten ded for th e previous con n ection . W h en QALoad is gen eratin g m an y sh ort-lived con n ection s, durin g a W in sock or W W W load test, th e default settin g for th e tim ed wait delay m ay be so h igh th at th e driver m ach in e will run out of socket resources as all cl osed sockets wait in th e TIM E_W AIT state. To ch an ge th e settin g for th e tim ed wait delay: W i n dow s NT Set th e registry key: HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\tcpip\ Parameters\TcpTimedWaitDelay to a lower value. It can be set to an yth in g between 30 an d 300. Com puware suggests usin g th e lowest possible value (30). Sol ari s 2.6 Usin g "n dd" set th e "tcp_close_wait_in terval" to 30 secon ds: ndd -get /dev/tcp tcp_close_wait_interval ndd -set /dev/tcp tcp_close_wait_interval 30000 Sol ari s 2.7 Use "n dd" as sh own previ ously for Solaris 2.6, but substitute th e "tcp_tim e_wait_in terval" Understanding Data representation in the Script Th is section describes h ow data th at is sen t an d received is displ ayed in a W in sock script. Use th is section as a referen ce wh en you exam in e a script. Durin g th e con version process, QALoad determ in es h ow to represen t each ch aracter in th e script. Th is con version process uses th e followin g rules: 1. The character is compared to the “space” character in the ASCII table, which has a decimal value of 32. If the character’s value is less than 32, the following steps are taken: a. If the character is “\r”, “\n”, “\t”, or “\f”, it is represented in the script as a normal C escape character. b. If the character is either “^\” or “^^”, it is represented in the script as an octal character. For example, the values would be “\034” and “\036”, respectively. c. If the character’s value is less than 32 and it does not meet the descriptions in a) and b) above, it is represented in the script as a control character. For example, if the character is a null character, it is represented in the script as “^@”. 177 Usin g th e Player, Script Developm en t W orkben ch , an d An alyze 2. If the character’s decimal value is between 32 (the “space” character) and 126 (~), it displays in the script as a standard readable ASCII character, with the following exceptions: 3. If th e ch aracter is “ \ ” , wh ich h as a decim al value of 92, it is represen ted as “ \ \ ” in th e script. If th e ch aracter is “ “ “ , wh ich h as a decim al value of 34, it is represen ted as “ \ ” ” in th e script. If th e ch aracter is “ ^ ” , wh ich h as a decim al value of 94, it is represen ted as “ ^ ^ ” in th e script. If the character has a decimal value of 127, which corresponds to Delete (DEL), it is represented as “^” in the script. Th e followin g table sum m arizes th e results of rules 1-3. 178 Code Oct al Deci m al Ch ar ^@ 000 0 NUL ^A 001 1 SOH ^B 002 2 STX ^C 003 3 ETX ^D 004 4 EOT ^E 005 5 ENQ ^F 006 6 ACK ^G 007 7 BEL ^H 010 8 BS \t 011 9 HT \n 012 10 LF ^K 013 11 VT \f 014 12 FF \r 015 13 CR ^N 016 14 SO ^O 017 15 SI ^P 020 16 SLE ^Q 021 17 SC1 ^R 022 18 DC2 ^S 023 19 DC3 ^T 024 20 DC4 QALoad On lin e Help ^U 025 21 NAK ^V 026 22 SYN ^W 027 23 ETB ^X 030 24 CAN ^Y 031 25 EM ^Z 032 26 SIB ^[ 033 27 ESC \034 034 28 FS ^] 035 29 GS ^_ 037 31 US 040 32 SP \" 042 34 " \\ 134 92 \ ^^ 136 94 ^ ^? 177 127 DEL 4. If the character is not included in the groups defined in steps 1-3, it is represented as an octal character in the script. These characters are often referred to as high ASCII characters (those with a decimal value greater than 128), and are represented in the script as “\OOO”, where OOO is the octal value for the ASCII character. Overview: Handling Winsock Connection Problems W h en a rem ote application is h an dlin g oth er tasks an d is n ot able to accept a con n ection , you can m odify your script so th at it retries th e con n ection . W h en im plem en tin g th is sort of fun ction ality, be sure you: ! Lim it th e n um ber of con n ection retries so th at th e script doesn 't execute in defin itely. ! Turn off th e abort flag before th e con n ection an d turn it back on im m ediately after th e con n ection loop. Oth erwise th e virtual user aborts wh en a con n ection fails. Con cl usi on Th e sam ple scri pt illustrates h ow to create a scri pt th at attem pts to recon n ect to a rem ote appli cation if th e first con n ection fails. Caut ion: It is very important that you specify a limit to the number of connection retries or the script runs in an endless loop. This may create a denial of service attack on the remote application. Overview: Parsing Server Replies You can fin d a strin g with in th e reply return ed from th e sever usin g SkipExpr() an d Scan Expr(). SkipExpr() search es th e in tern al buffer th at con tain s th e respon se received in th e DO_W SK_Expect() for th e first occuran ce of th e strin g. It places th e poin ter in th e position im m ediately foll owin g th e strin g. Th en use Scan Expr() to search for th e en d of th e strin g. Th is saves th e buffer followin g th e first occurren ce of th e 179 Usin g th e Player, Script Developm en t W orkben ch , an d An alyze strin g used in SkipExpr(), up to an d in cludin g th e strin g in Scan Expr(). Th e first param eter of Scan Expr() takes a Un ix-style regular expression . Th e followin g table sh ows som e of th e m ost com m on expression s. Ch aract er M ean i n g “ .” M atch es th e en d of a strin g “ *” M atch es an y n um ber of ch aracters “ ?” M atch es an y on e ch aracter Con cl usi on Use th e SkipExpr() an d Scan Expr() to fin d a strin g return ed from th e server. Th e sam ple scri pt illustrates th is tech n ique. Accessing Local and Remote Network Addresses You can retrieve th e IP address or port to wh ich a socket h an dle is con n ected, or retrieve th e IP address an d port to wh ich a socket h an dle is boun d. Th e sam pl e script illustrates h ow to retrieve an d store socket address an d port in form at ion . Th e required code is sh own in bold. Sam pl e Scri pt ... /* Declare Variables */ //Belows are two socket structs that will store the address and port information. struct sockaddr_in RemoteAddr; struct sockaddr_in LocalAddr; … BEGIN_TRANSACTION(); DO_WSK_Socket(S1, AF_INET, SOCK_STREAM, IPPROTO_TCP); DO_WSK_Bind(S1, ANY_ADDR, ANY_PORT); /* Socket S2 was bound to address 0.0.0.0 on port 3320 (hibyte=12,lobyte=248) */ //Called after the DO_WSK_Bind() to see which address the socket was bound to LocalAddr.sin_addr.s_addr = ntohl(GetLocalAddr(S1)); //Called after the DO_WSK_Bind() to see which port the socket was bound to LocalAddr.sin_port = GetLocalPort(S1); DO_WSK_Connect(S1, "10.4.26.24", 80, AF_INET); //Called to retrieve the remote address that S1 is connected to. RemoteAddr.sin_addr.s_addr = ntohl(GetRemoteAddr(S1)); //Called to retrieve the remote port that S1 is connected to. RemoteAddr.sin_port = ntohs(GetRemotePort(S1)); //The function below will print the remote and local address and port information // to the playerbuffer. Within the RR__printf() the script is using the socket function // “inet_ntoa()” to convert the IP from an unsigned long to a string // format, “XXX.XXX.XXX.XXX”. RR__printf("Remote: address=%s port=%d",inet_ntoa(RemoteAddr.sin_addr), RemoteAddr.sin_port); RR__printf("Local: address=%s port=%d",inet_ntoa(LocalAddr.sin_addr), LocalAddr.sin_port); DO_WSK_Closesocket(S1); 180 QALoad On lin e Help … Con cl usi on W h en th is code is executed, a m essage is prin ted to th e playerbuffer, such as: VU 0 : Remote: address=10.4.26.24 port=80 VU 0 : Local: address=10.15.16.26 port=1125 Parsing Server Replies Using ScanFloat and ScanInt Som etim es local application s m ust in terpret an d act on n um eric values sen t from a rem ote application . For exam ple, rem ote applicati on s m ay sen d a port n um ber to th e local appli cation . Th e local application parses th e rem ote port from th e data it receives an d attem pts to con n ect to th e rem ote m ach in e on th e n ew port. By usin g Scan In t(), you can parse th e received buffer for n um eric values, such as port n um bers, or use Scan Float() to parse for larger n um eric values. Th e sam ple scri pt illustrates h ow to use Scan Float() an d Scan In t(). Th e required code is sh own in bold. Sam pl e Scri pt ... /* Declare Variables */ //The variable "port" was declared to store the port# that the remote // application sends. The variable "nID" is used to store the unique // ID that is sent by the remote application. unsigned short port; float nID; ... BEGIN_TRANSACTION(); DO_WSK_Socket(S1, AF_INET, SOCK_STREAM, IPPROTO_TCP); DO_WSK_Socket(S2, AF_INET, SOCK_STREAM, IPPROTO_TCP); DO_WSK_Connect(S1, "10.15.21.225", 33, AF_INET); /* 11 bytes: "port=\nA\0\0aB" */ //Since the end of the data that is being received is dynamic, the // script will use DO_WSK_Read() to receive the data instead // using the DO_WSK_Expect() that was converted into the script. //DO_WSK_Expect(“B”); DO_WSK_Read(S1,11); //Calling ScanSkip to move the pointer to the first byte of the port ScanSkip(5); //Calling ScanInt to copy the next two bytes into a variable that will // store the port from the remote application. ScanInt(MyByteOrder(),2,(char*)&port); 181 Usin g th e Player, Script Developm en t W orkben ch , an d An alyze //Calling ScanFloat to copy the next four bytes into a variable that will // store the unique ID from the remote application. ScanFloat(MyByteOrder(),4,(char*)&nID); //Printing the port number to the playerbuffer window, and converting // the value from network byte order to host byte order. RR__printf("port=%d",ntohs(port)); //Printing the unique ID that the remote application sent to the // playerbuffer. RR__printf("float=%f",nID); DO_WSK_Closesocket(S1); //Below is the original DO_WSK_Connect that was converted into the script //DO_WSK_Connect(S2,”10.15.21.225”, 2526, AF_INET); //Uses the port that was returned above to reconnect to the remote application DO_WSK_Connect(S2, "10.15.21.225", ntohs(port), AF_INET); DO_WSK_Send(S2,"Hello World"); DO_WSK_Closesocket(S2); ... Con cl usi on In th is exam ple, th e script parses th e port n um ber sen t from th e rem ote appli cation an d uses th is to recon n ect to th e rem ote application . Th e script also uses Scan Float() to parse a un ique ID from th e m essage sen t by th e rem ote application . Parsing Server Replies Using ScanSkip and ScanString Data return ed from th e server m ay be t oo dyn am ic to base your parsin g on actual ch aracters. In th is case, you can base your search on ch aracter position s usin g Scan Skip() an d Scan Strin g(). For exam ple, you can save ch aracters 20 th rough 25 th at are return ed from a server. Th e Scan Skip() skips th e specified n um ber of ch aracters in th e in tern al buffer th at stores th e respon se received in th e DO_W SK_Expect(). Th e Scan Strin g() scan s th e n um ber of ch aracters you specify in to a ch aracter strin g from th e curren t position in th e buffer. In th is sam ple, th e buffer return ed from th e server i s xxx123456789yyy. You are retrievin g th e value between xxx an d yyy. Th e required code is sh own in bold. Sam pl e Scri pt ... /* Declare Variables */ //Variable to store the string that we are searching for. char temp[15]; … BEGIN_TRANSACTION(); … DO_WSK_Socket(S1, AF_INET, SOCK_STREAM, IPPROTO_IP); 182 QALoad On lin e Help DO_WSK_Bind(S1, ANY_ADDR, ANY_PORT); DO_WSK_Setsockopt(S1, SOL_SOCKET, SO_OOBINLINE, 1); DO_WSK_Connect(S1, "127.0.0.1", 90, AF_INET); //Below is the actual data that was returned at capture time. /* 16 bytes: xxx0123456789yyy */ DO_WSK_Expect(S1, "yyy"); //making sure that all of the data within our variable has been initialized memset(temp,'\0',15); //skips 3 bytes within the buffer that was received. ScanSkip(3); //copies the next 10 bytes of the buffer that was received into our temp variable ScanString(10,temp); //Displays the string that was found to the playerbuffer window. RR__printf("string=%s",temp); DO_WSK_Closesocket(S1); ... Con cl usi on In th is exam ple, th e m essage “ strin g=0123456789” is prin ted to th e player buffer win dow. Receiving Winsock UDP Data with DO_WSK_Recvfrom W h en th e application you are capturin g is usin g th e UDP protocol, you can use th e DO_W SK_Recvfrom () to receive dat a from th e rem ote application . Th e sam ple script illustrates h ow to use th e Do_W sk_Recvfrom (). Th e required code is sh own in bold. Sam pl e Scri pt ... /* Declare Variables */ //The variable strBuf is used to formulate the dynamic data that is // sent in the DO_WSK_Sendto() below. char strBuf[256]; //RemoteAddr stores the remote applications address and port struct sockaddr_in RemoteAddr; //nBytes is used to stor the number of bytes that were received via DO_WSK_Recvfrom() int nBytes = 0; … BEGIN_TRANSACTION(); 183 Usin g th e Player, Script Developm en t W orkben ch , an d An alyze DO_WSK_Socket(S1, AF_INET, SOCK_DGRAM, IPPROTO_UDP); DO_WSK_Bind(S1, "10.15.16.26", 333); //Receives data via the UDP protocol DO_WSK_Recvfrom(S1,strBuf,(struct sockaddr*) &RemoteAddr, 256, 0, &nBytes); //Prints to the player buffer the number of bytes that were received and // the remote address and port that sent them. RR__printf("Received %d bytes from %s:%d", nBytes, inet_ntoa(RemoteAddr.sin_addr), ntohs(RemoteAddr.sin_port)); … DO_WSK_Closesocket(S1); Con cl usi on Th is exam ple sh ows h ow to use DO_W SK_Recvfrom () to receive UDP protocol data. It sh ows h ow to access th e address an d port of th e rem ote application sen din g th e data. Sending Variable Data with DO_WSK_Send Captured data m ay n ot be th e data you wan t to use wh ile run n in g a test. For exam ple, you m igh t ch an ge th e user n am e sen t durin g capture tim e to a differen t value durin g replay. You can ch an ge th e value in th e DO_W SK_Sen d() to m ake a static value with in th e fun ction . However, if you wan t to substitute a differen t value each tim e, you can create a dyn am i c vari able, such as a dat apool value, to replace th e user n am e. In th is exam ple, th e script in cludes a DO_W SK_Sen d() th at sen ds “ n am e=Jim ” to th e server as th e user n am e. For testin g purposes, you wan t to ch an ge th e n am e to in clude a variabl e th at represen ts a differen t n am e, such as “ M ark” . Th e code required for th is is sh own in bold. Sam pl e Scri pt … /* Declare Variables */ //Below are variables needed for the dynamic data. The size of these //variables will depend upon how big the buffer is that you are replacing char buffer[65]; char sendbuffer[65]; … BEGIN_TRANSACTION(); … DO_WSK_Socket(S1, AF_INET, SOCK_STREAM, IPPROTO_IP); DO_WSK_Bind(S1, ANY_ADDR, ANY_PORT); DO_WSK_Setsockopt(S1, SOL_SOCKET, SO_OOBINLINE, 1); 184 QALoad On lin e Help DO_WSK_Connect(S1, "127.0.0.1", 90, AF_INET); //Below is the original send based upon the capture file. // DO_WSK_Send(S1,"name=Jim"); //The script will now create a buffer that is different than what was captured, //and if we wanted the string “Mark” could also of been a datapool value. strcpy( buffer, "Mark"); sprintf( sendbuffer, "name=%s", buffer); //The script will now send the variable string that was created above DO_WSK_Send(S1, sendbuffer); /* 2 bytes: ok */ DO_WSK_Expect(S1,"ok"); DO_WSK_Closesocket(S1); Con cl usi on In th is exam ple, th e user n am e sen t to th e server is ch an ged from “ n am e=Jim ” to “ n am e=M ark” by m odifyin g th e buffer before th e DO_W SK_Sen d() an d passin g th e n ew buffer as th e secon d param eter of th e DO_W SK_Sen d(). Sending Variable Data using DO_WSK_SendAll W h en on ly a portion of a strin g th at th e script is sen din g m ust be m odified to m ake it dyn am ic, usin g th e DO_W SK_Sen dAll() can be easier th an m odifyin g th e DO_W SK_Sen d(). Th e followin g exam ple sen ds th e usern am e “ Bob” an d th e password “ CPW R” to th e server to logon . Sin ce on ly on e in stan ce of th is user can be logged on to t h e server, you m ust m odify th e script to read differen t user n am es an d passwords from a datapool before sen din g it. In th e sam ple script sn ippet, th e required code is sh own in bold. Sam pl e Scri pt ... BEGIN_TRANSACTION(); //Reads in a datapool record to be used to make the username and password dynamic. GET_DATA(); DO_WSK_Socket(S2, AF_INET, SOCK_STREAM, IPPROTO_TCP); DO_WSK_Bind(S2, ANY_ADDR, ANY_PORT); DO_WSK_Connect(S2, "10.0.6.32", 80, AF_INET); //In the string that was sent below "Bob" and "CPWR" both need to be modified // to allow for multiple users to execute this script. /* 20 bytes */ //DO_WSK_Send(S2, "^@user=Bob^@pwd=CPWR^@\377"); 185 Usin g th e Player, Script Developm en t W orkben ch , an d An alyze //Using DO_WSK_Sendall the message that is being sent can easily be modified, so // that the script can read in the username and password from a datapool file. DO_WSK_SendAll(S2,5, "^@user", VARDATA(1), "^@pwd=", VARDATA(2), "^@\377"); /* 15 bytes: SID=1234567890^@ */ DO_WSK_Expect(S2, "^@"); DO_WSK_Closesocket(S2); ... Con cl usi on In th e sam ple m odified script, th e user n am e an d password are read in from a datapool file an d th e data is sen t usin g th e DO_W SK_Sen dAll(). Sending Variable Winsock UDP Data Captured data m ay n ot be th e data th at you wan t to use wh ile run n in g a test. For exam ple, you m ay wan t to substitute a user n am e sen t durin g capture with a differen t value each tim e durin g replay. You can do th is usin g a dyn am ic variable, such as a datapool variable. Not e: Changing the value located in the DO_WSK_Sendto() makes the value static within the function. In th is sam ple, th e code i n bold below sh ows h ow ch an ge data values. Sam pl e Scri pt ... /* Declare Variables */ //The variable strBuf is used to formulate the dynamic data that is // sent in the DO_WSK_Sendto() below. char strBuf[24]; … BEGIN_TRANSACTION(); //Reads in a row of data from a central datapool file, and this will be //used as part of the dynamic data that will be sent via the DO_WSK_Sendto() GET_DATA(); DO_WSK_Socket(S1, AF_INET, SOCK_DGRAM, IPPROTO_IP); DO_WSK_Setsockopt(S1, SOL_SOCKET, SO_BROADCAST, 1); DO_WSK_Bind(S1, "127.0.0.1", 5634); //Below is the original DO_WSK_Sendto() that was converted into the script //DO_WSK_Sendto(S1, "name=Brian", "10.25.26.24", 1234); //The example below reads a record in from a central datapool, and the value // is then sent as part of the DO_WSK_Sendto() buffer. memset(strBuf, 0, 24); sprintf(strBuf, "name=%s", VARDATA(1)); 186 QALoad On lin e Help DO_WSK_Sendto(S1, strBuf, "10.25.26.24", 1234); … DO_WSK_Closesocket(S1); … Con cl usi on In th is exam ple, th e virtual user reads in a row of data from a cen tral dat apool, wh ich is used to create a dyn am ic m essage. Th is m essage is used in th e DO_W SK_Sen dto() to sen d it t o th e address “ 10.25.26.24” . Sending Variable Data using DO_WSK_Write You can use DO_W SK_W rite() in stead of DO_W SK_Sen d() wh en codin g script s by h an d. DO_W SK_W rite() does n ot expect strin gs that h ave certain con trol an d n ull ch aracters en coded, as does DO_W SK_Sen d(). Th is allows you to sen d data with out usin g EscapeStr() to en code an y possibl e con trol ch aracters. Th e sam ple scri pt illustrates h ow to use DO_W SK_W rite(). Th e required code is sh own in bold. Sam pl e Scri pt ... /* Declare Variables */ //Variable that will be used to send data to the server via DO_WSK_Write() char temp[24]; ... BEGIN_TRANSACTION(); DO_WSK_Socket(S2, AF_INET, SOCK_STREAM, IPPROTO_TCP); DO_WSK_Bind(S2, ANY_ADDR, ANY_PORT); DO_WSK_Connect(S2, "10.4.26.24", 60, AF_INET); //The original data that was sent was... "^@user=Bob^@pwd=CPWR^@", and the // ^@ are encoded null characters. The function below constructs the same // data that was sent without the data being encoded. memcpy(temp,"\0user=Bob\0pwd=CPWR\0", 19); /* 19 bytes */ //The DO_WSK_Send() below was converted to the script from the capture file. //DO_WSK_Send(S2, "^@user=Bob^@pwd=CPWR^@"); //Since the script is now using DO_WSK_Write() to send the data it does not //need to call EscapeStr() to encoded the NULL characters within the string //that is being sent. DO_WSK_Write(S2,temp, 19); /* 15 bytes: SID=1234567890^@ */ DO_WSK_Expect(S2, "^@"); DO_WSK_Closesocket(S2); ... 187 Usin g th e Player, Script Developm en t W orkben ch , an d An alyze Con cl usi on In th e sam ple script, th e data was sen t usin g th e DO_W SK_W rite() in stead of t h e DO_W SK_Sen d(). Th is allows you to sen d data with out en codin g it. Using Central Datapools within a Winsock Script You can use dyn am ic dat a in your script by readin g data from a datapool file. However, datapool files m ust be in an ASCII strin g, an d n ot all dyn am ic data are i n th is form at. For exam pl e, wh en th e strin g “ \ 121\ 101\ 114\ 157\ 141\ 144” appears in a datapool file an d is read in usin g a on e of th e dat apool fun ction s, you receive \ \ 121\ \ 101\ \ 114\ \ 157\ \ 141\ \ 144 as th e output. You can en sure th at th e output strin g you receive is accurate by usin g th e OctalToCh ar() to con vert an y octal sequen ces in to th eir bin ary represen tation . In th is sam ple script, th e strin g “ \ 121\ 101\ 114\ 157\ 141\ 144” is read in from a cen tral datapool file an d con verted to its bin ary represen t ation . Th e required code is sh own in bold. Sam pl e Scri pt /* Declare Variables */ //Variable declared to store the central datapool record. char temp[40]; … BEGIN_TRANSACTION(); //Gets a row of data from the Conductor during the test. GET_DATA(); … DO_WSK_Socket(S1, AF_INET, SOCK_STREAM, IPPROTO_IP); DO_WSK_Bind(S1, ANY_ADDR, ANY_PORT); DO_WSK_Setsockopt(S1, SOL_SOCKET, SO_OOBINLINE, 1); //Read the first column from the central datapool row that was //returned when the GET_DATA() was called. strcpy(temp,VARDATA(1)); //used to convert octal strings to their binary format OctalToChar(temp); //The script is now setup to send the data that was read in from the //central datapool file instead of the hard coded values that were captured. DO_WSK_Send(S1,temp); //Below is the original send that was captured. //DO_WSK_Send(S1,”\121\101\122\165\156”); DO_WSK_Closesocket(S1); Con cl usi on In th is exam ple, th e DO_W SK_Sen d() sen ds th e oct al represen tation for th e strin g “ QALoad” , “ \ 121\ 101\ 114\ 157\ 141\ 144” , to th e server. 188 QALoad On lin e Help Accessing Server Replies Using Response and ResponseLength You can save th e en tire reply th at a server return s usin g Respon se() an d Respon seLen gth (). W h en you call Respon se() directly after th e DO_W SK_Expect(), it return s a poin ter to th e dat a recei ved by th e DO_W SK_Expect(). To receive th e len gth of th e received reply, call th e Respon seLen gth (). Th is return s th e n um ber of ch aracters received. Th e sam ple scri pt illustrates h ow to use th ese com m an ds to save a server reply. In th is sam ple, th e code in bold sh ows h ow to use Respon se() an d Respon seLen gth (). Sam pl e Scri pt /* Declare Variables */ //Below are variables needed for this example int x = 0; char *temp; … BEGIN_TRANSACTION(); … DO_WSK_Socket(S1, AF_INET, SOCK_STREAM, IPPROTO_IP); DO_WSK_Bind(S1, ANY_ADDR, ANY_PORT); DO_WSK_Setsockopt(S1, SOL_SOCKET, SO_OOBINLINE, 1); DO_WSK_Connect(S1, "127.0.0.1", 90, AF_INET); //Below is the actual buffer that was returned at capture time. /* 21 bytes: You are now connected */ DO_WSK_Expect(S1, "d"); // used to store the data that was received by the DO_WSK_Expect temp = Response(); //used to get the size of the response that was received so far. x = ResponseLength(); //The line below will print the length of the response to the playerbuffer RR__printf(“The size of the received buffer was %d bytes ",x,); DO_WSK_Closesocket(S1); Con cl usi on In th is exam ple, Respon se() an d Respon seLen gth () are used to prin t th e m essage “ Th e size of th e received buffer was 21 bytes” to th e player buffer win dow. Accessing Server Replies with DO_WSK_Read W h en data received is too dyn am ic an d th ere is n oth in g on wh ich to base th e un ique strin g, you can n ot use th e DO_W SK_Expect() to access server replies. In th is case, wh en th e n um ber of ch aracters received is always th e sam e, you can use DO_W SK_Read(). In th e followin g exam ple, th e user sen ds a logon strin g to th e server an d th e server sen ds back a un ique key th at is used for subsequen t calls. Sin ce th e en din g ch aracters always ch an ge, DO_W SK_Read is called to receive a specified n um ber of ch aracters. You can parse th is data for an y values you n eed. Th e required code is sh own in bold. Sam pl e Scri pt ... BEGIN_TRANSACTION(); 189 Usin g th e Player, Script Developm en t W orkben ch , an d An alyze DO_WSK_Socket(S2, AF_INET, SOCK_STREAM, IPPROTO_TCP); DO_WSK_Bind(S2, ANY_ADDR, ANY_PORT); DO_WSK_Connect(S2, "10.4.26.24", 80, AF_INET); /* 20 bytes */ DO_WSK_Send(S2, "^@user=Bob^@pwd=CPWR^@\377"); //The data that is being sent from the server is dynamic and the ending // character is never the same. Since this is the case using // DO_WSK_Expect() will not work, so the script will use DO_WSK_Read() // to receive the same number of bytes that were originally sent. /* 14 bytes: SID=1234567890 */ //DO_WSK_Expect(S2, "^@"); //The script will now print the response that was received by // calling Response() to gain access to the received buffer. If ( DO_WSK_Read(S2,14) != -1) RR__printf("String = %s",Response()); ... Con cl usi on Usin g DO_W SK_Read() in stead of DO_W SK_Expect() allows th e virtual user to receive a specific n um ber of bytes in stead of a sequen ce of ch aracters. Accessing Server Replies with DO_WSK_Recv W h en th e data return ed is too dyn am ic an d th e DO_W SK_Expect() fails, you can use DO_W SK_Recv() t o store th e reply return ed from th e server. Th is saves t h e respon se based on its size in stead of on th e un ique ch aracter strin g used in the DO_W SK_Expect(). W h en you use DO_W SK_Recv(), you specify h ow m uch data you wan t to receive an d wh ere to store it. Th e sam ple scri pt illustrates h ow to use DO_W SK_Recv to store th e reply from th e server. Th e required code is sh own in bold. Sam pl e Scri pt /* Declare Variables */ //Below are variables that were declared to use with DO_WSK_Recv, //and the size of temp will vary depending upon the buffers that your //application is returning. int size = 0; char temp[45]; … BEGIN_TRANSACTION(); … DO_WSK_Socket(S1, AF_INET, SOCK_STREAM, IPPROTO_IP); DO_WSK_Bind(S1, ANY_ADDR, ANY_PORT); DO_WSK_Setsockopt(S1, SOL_SOCKET, SO_OOBINLINE, 1); DO_WSK_Connect(S1, "127.0.0.1", 90, AF_INET); //Below is the data that was received at capture time. /* 21 bytes: You are now connected */ //Initializing the temp variable memset(temp,'\0',45); 190 QALoad On lin e Help //Instead of calling DO_WSK_Expect() to receive the data, the //script will now call DO_WSK_Recv(). This will allow the script to //receive a specified number of characters instead of looking at the data //to determine if the buffer has been received entirely or not. DO_WSK_Recv(S1,temp,45,0,&size); //Original function that was in the script //DO_WSK_Expect(S1, “d”); //Prints the size of the string that was received to the playerbuffer. RR__printf("Size of the received buffer was %d bytes", size); DO_WSK_Closesocket(S1); Con cl usi on In th is exam ple, th e m essage “ Size of th e received buffer was 21 bytes” is prin ted to th e player buffer win dow. Caut ion: When using this method instead of the DO_WSK_Expect(), verify that you receive the correct information before moving on to the next function in your script. Using Local Datapools within a Winsock Script You can use dyn am ic dat a in your script by readin g data from a datapool file. However, datapool files m ust be in an ASCII strin g, an d n ot all dyn am ic data are i n th is form at. For exam pl e, wh en th e strin g “ \ 121\ 101\ 114\ 157\ 141\ 144” appears in a datapool file an d is read in usin g a on e of th e dat apool fun ction s, you receive \ \ 121\ \ 101\ \ 114\ \ 157\ \ 141\ \ 144 as th e output. You can en sure th at th e output strin g you receive is accurate by usin g th e OctalToCh ar() to con vert an y octal sequen ces in to th eir bin ary represen tation . In th is sam ple script, th e strin g “ \ 121\ 101\ 114\ 157\ 141\ 144” is read in from a local dat apool file an d con verted to its bin ary represen t ation . Th e required code is sh own in bold. Sam pl e Scri pt //This is used as an easy to remember descriptor for the datapool file. #define DP1 1/* Identifier for a datapool file*/ /* Declare Variables */ //Variable declared to store the local datapool record. char temp[40]; … //Opens the datapool file OPEN_DATA_POOL("datapool.dat", DP1, TRUE) BEGIN_TRANSACTION(); //Reads a row of data in from the datapool file that was opened above READ_DATA_RECORD(DP1); … DO_WSK_Socket(S1, AF_INET, SOCK_STREAM, IPPROTO_IP); DO_WSK_Bind(S1, ANY_ADDR, ANY_PORT); 191 Usin g th e Player, Script Developm en t W orkben ch , an d An alyze DO_WSK_Setsockopt(S1, SOL_SOCKET, SO_OOBINLINE, 1); //Read the first column from the local datapool row that was //returned when the READ_DATA_RECORD () was called. strcpy(temp, GET_DATA_FIELD(DP1, 1)); //used to convert octal strings to their binary format OctalToChar(temp); //The script is now setup to send the data that was read in from the //local datapool file instead of the hard coded values that were captured. DO_WSK_Send(S1,temp); //Below is the original send that was captured. //DO_WSK_Send(S1,”\121\101\122\165\156”); DO_WSK_Closesocket(S1); Con cl usi on In th is exam ple, th e DO_W SK_Sen d() sen ds th e oct al represen tation for th e strin g “ QALoad” , “ “ \ 121\ 101\ 114\ 157\ 141\ 144” , to th e server. Winsock Script Samples Sam pl e: H an dl i n g W i n sock Con n ect i on Probl em s Th e followin g script sn ippet sh ows an exam ple of h ow to h an dle con n ection problem s. Th e code in bold sh ows h ow you can lim it th e retires an d turn off th e abort flag. Sam ple Script Sn ippet … /* Declare Variables */ //Declared nNumRetries to keep track of the number of retry attempts that are made int nNumRetries = 0; //Declared “ret” to store the return code from DO_WSK_Connect() int ret = -1; … BEGIN_TRANSACTION(); DO_WSK_Socket(S2, AF_INET, SOCK_STREAM, IPPROTO_TCP); //In order to handle the failure for the DO_WSK_Connect the script needs to // turn off the abort on error flag. After the connection is made the flag // should be turned back on. s_info->bAbortOnError = 0; //The example below will try to make a connection to the remote application, // and if it fails it will repeat the attempt up to 5 times. while( ret = -1 && nNumRetries < 5) { //Attempts to connect to the remote application. ret = DO_WSK_Connect(S2, "10.4.26.24", 123, AF_INET); if(ret == -1) { //pause between connection attempts DO_MSLEEP(500); //increment the counter for the number of retry attempts. 192 QALoad On lin e Help nNumRetries++; } } //turning the abort flag back on. s_info->bAbortOnError = 1; //If the max number of retries has been met then this virtual user should fail. if(nNumRetries == 5) RR__FailedMsg(s_info,"ERROR: Max number of connection retries has been reached"); ... DO_WSK_Closesocket(S2); WWW Streaming Media Support QALoad in cludes support for audio an d video down load testin g of both W in dows M edi a Player an d RealOn e Player an d th eir support ed m edia form ats th rough a W W W session . W h en stream in g m edia con version is en abled an d you record a tran saction t h at calls stream in g m edia, an addition al com m an d th at requests th e m edia is in serted in to your script . You do n ot h ave to listen to or view th e en tire m edi a you are requestin g. You sim ply n eed to record its URL an d en sure th at th e appropriate m edi a player is in stalled on th e Player m ach in es th at plays back th e script. At run tim e, th e script in vokes your m edia player an d requests th e stream in g m edia resource. Stream in g m edia th rough a firewall or proxy server is n ot supported. QALoad's stream in g m edi a support in cludes th e foll owin g m edia player(s). Th e appropriate m edia pl ayer m ust be in stalled on th e m ach in e you are recordin g from as well as an y QALoad Player m ach in e th at will be executin g th e script. ! ! RealOne Player — The media download is initiated by requesting a file that is a data type supported by the RealOne Player. Supported data types are RealAudio, RealVideo, RealText, RealPix, and SMIL. As a result, the DownloadMediaRP command will be inserted into the script at the appropriate point. At runtime, this command initiates and waits for completion of the download. RealOne Player scripts must be executed as process-based scripts. Windows Media Player — The media download is initiated by downloading a file with a content type of (audio|video)/(x-ms-asf|s-ms-asf) in the browser. Currently, only .asx files are supported. As a result, the DownloadMediaFromASX command is inserted into the script at the appropriate point. Not e: QALoad does not support scripts that have both RealNetworks media and Windows Media in the same script. To test both types in a single load test, use a different script for each type. Please n ote th at asyn ch ron ous calls m ay n ot be pl ayed back exactly as th ey were recorded. For exam ple, if you click on a lin k in th e browser wh ile recordin g wh ile th e m edia is playin g, durin g replay th at lin k is n ot requested un til th e m edia clip h as fin ish ed bein g processed. How do I con figure QALoad to process stream in g m edia? Creating a Visual Navigator Script Usin g th e Script Developm en t W orkben ch , you can quickly an d easily record a n ew Visual Navigator Script How? 193 Usin g th e Player, Script Developm en t W orkben ch , an d An alyze About User Events W i t h out User Even t s QALoad relies on th e traffic th at it captures from an d to clien t application s. It uses th is traffic to in fer wh at user action s an d even ts triggered th e traffic in order to duplicat e th e activity durin g replay. In som e situation s, th e correct in feren ce can n ot be m ade from th e even t th at triggered th e browser traffic. For exam ple, asyn ch ron ous traffic occurrin g in th e AJAX m odel can n ot be in ferred from th e origin atin g action . Addition ally, th e in ability to determ in e th e user acti on th at caused th e traffic som etim es results in recorded session activity t h at differs from th e origin al wh en replayed. For exam ple, som etim es th e user action s h ave Javascri pt code associated with th em , wh ich can m odify th e n ext request. Also, th e in ability to fin d th e user action can cause th e Javascript code to be executed in correctly or n ot at all. In th ese cases, th e user m ust m odify th e recorded session (script ) in form at ion to correct th ese in accuracies. W i t h User Even t s Th e in clusion of user even t capture provi des a bett er determ in ation of even t triggers an d user action s. Scripts gen erated usin g even t in form ation from th e capture resem ble th e user action s durin g capture tim e. Th is results in a m ore con sisten t replay of th e origin al session . For exam ple, wh en a user clicks on a li n k or button , th e click is captured an d placed in th e capture file with th e page wh ere it occurred. Th is in form ation in th e capture is used to gen erate th e action in th e script rath er th an th e altern ate m eth od of in terpretin g th e traffic from an d to th e clien t application . Th is sh ould result in scripts th at m ore closely m atch th e user action s at capture tim e. To capture with user even ts, select th e user even t option s in Gen eral W W W Con version Option s an d W W W Recordin g Option s. Record Options Usi n g t h e W W W Record Opt i on s Use th e W W W Record Option s to determ in e h ow QALoad h an dles captures web page tran saction dat a. To set t h e W W W r ecor d i n g op t i on s: 1. With a WWW session open, click Options>Record. The Session Options dialog box appears with the WWW Record Options highlighted in the tree view control. The WWW Record Options dialog box appears on the right. 2. Select the appropriate options, then do one of the following: ! 194 Click OK to save th e selection s an d return to th e W W W session screen . QALoad On lin e Help ! 3. Click Advan ced Record Opt i on s in th e tree view con trol. Th e Advan ced Recordin g Option s dialog box appears on th e righ t. Select the appropriate options. 4. Click OK. The basic record options and the advanced options are saved and you return to the WWW session screen. Con f i guri n g a W eb Brow ser (W W W ) Before you record th e W W W requests your W eb browser m akes, you m ust con figure th e browser to use QALoad’s proxy server. To con f i g ur e a W eb b r ow ser : 1. Start your Web browser. 2. Specify proxy settings: 3. ! In th e field design ated to specify th e address of th e proxy server, en ter th e m ach in e n am e wh ere QALoad Scri pt Developm en t W orkben ch is i n stalled. ! In th e Port field, en ter th e port(s) th at you specified on th e Script Developm en t W orkben ch ’s W W W Record Option s wi zard (Capt ure Port s fields). Click OK. Recordi n g St ream i n g M edi a To r ecor d st r eam i n g m ed i a: 1. With a WWW session open in the Script Development Workbench, choose Options>Convert from the menu. 2. Under WWW Convert Options, select General. 3. Under Other on the General options page, select the Streaming Media option, then click OK. W h en you record your tran saction , m ake sure you i n voke your m edia pl ayer t h rough clickin g a lin k or typin g a URL in your web browser. QALoad records t h e URL from your web browser; th erefore, you m ust use your browser t o access your m edia file or else th e URL will n ot be recorded in your script. Recordi n g a Vi sual Navi gat or Scri pt You record a Visual Navigator script th e sam e way you record a regular QALoad script — by settin g opti on s to determ in e th e beh avior of QALoad wh ile recordin g, an d th en clickin g th rough a tran saction to m im ic a user. QALoad will record all sen t an d received HTTP an d SSL calls usin g th e Script Developm en t W orkben ch 's W eb proxy an d write th e activity t o a capture file. After recordin g, th e capture file m ust be con verted t o an editable, C++-based script. Your capture file dat a turn s in to a Visual Navigator Script th at allows you to view th e actual W eb pages you recorded in a browser-like in terface, wh ere you can m an ipulate t h e tran saction an d easily i n sert variable in form ation in to your script with out directly editin g a lin e of code. It is possible to save th e script as an oth er n am e t o view th e code in stead of t h e Visual Navigator script . By doin g th is, th e code i s separated from th e Visual Navigator script. An y ch an ges m ade in th e code wil l n ot appear in th e Visual Navigator script just as an y ch an ges m ade in th e Visual Navigat or script will n ot appear in th e saved as code. To r ecor d a Vi sual Scr i p t : 195 Usin g th e Player, Script Developm en t W orkben ch , an d An alyze If you are run n in g your application on W in dows X P SP2, Com puware recom m en ds you turn off th e 'popup blocker' feature before recordin g a tran saction . Th e feature can be disabled via th e browser win dow's Tool s m en u in I n t ern et Opt i on s>Pri vacy. 1. Open a WWW session in the Script Development Workbench. 2. Click Options>Record. The WWW Record Options dialog box opens. Set any relevant options. 3. Click OK. 4. For convenience, set conversion options now also. (You can set conversion options after recording your transaction, if you prefer, or even change pre-set options at any time after recording and then re-convert the capture file to apply the changes.): a. Click Options>Convert. The Universal Convert Options dialog box opens. b. Set any applicable options. c. Click OK. 5. From the toolbar, click the Start Record button. QALoad launches your application and any proxies, if necessary, and begins recording calls. 6. Record the transaction. 7. When you are finished, click the Stop Record button. You will be prompted to save your capture file. By default, capture files (.cap) are saved in the directory QALoad\Middlewares\WWW\captures. 8. If you previously set options to prompt automatic conversion, your capture file will be converted to a Visual Script and will open automatically in the editor. For more information about setting up automatic conversion, see Configuring the Script Development Workbench. If n ot, you will be prom pt ed to save an d n am e your file. W h en you are fin ish ed, click OK. 9. Click the Script Development Workbench's Captures tab and locate the capture file you just saved. 10. Right-click the file and choose Convert. QALoad will convert your capture file to a Visual Navigator script and open it in the editor. Convert Options Usi n g t h e W W W Con ver t Opt i on s Use th e W W W Con vert Option s to con trol h ow QALoad produces scripts from recorded tran saction data. You can also ch oose th e con vert an d playback m ode for W W W m iddleware session s. Th e con vert an d playback m ode determ in es th e am oun t of m em ory an d processor QALoad uses durin g replay. To sel ect t h e p r ocessi n g m od e: 1. With the WWW session open, click Options>Convert. The Session Options dialog box displays. 2. Click WWW Convert Options in the tree view control. The WWW Convert Options dialog box appears on the right side of the screen. 3. Select the convert mode to use for the WWW middleware sessions. You can choose: ! HTM L M ode - to reduce t h e am oun t of scriptin g. ! HTTP M ode - to con trol processor an d m em ory usage. Tip: Compuware recommends that you use the WWW Convert Options dialog box to convert between modes, rather than manually edit the script. 4. Click each of the following to display the associated dialog box and select the appropriate options: Not e: The options available for Parsing depend on whether you select HTTP or HTML mode. ! 196 Parsin g QALoad On lin e Help 5. ! Verification ! Cach in g ! Traffic Filters ! Rule Filters ! Con n ection Settin gs ! Con ten t Type Han dlin g ! Gen eral ! Siebel Click OK to save the settings and return to the main WWW session screen. Caut ion: Once you convert a script using HTTP mode or HTML mode, you must reconvert the script to change the convert mode. This is necessary so that the convert and replay methods match. Failure to change modes by reconverting the script can cause the script to replay incorrectly. Usi n g t h e W W W Pl ayback Opt i on s Th e W W W Playback opti on s you select affect th e en tire script. To sel ect t h e W W W Pl ayb ack Op t i on s: 1. With a script open in a WWW session, double-click Playback Options in the tree view. The available session options display in the tree view. 2. Double-click WWW Playback Options in the tree view. 3. Click each playback option in the tree view to display the associated dialog box on the right. 4. Click each of the following to display the associated dialog box and select the appropriate options: Not e: The options displayed for Parsing depend on the mode you select in the WWW Convert Options dialog box. ! Parsin g (HTM L M ode or HTM L M ode) ! Cach in g ! Traffic Filters ! Con n ection Settin gs ! Proxy ! Gen eral ! Siebel Com pari son of H TTP M ode an d H TM L M ode Ch oosin g HTM L m ode or HTTP m ode for scri pt con version en ables you to con trol h ow m uch autom at ed processin g is perform ed durin g test execution . Typical HTM L processin g uses m ore processor cycl es an d m em ory durin g test execution , but requires less scriptin g. HTTP processin g in structs QALoad to disable m ost of its autom atic HTM L h an dlin g en gin e durin g replay, an d it also affects h ow th e script is gen erated. 197 Usin g th e Player, Script Developm en t W orkben ch , an d An alyze Feat ures Av ai l abl e f or Sel ect i on H TTP M ode H TM L M ode Con vert Opt i on s Page Parsin g Yes No (Always On ) Parsin g Dyn am ic Cookie Han dlin g Yes No (Always On ) Parsin g Dyn am ic Redirects Yes No (Always On ) Parsin g Auth en tication Yes Yes N/ A HTTPS Yes Yes N/ A Extracts Yes Yes N/ A Title Verification Yes Yes Verification Con ten t Ch eck Yes Yes Con ten t Type Han dlin g Ch un ked Data Yes Yes N/ A Stream in g M edia Yes Yes Gen eral Traffic Filters Yes Yes Traffic Filters Param eterization Rules Yes Yes Rule Filters Allow JavaScript Execution Yes No Parsin g Click_On s No Yes N/ A Fill In Form s No Yes N/ A Cach in g Yes Yes Cach in g Expert User Yes Yes N/ A Un iversal M ode Yes Yes N/ A Represen t CJK as Octal Ch aracters Yes Yes Gen eral UTF-8 Yes Yes N/ A XM L Requests Yes Yes Gen eral M eta Refresh Yes Yes Gen eral Autom atic Sub-request Processin g Yes No (Always On ) Parsin g Set JavaScri pt Execution No Yes Parsin g 198 QALoad On lin e Help Level Set JavaScri pt Loop Tim eout Yes Yes Parsin g M an ually Select Subrequests Yes Yes Parsin g Persisten t Con n ection s Durin g Repl ay Yes Yes Con n ection Settin gs Graceful Socket Sh utdown Yes Yes Con n ection Settin gs Baud Rate Em ulation Yes Yes Con n ection Settin gs Reuse SSL Session ID Yes Yes Con n ection Settin gs Siebel Support Yes Yes Siebel An ch or an d Form Extraction Yes Yes Gen eral Strip All Cookies Yes Yes Gen eral Usi n g H TM L M ode HTM L m ode con verts an d replays scripts usin g full Docum en t Object M odel (DOM ) an d JavaScript en gi n e. HTM L docum en ts are fully parsed in HTM L m ode. JavaScri pt can be executed at differen t levels, in cludi n g NONE, LIM ITED, an d FULL. Because HTM L m ode uses full DOM an d JavaScri pt en gin e, it uses m ore processor cycles an d m em ory durin g test execution , but requires less scriptin g. Use HTM L m ode to create load testin g scripts quickl y an d easily, an d for load tests requirin g fewer virtual users (VU) run n in g on an y player m ach in e. You can use HTM L m ode to create scripts for h eavier load testin g, but th e scripts m ay require m ore pl ayer m ach in es on wh ich to run th e VUs. Con sideration s ! Javascript - Javascript can be executed at different levels, including None, Limited, and Full. ! CPU usage - Uses more processor cycles during test execution ! Memory - Uses more memory during test execution ! Parameterization - Requires less scripting and less parameterization than HTTP mode because QALoad is better able to infer user actions using its DOM. Use th is m ode if you are: ! testing a web site that uses complex JavaScript with complex HTML pages that contains a significant number of links, tables or HTML objects ! a novice tester and wish to work with scripts that more closely resemble the user's interactions with the application under test ! only testing with a low number of virtual users or have significant hardware resources available for load testing execution 199 Usin g th e Player, Script Developm en t W orkben ch , an d An alyze Tip: Compuware recommends that you use the WWW Convert Options dialog box to convert between modes, rather than edit the script manually. Sam ple Script Th e followin g sh ows a sam ple of a scri pt with HTM L m ode selected: … … SET_SCRIPT_LANGUAGE(SLID_English); DO_WWWInitialize(s_info, HTML_MODE); ... ... BEGIN_TRANSACTION(); … … Usi n g H TTP M ode HTTP m ode con verts an d replays scripts usin g a sim plified HTM L parser an d lim ited JavaScript en gin e. You can con trol th e level of HTM L docum en t parsin g, an d wh eth er JavaScript sh ould be executed. HTTP m ode does less processin g durin g replay an d uses less m em ory because it does n ot create Docum en t Object M odels (DOM ) for each processed HTM L page. HTTP m ode m ay require m ore param eterization th an HTM L m ode. Durin g con version , action s are represen ted in th e visual script by NavigateTo or PostTo tree item s in stead of ClickOn or Fill-In Form tree item s. Th is m ean s th at any dyn am ic variables passed from reply t o request m ust be m an aged in th e script. Use th e Variable Replacem en t W izard to develop rules to fin d param eters in your script an d replace th em with variables. Con sideration s ! ! JavaScript — Because JavaScript execution is limited, some scripts may require customization to emulate Javascript operations not executed by QALoad. Automatic Sub-requests — When Parsing is selected, automatic Sub-requests are enabled. When not enabled, QALoad executes the same sub-requests made during the capture phase (instead of parsing the server responses). This makes playback highly scalable, but very dynamic web applications may require additional scripting. All subrequests and additional subrequests are selected by default during the convert. ! Functions — Converted scripts use only the Navigate_To() and Post_To functions; the Click_On() function is disabled. ! Parameterization — May require more parameterization than HTML mode. ! Memory and CPU Usage — Does less processing and uses less memory during replay. ! Dynamic variables — Dynamic variables passed from reply to request must be managed in the script. Use th is m ode if you are: 200 ! testing a web site that makes little use of Javascript and creates pages with few HTML options on them ! an experienced load tester and wish to work with scripts that more closely resemble the applications HTTP interactions with the server under test ! you are testing for high virtual user throughput or simulating high numbers of concurrent virtual users from limited hardware resources QALoad On lin e Help Tip: Compuware recommends that you use the WWW Convert Options dialog box to convert between modes, rather than edit the script manually. Sam ple Script Th e followin g sh ows a sam ple script with HTTP m ode selected: … … SET_SCRIPT_LANGUAGE(SLID_English); DO_WWWInitialize(s_info, HTTP_MODE); ... ... BEGIN_TRANSACTION(); ... ... Usi n g t h e Veri f i cat i on Opt i on En ables docum en t title verification for m ain requests of type HTM L or TEXT. Con sideration s Th ere are th ree supported m eth ods for verifyin g a docum en t title: search for t h e En t i re Docum en t Ti t l e, th e Pref i x of th e docum en t title, or th e Suf f i x of t h e docum en t title. Use th is option to: ! Create scripts that verify characters contained in document titles. ! Detect and handle error messages that are returned in an HTML page. Script Sam ples Th e followin g are exam pl es of a search for th e En tire docum en t title. Exam ple W eb Page Script Exam ples with Opti on Selected Script Exam ples with Opti on Not Selected Example W eb Page <HTML> <HEAD> <title>Welcome to The Main Page</title> </head> <body> <p> <A href="index.htm">WWW Capture Examples</A> (relative link) </p> </body> </HTML> 201 Usin g th e Player, Script Developm en t W orkben ch , an d An alyze Script Example with the Document Title Verification Option Selected Th e followin g exam ple h as th e Docum en t Ti t l e Veri f i cat i on ch eck box select ed an d com pares by th e en tire docum en t title. ... ... DO_Http("GET http://www.host.com/ HTTP/1.0\r\n\r\n"); DO_VerifyDocTitle("Welcome to The Main Page", TITLE); ... ... Script Example that Matches the First 5 Characters Th e followin g exam ple com pares by prefix. ... ... DO_Http("GET http://www.host.com/ HTTP/1.0\r\n\r\n"); DO_VerifyDocTitle("Welco", PREFIX); DO_SetTransactionCleanup(); ... ... Script Example that Matches the Last 4 Characters Th e followin g exam ple com pares by suffix. ... ... DO_Http("GET http://www.host.com/ HTTP/1.0\r\n\r\n"); DO_VerifyDocTitle("Page", SUFFIX); DO_SetTransactionCleanup(); ... ... Document Title Verification – No Th e followin g exam ple h as th e Docum en t Ti t l e Veri f i cat i on ch eck box cleared. ... ... DO_Http("GET http://www.host.com/ HTTP/1.0\r\n\r\n"); DO_SetTransactionCleanup(); ... ... About Cach i n g HTTP protocol h as two cach in g m odels, wh ich browsers im plem en t. Ex pi rat i on m odel : Th e W eb server sen ds in form ation in th e reply h eader askin g th e clien t to save th e reply in th e cach e for a particular duration . Th ere is n o n eed to sen d request for th is resource again un l ess th e duration h as expired. Val i dat i on m odel : A request is sen t to th e W eb server to ch eck th e validity of th e cach ed resource. Th e resource is saved in th e cach e, but a request is sen t by th e clien t to th e server to ch eck if th is cach e is valid. QALoad supports th e validation m odels, wh ereas, it sim ulates th e expiration m odel. 202 QALoad On lin e Help Sin ce th e validation m odel sen ds a request each tim e th e site is accessed, it beh aves like a first tim e user. Th e expiration m odel m i m ics a return in g user because of it's ability to store th e reply in th e cach e. To run a script as if it were a first tim e users, use th e Cach in g option s. To run a script as if it were a return in g user, use th e n on -cach eable opt ion in th e Parsin g option s dialog box. Usi n g t h e Cach i n g Opt i on W h en a cach in g option is en abled, requested im ages, .css, or .js files are cach ed at playback tim e. Con sideration s ! Types of documents that QALoad caches on the virtual user during replay are: None, Images, CSS, JS, and Images, or All. ! The caching level names denote the types of documents that QALoad caches on the virtual user during replay. ! If these documents are referenced after the virtual user has already requested and received the document once, they are not requested from the target server again by that virtual user. Use th is option to: Select th e type of cach in g you would like th e W W W replay en gin e to use durin g playback. Script Sam ples Caching Option: None Set(EVERY_REQUEST, CACHING, NO_CACHING); Caching Option: Images Set(EVERY_REQUEST, CACHING, IMAGES); Caching Option: CSS, JS, and Images Set(EVERY_REQUEST, CACHING, IMAGES_JS_AND_CSS); Caching Option: All Set(EVERY_REQUEST, CACHING, ALL); Usi n g Traf f i c Fi l t ers Traffic Filters allows you to filter out certain requests wh ile playin g back a script. Con sideration s Traffic filters do n ot affect XM L requests th at are written to th e Visual Navigator tree wh en a capture fil e is con verted. Use th is option to: ! Determine which traffic should be: ! in cluded in your scri pt blocked from your script con verted to subrequests in th e script Also block specific substrings in the path of URLs, such as .jpg to block all JPEG images. 203 Usin g th e Player, Script Developm en t W orkben ch , an d An alyze Script Sam ples Script Example with a Traffic Filter Set In th e followin g exam ple, a traffic filter h as been set to exclude requests with URLs th at con tain th e strin g “ www.h ost.com ” . ... ... DO_InitHttp(s_info); ... ... /* Exclude requests with URLs containing */ DO_BlockRequestsFrom("www.host.com;"); ... ... BEGIN_TRANSACTION(); ... ... DO_Http("GET http://rm.host.com:8099/ramgen/realmp3.mp3 " "HTTP/1.0\r\n" "Referer: http://www.host.com/index.htm\r\n\r\n"); ... ... END_TRANSACTION(); ... ... Script Example without a Traffic Filter Set Th e followin g exam ple does n ot use traffic filters. ... ... DO_InitHttp(s_info); ... ... BEGIN_TRANSACTION(); ... ... DO_Http("GET http://www.host.com/ HTTP/1.0\r\n\r\n"); DO_VerifyDocTitle("Welcome to The Main Page", TITLE); DO_Http("GET http://www.host.com/index.htm HTTP/ 1.0\r\n\r\n"); DO_VerifyDocTitle(" QALoad WWW Capture Examples", TITLE); DO_Http("GET http://rm.host.com:8099/ramgen/realmp3.mp3 HTTP/1.0\r\n\r\n"); ... ... END_TRANSACTION(); ... ... 204 QALoad On lin e Help Usi n g Rul e Fi l t ers Selects th e Rule Folders th at are scan n ed for m at ch in g rules wh en con vertin g a W W W capture file in to a Visual Navigator script. Con sideration s ! Rules are sets of parameters that are established to substitute certain pre-established variables for system generated variables. ! Parameters and Rules are established using the Variable Replacement Wizard. Use th is option to: Con trol th e rules QALoad uses durin g th e con vert process to h elp param eterize scripts. Overvi ew — Best Pr act i ces Sam pl e Scri pt s Th is section sh ows sam pl es of h ow th e W W W con vert option s appear in a script. Com puware recom m en ds th at you use th e W W W Con vert Option s dial og box to con vert between m odes, rath er th an edit th e script m an ually. On ce you con vert a script usin g HTTP m ode or HTM L m ode, you m ust recon vert th e script to ch an ge th e con vert m ode. Th is is n ecessary so th at th e con vert an d repl ay m eth ods m at ch . Failure to ch an ge m odes by recon vertin g th e script can cause th e script to replay in correctly. En abl e Si ebel Support Opt i on Th e En able Siebel Support option allows QALoad to iden tify if th e capture file to be con verted is a Siebel file. Con sideration s ! This option results in adding a new command in the script called SiebelInitialize, which identifies the script as a Siebel script. ! Two additional commands are also inserted into the script: SiebelUpdatePage and GetSiebelValue. These two commands are only added if there were HTML responses in the capture file, which resulted in generation of Siebel variables. ! When the convert process is complete, all HTML pages with Siebel variables attached to them at the convert process are output into the script file so playback can retrieve values from the Siebel Library. Use th is option to: Record, m odify, an d pl ay back scripts for th e purpose of perform an ce testin g again st Siebel application s an d en viron m en ts. Script Sam ples Script Example with the Enable Siebel Support Option Selected Th e followin g exam ple h as th e En abl e Si ebel Support ch eck box select ed. CLoadString CLoadString CLoadString CLoadString CLoadString CLoadString CLoadString __Siebel_1 __Siebel_2 __Siebel_3 __Siebel_4 __Siebel_5 __Siebel_6 __Siebel_7 = = = = = = = "VRId-3"; ""; "SWERowId0=1-7BZ"; ""; "1-136"; "SWERowId0=1-7BZ"; ""; 205 Usin g th e Player, Script Developm en t W orkben ch , an d An alyze CLoadString __Siebel_8 = "1-1UY"; CLoadString __Siebel_9 = ""; CLoadString __Siebel_10 = "1-1UY"; CLoadString __Siebel_11 = ""; CLoadString __Siebel_12 = "1-1UY"; … … // WWW General Options Set(EVERY_REQUEST, HTTP_VERSION, "1.1"); SiebelInitialize(); // Siebel support is enabled …. …. Post_To("http://dtw-siebel78/callcenter_enu/start.swe"); // Get the Siebel parameters from this page SiebelUpdatePage(); __Siebel_5 = GetSiebelValue(" S_BC3_S09_R06_FID "); __Siebel_8 = GetSiebelValue(" S_BC3_S09_R05_FID "); __Siebel_10 = GetSiebelValue(" S_BC3_S09_R05_FID "); __Siebel_12 = GetSiebelValue(" S_BC3_S09_R05_FID "); …. …. // Original string was: // "1-136" // Variablized string is: // "{$ VAR:Siebel-5 $}" // Set(NEXT_REQUEST_ONLY, POST_DATA, "SWERowId", __Siebel_5); Set(NEXT_REQUEST_ONLY, POST_DATA, "SWEC", "7"); Set(NEXT_REQUEST_ONLY, POST_DATA, "SWEMethod", "PositionOnRow"); Set(NEXT_REQUEST_ONLY, POST_DATA, "SWEReqRowId", "1"); Set(NEXT_REQUEST_ONLY, POST_DATA, "SWERPC", "1"); Set(NEXT_REQUEST_ONLY, POST_DATA, "SWEApplet", "Contact Assoc Applet"); Set(NEXT_REQUEST_ONLY, POST_DATA, "SWEView", "Account Detail - Contacts View"); Set(NEXT_REQUEST_ONLY, POST_DATA, "SWECmd", "InvokeMethod"); Set(NEXT_REQUEST_ONLY, POST_DATA, "SWESP", "false"); // Original string was: // "1156341790828" // Variablized string is: // "{$ DATETIME:MS1970 $}" // Set(NEXT_REQUEST_ONLY, POST_DATA, "SWETS", TIME_SINCE_1970("milliseconds")); Set(NEXT_REQUEST_ONLY, POST_DATA, "SWEIgnoreCtrlShift", "0"); Set(NEXT_REQUEST_ONLY, POST_DATA, "SWEP", "1B_Account Contact List Applet9_NewRecord0_0_1_7"); // Original string was: // "SWERowId0=1-7BZ" // Variablized string is: // "{$ VAR:Siebel-7 $}" // //-- Update the Calculation Variable Siebel-7 -// // Variablized string is: // "SWERowId0={$ VAR: Siebel-6 $}" // __Siebel_7 = "SWERowId0="; __Siebel_7 += __Siebel_6; __Siebel_7 = __Siebel_7; Set(NEXT_REQUEST_ONLY, POST_DATA, "SWERowIds", __Siebel_7); Set(NEXT_REQUEST_ONLY, CHECKPOINT_NAME, "Page 20 - http://dtw-siebel78/callcenter"); Post_To("http://dtw-siebel78/callcenter_enu/start.swe"); DO_SLEEP(1); 206 QALoad On lin e Help Script Example with the Enable Siebel Support Option Not Selected Th e followin g exam ple h as th e En abl e Si ebel Support ch eck box cleared. Siebel_off extern "C" int rhobot_script(PLAYER_INFO* s_info) { // Declare Variables // SET_ABORT_FUNCTION(abort_function); DEFINE_TRANS_TYPE("cap_siebel_on.cpp"); SET_SCRIPT_LANGUAGE(SLID_English); DO_InitHttp(s_info); // Playback Options // Set(EVERY_REQUEST, PROXY_MODE, PROXY_AUTOMATIC_CONFIGURATION); Set(EVERY_REQUEST, PROXY_SCRIPT, "http://proxyconf.compuware.com"); Set(EVERY_REQUEST, HTTP_VERSION, "1.1"); Set(EVERY_REQUEST, PROXY_HTTP_VERSION, "1.0"); Set(EVERY_REQUEST, JAVASCRIPT_LEVEL, FULL); Set(EVERY_REQUEST, USER_PATIENCE, 120); // Maximum time to wait for an HTTP Reply Set(EVERY_REQUEST, CONNECTION_RETRIES, 4); // maximum attempts to connect Set(EVERY_REQUEST, BROWSER_THREADS, 2); // total browser threads to simulate Set(EVERY_REQUEST, CACHING, NO_CACHING); // Enable/Disable cache Set(EVERY_REQUEST, REUSE_CONNECTION, TRUE); // maintain socket connection if possible Set(EVERY_REQUEST, REUSE_SECURE_SESSION, TRUE); .. .. .. Navigate_To("http://dtw-siebel78/callcenter_enu/start.swe"); //--------- REQUEST # 6 --------// // current page url is http://dtwsiebel78/callcenter_enu/start.swe?SWECmd=GetCachedFrame&SWEACn=..... // Set(NEXT_REQUEST_ONLY, HEADER, "Accept", "image/gif, image/x-xbitmap, image/jpeg" ", image/pjpeg, application/x-shockwave-flash, */*"); Set(NEXT_REQUEST_ONLY, POST_DATA, "s_2_1_57_0", "Business"); Set(NEXT_REQUEST_ONLY, POST_DATA, "s_2_1_27_0", "sdfasdf"); Set(NEXT_REQUEST_ONLY, POST_DATA, "s_2_1_28_0", "sfdasfd"); } Represen t CJK as Oct al Ch aract ers W h en th is option is selected, th e double-byte ch aracters used for Ch in ese, Japan ese, an d Korean (CJK) scripts are con verted in to octal form at. Con sideration s ! Since CJK characters use Double Byte Character Sets (DBCS), encoding must be enabled for a capture with CJK characters, so that the double-byte characters can be viewed in a legible format. ! Data stays in encoded format throughout the load test: from capture, through convert and replay, to the analysis of the timing file. 207 Usin g th e Player, Script Developm en t W orkben ch , an d An alyze Use th is option to: ! En able th e en codin g of captured data from web application s con tain in g Double Byte Ch aracter Sets (DBCS) such as Ch in ese, Japan ese, or Korean . ! En code all n ative ch aracters wh en n ative ch aracter support can n ot be used. Sam ple Scripts Example W eb Page <html> <head> <title> </title> <meta http-equiv="Content-type" content="text/html; charset=euc-kr"> <meta http-equiv="Cache-Control" content="no-cache"> <meta http-equiv="Pragma" content="no-cache"> <meta http-equiv="Expires" content="Wed, 04 Jul 1973 16:00:00 GMT"> <!--CSS--> <style type='text/css'> </style> <!--/CSS--> </head> <body onload="document.search.p.focus();" topmargin=8> ... ... </body> </html> Script Example with the Represent CJK as Octal Characters Option Selected Th e followin g exam ple h as th e Represen t CJK as Oct al Ch aract ers ch eck box selected. ... ... /* Request: 1 */ DO_Http("GET http://kr.yahoo.com/ HTTP/1.0\r\n\r\n"); DO_VerifyDocTitle("\276\337\310\304!\304\332\270\256\276\306", TITLE); ... ... Script Example with the Represent CJK as Octal Characters Option Not Selected Th e followin g exam ple h as th e Represen t CJK as Oct al Ch aract ers ch eck box cleared. ... ... /* Request: 1 */ DO_Http("GET http://kr.yahoo.com/ HTTP/1.0\r\n\r\n"); DO_VerifyDocTitle(, TITLE); ... ... Par si n g Usin g th e Parsin g Option 208 QALoad On lin e Help W h en th e Page Parsin g option is selected on th e W W W Con vert Option s, QALoad perform s lim ited parsin g operation s on in com in g HTM L pages. Th is option on ly applies to HTTP m ode, an d is disabled i f HTM L m ode is selected as th e con vert m ode. You sh ould disable th is option if you fin d th at you n eed to fit m ore HTTP m ode virtual users on a sin gle player m ach in e. Disablin g th is option can decrease t h e processor usage required by a virtual user. Considerations ! When selected, limited parsing is performed on incoming HTML pages. ! Must be selected to enable the Allow Javascript execution option. ! Must be selected to enable the Automatically process sub-requests option. ! May increase processor usage required by a virtual user. Use this option to: ! En able execution of Javascript in HTTP m ode. ! En able autom atic sub-requestin g in HTTP m ode. ! En able docum en t verificat ion in HTTP m ode. Allow JavaScript Execution Th is option is on ly en abled wh en th e Parse Pages option is selected in HTTP con version m ode. QALoad executes JavaScript in repl ay as if th e LIM ITED JavaScript Execution Level is used. Sin ce JavaScript is always executed in HTM L m ode, th is option is disabled if HTM L m ode is selected as th e con vert m ode. Considerations ! The option to turn on or turn off JavaScript execution is available only in HTTP mode. JavaScript is always executed in HTML mode. ! When enabled, QALoad executes JavaScript at the Limited execution level. ! May decrease the amount of parameterization required for certain scripts. ! May increase the processor time required by a virtual user. Use this option to: Decrease th e am oun t of param eterization required. Autom atically Process Sub-requests in HTTP M ode W h en th is option is selected, QALoad does n ot in sert sub-requests (such as .jpg, .gif, .css, .js, etc.) directly in to th e script file, but autom atically m akes th ese requests durin g replay by parsin g th em out of th e HTM L pages. Th is option is on ly en abled wh en HTTP m ode is sel ected an d th e Parse Pages option is en abled. HTM L m ode always processes sub-requests autom atically. Considerations 209 Usin g th e Player, Script Developm en t W orkben ch , an d An alyze ! When this option is disabled, QALoad executes the same sub-requests made during the capture phase instead of parsing the server response. ! Very dynamic web applications may require additional scripting. ! All sub-requests and additional sub-requests are selected by default during convert. ! Enabling this option requires more processing during playback. Use this option to: ! Allow QALoad to manage sub-requests. ! Reduce the length of .cpp script files. ! Increase .cpp script file readability. Sample Script Example W eb Page <html> <head> <title>Page Of Subs</title> </head> <body> <p>The page of subrequests</p> <p>.<img border="0" src="win2000.gif" width="456" height="124"><img border="0" src="APACHE.GIF" width="259" height="32"><img border="0" src="banner.gif" width="470" height="64"><img border="0" src="COLORS.GIF" width="200" height="100"></p> </body> </html> Script Example with the Automatically Process Subrequests Option Selected In th e followin g exam ple, th e Aut om at i cal l y Process Subrequest s ch eck box is selected. ... ... BEGIN_TRANSACTION(); DO_AutomaticSubRequests(TRUE); ... ... DO_Http("GET http://www.host.com/subs.htm HTTP/1.0\r\n\r\n"); DO_VerifyDocTitle("Page Of Subs", TITLE); ... ... END_TRANSACTION(); ... ... Script Example with the Automatically Process Subrequests Option Not Selected In th e followin g exam ple, th e Aut om at i cal l y Process SubRequest s ch eck box is cleared. ... ... BEGIN_TRANSACTION(); ... ... DO_AutomaticSubRequests(FALSE); 210 QALoad On lin e Help ... ... DO_Http("GET http://www.host.com/subs.htm HTTP/1.0\r\n\r\n"); DO_VerifyDocTitle("Page Of Subs", TITLE); /* Request: 2 From: Page Of Subs */ DO_Http("GET http://www.host.com/win2000.gif HTTP/1.0\r\n\r\n"); /* Request: 3 From: Page Of Subs */ DO_Http("GET http://www.host.com/web.gif HTTP/1.0\r\n\r\n"); /* Request: 4 From: Page Of Subs */ DO_Http("GET http://www.host.com/APACHE.GIF HTTP/1.0\r\n\r\n"); /* Request: 5 From: Page Of Subs */ DO_Http("GET http://www.host.com/COLORS.GIF HTTP/1.0\r\n\r\n"); ... ... END_TRANSACTION(); ... ... Dyn am ic Redirect Han dlin g Selectin g th is option en ables th e QALoad repl ay en gin e to dyn am ically h an dle 3XX redirects. W h en a 3XX redirect page is return ed durin g replay, QALoad processes th e redirect an d requests th e redirected page as well. Th is option on ly applies to HTTP m ode, an d is disabled if HTM L m ode i s selected as th e con vert m ode. Considerations ! Th is option sh ould n orm ally on ly be disabled if you do n ot wan t th e script to follow 3XX redirects. ! Dynamic redirect handling does not handle JavaScript redirects. ! Dynamic redirect handling does not handle meta refresh redirects. Use this option to: ! Dynamically handle 3XX redirects. ! Process the redirect and also request the redirected page. Examples Con sider a W eb page with a lin k to 'Redirect ed W ebpage' (h ttp:/ / www.h ost.com / cgi-bin / dyn redir.exe). W h en th is lin k is clicked, th e server gen erates a 302 return value with a n ew redirected location of h ttp:/ / 172.22.24.39/ cgi-bin / aperl_8.pl. Script Example with the Dynamic Redirect Handling Option Selected W h en th is option is selected, th e script con tain s on ly th e request for h ttp:/ / www.h ost.com / cgibin / dyn redir.exe. Replay h an dles th e 302 return value an d calls h ttp:/ / 172.22.24.39/ cgi-bin / aperl_8.pl autom atically. Th e followin g exam ple h as th e Dyn am i c Redi rect H an dl i n g ch eck box selected. ... ... 211 Usin g th e Player, Script Developm en t W orkben ch , an d An alyze /* Declare Variables */ int i; char *Anchor[1]; ... ... for(i=0;i<1;i++) Anchor[i]=NULL; ... ... BEGIN_TRANSACTION(); ... ... DO_DynamicRedirectHandling(TRUE); ... ... DO_Http("GET http://www.host.com/index.htm HTTP/""1.0\r\n\r\n"); DO_VerifyDocTitle(" QALoad WWW Capture Examples", TITLE); ... ... DO_GetAnchorHREF( "Redirected Webpage", &Anchor[0]); ... ... DO_SetValue("Anchor000", Anchor[0]); DO_Http("GET {*Anchor000} HTTP/1.0\r\n\r\n"); DO_VerifyDocTitle("Successful Test of Dynamic Redirect Sample", TITLE); ... ... for(i=0; i<1; i++) { free(Anchor[i]); Anchor[i]=NULL; } END_TRANSACTION(); ... ... Script Example with the Dynamic Redirect Handling Option Not Selected In th is exam ple, th e script con tain s th e request for h ttp:/ / www.h ost.com / cgi-bin / dyn redir.exe as well as h ttp:/ / 172.22.24.39/ cgi-bin / aperl_8.pl. Th e followin g exam ple h as th e Dyn am i c Redi rect H an dl i n g ch eck box cleared. ... ... /* Declare Variables */ int i; char *Anchor[1]; ... ... for(i=0;i<1;i++) Anchor[i]=NULL; ... ... 212 QALoad On lin e Help BEGIN_TRANSACTION(); DO_DynamicRedirectHandling(FALSE); ... ... DO_Http("GET http://www.host.com/index.htm HTTP/1.0\r\n\r\n"); DO_VerifyDocTitle(" QALoad WWW Capture Examples", TITLE); DO_GetAnchorHREF( "Redirected Webpage", &Anchor[0]); DO_SetValue("Anchor000", Anchor[0]); DO_Http("GET {*Anchor000} HTTP/1.0\r\n\r\n"); DO_VerifyDocTitle("Document Moved", TITLE); DO_Http("GET http://www.host.com/redir/frm.pl HTTP/1.0\r\n\r\n"); DO_VerifyDocTitle("Successful Test of Dynamic Redirect Sample", TITLE); DO_SetTransactionCleanup(); /* Clear up some internal storage used for DO_SetValue() */ DO_HttpCleanup(); for(i=0; i<1; i++) { free(Anchor[i]); Anchor[i]=NULL; } END_TRANSACTION(); ... ... Dyn am ic Cookie Han dlin g W h en you select th is opt ion , QALoad autom atically processes dyn am ic cookies durin g replay. Th is opt ion on ly applies to HTTP m ode, an d is disabled if HTM L m ode is selected as th e con vert m ode. QALoad always h an dles dyn am ic cookies in HTM L m ode. Considerations ! Not selectin g th is option h ard codes cookie values from th e capture file in to th e script file. ! When this option is not selected in HTTP mode, QALoad places Set(NEXT_REQUEST, COOKIE) commands into the generated script file. ! W h en th is option is en abled, an d you still can in sert Set(NEXT_REQUEST_ONLY, COOKIE) statem en ts. Th is can override th e cookie value th at QALoad sen ds for an y cookie th at is bein g dyn am ically h an dled. ! You sh ould on ly disable t h is option if you require m ore con trol over th e cookies th at QALoad sen ds durin g replay. Use this option to: ! Ensure that dynamic cookies are processed during replay. ! Ensure that dynamic cookies are not automatically inserted into the script during convert. Example W eb Page Th e cookies for th is site are: Set-Cookie: SaneID=172.22.24.180-4728804960004 Set-Cookie: SITESERVER=ID=f0544199a6c5970a7d087775f83b23af <html> <head></head> <body> 213 Usin g th e Player, Script Developm en t W orkben ch , an d An alyze <br>RELOAD PAGE TO INCREMENT COUNTER<br><br> </body> </html> Script example with the Dynamic Cookie Handling option selected The following example has the “Handle Dynamic Cookies” check box selected. ... ... Set(EVERY_REQUEST, HTTP_MODE_HANDLE_DYNAMIC_COOKIES, TRUE); BEGIN_TRANSACTION(); ... ... Navigate_To("http://www.host.com/cgi-bin/cookies5.pl "); Navigate_To("http://www.host.com/cgi-bin/cookies5.pl "); ... ... END_TRANSACTION(); ... ... Script Example with the Dynamic Cookie Handling Option Selected Th e followin g exam ple h as th e Dyn am i c Cook i e H an dl i n g ch eck box selected. ... ... Set(EVERY_REQUEST, HTTP_MODE_HANDLE_DYNAMIC_COOKIES, TRUE); BEGIN_TRANSACTION(); ... ... Navigate_To("http://www.host.com/cgi-bin/cookies5.pl "); Navigate_To("http://www.host.com/cgi-bin/cookies5.pl "); ... ... END_TRANSACTION(); ... ... Script Example with the Dynamic Cookie Handling Option Not Selected Th e followin g exam ple h as th e Dyn am i c Cook i e H an dl i n g ch eck box cleared. ... ... Set(EVERY_REQUEST, HTTP_MODE_HANDLE_DYNAMIC_COOKIES, FALSE); BEGIN_TRANSACTION(); ... ... Navigate_To("http://www.host.com/cgi-bin/cookies5.pl "); /* Request: 2 */ Set(NEXT_REQUEST_ONLY, COOKIE, "SaneID", "172.22.24.180-4728804960004"); Set(NEXT_REQUEST_ONLY, COOKIE, " SITESERVER ", " ID=f0544199a6c5970a7d087775f83b23af "); Navigate_To("http://www.host.com/cgi-bin/cookies5.pl "); ... ... END_TRANSACTION(); ... ... JavaScript Execution Level 214 QALoad On lin e Help Th is option con trols th e types of JavaScript statem en ts th at QALoad executes wh ile run n in g in HTM L m ode. Th e levels are Non e, Lim ited, an d Full. Lim ited is selected by default. Th is option on ly applies wh en HTM L is selected as th e con vert m ode. In HTTP m ode, th is option is disabled an d th ere is on ly a sin gle level of JavaScript execution . Caut ion: Always make changes to the JavaScript Execution Level using the WWW Convert Options dialog box, then re-convert the capture file to create a new script. Changing the JavaScript Execution Level directly in the script will affect script replay. Th e followin g table explai n s each JavaScript Execution Level: Ex ecut i on Level Descri pt i on Non e No JavaScri pt is executed durin g replay. Lim ited On ly th e followin g JavaScript statem en ts are execut ed durin g replay: ! document.cookie = ! window.document.cookie = ! document.write() ! window.document.write() Im ages are also requested wh ere th e im age.src statem en t occurs. Full All JavaScri pt statem en ts are executed durin g replay. Full m ust be selected to process XM LHttpRequests. Considerations ! When using the Limited JavaScript Execution Level, you may need to do further parameterization and edit the script. ! In HTTP mode, only the Limited level of JavaScript execution is available. ! Using no JavaScript execution or a Limited level execution requires less processing time and memory usage than the Full level of JavaScript execution. Use this option to: Con trol th e am oun t of processor an d m em ory usage. JavaScript Loop Tim eout Th is option con trols th e am oun t of tim e th at a JavaScript run s before QALoad term in ates th e JavaScri pt code. JavaScript can run in to in fin ite loops, or take a very l on g tim e to run . Th is option applies to both HTM L an d HTTP m ode. Considerations ! Th e tim eout value sh ould be decreased if you fin d th at an un n ecessary JavaScript is run n in g lon ger th an th e tim eout value. ! Th e tim eout value sh ould be in creased if you fin d th at a n ecessary JavaScri pt is run n in g lon ger th an th e tim eout value. ! M ake sure th at a n ecessary JavaScript is able to com plete before th e tim eout value of tim e is reach ed. Use this option to: 215 Usin g th e Player, Script Developm en t W orkben ch , an d An alyze Preven t JavaScripts from run n in g into in fin ite loops or from run n in g in defin itely . Con n ect i on Set t i n gs Reuse SSL session ID Th is option is available on ly on an SSL in stallation of QALoad . By default, th is option is n ot selected an d SSL session IDs are n ot re-used, wh ich reflects stan dard browser beh avi or. If your application re-uses SSL session IDs, con sider selectin g th is option . Th e Reuse SSL session ID option is used by th e replay en gin e at repl ay tim e an d th e curren t session ’s ID is re-used for all th e requests with in th e tran saction . Script example with the Reuse SSL Session ID option selected Th e followin g exam ple h as th e Reuse SSL sessi on I D ch eck box selected. ... ... SYNCHRONIZE(); /* /* /* /* Select following statement for reuse of Session ID with */ SSL. If session ID needs only to be reused within */ a transaction insert after the BEGIN_TRANSACTION */ statement */ /* DO_SSLReuseSession(TRUE); */ BEGIN_TRANSACTION(); ... ... /* Request: 1 */ DO_Http("GET http://www.host.com/subs.htm HTTP/1.0\r\n\r\n"); DO_VerifyDocTitle("Page Of Subs", TITLE); ... ... END_TRANSACTION(); ... ... Script example with the Reuse SSL Session ID not selected Th e followin g exam ple h as th e Reuse SSL sessi on I D ch eck box cleared. ... ... SYNCHRONIZE(); /* /* /* /* Select following statement for reuse of Session ID */ with SSL. If session ID needs only to be reused within */ a transaction, insert after the BEGIN_TRANSACTION */ statement */ /* DO_SSLReuseSession(FALSE); */ BEGIN_TRANSACTION(); ... ... 216 QALoad On lin e Help /* Request: 1 */ DO_Http("GET http://www.host.com/subs.htm HTTP/1.0\r\n\r\n"); DO_VerifyDocTitle("Page Of Subs", TITLE); ... ... END_TRANSACTION(); ... ... Con n ection Settin gs Th ese option s con trol h ow QALoad h an dles con n ection s to target servers durin g replay. You can select con n ection settin gs from th e Con vert Option s dialog box or by selectin g Playback Option s in th e Visual Navigator tree. Connection Options Persi st en t con n ect i on s duri n g repl ay: Select th is ch eck box to keep th e con n ection to th e server open for each request sen t to th e server. By keepin g con n ection s open (persisten t), you can in crease th e speed at wh ich requests are sen t to th e server. M ax con curr en t con n ect i on s: Type th e m axim um n um ber of con n ection s to th e server QALoad sh ould h ave open at a tim e. Th e m in im um an d default n um ber is 2. Th e m axim um n um ber of con n ection s is 4. Th ese sim ultan eous con n ection s are on ly used if sub-requestin g is en abled. Th is field on ly accepts valid positive in tegers. M ax con n ect i on ret ri es: Type th e n um ber of tim es QALoad sh ould attem pt t o con n ect to th e W eb server after tim in g out. Th is field on ly accepts valid positive in tegers. Con n ect i on ret ry w ai t t i m e: Type th e n um ber of secon ds durin g replay th at QALoad waits before attem ptin g to recon n ect t o th e server after failin g to con n ect. Th is field on ly accepts valid positive in tegers. Server respon se t i m eout : Type a len gth of tim e, in secon ds, QALoad sh ould wait for a reply from th e server before tim in g out. Graceful Socket Shutdown On : In dicates th at QALoad sh ould attem pt to term i n ate socket con n ection s gracefully in th e presen ce of un expected con dition s. Of f : In dicates th at QALoad sh ould NOT attem pt to term in ate socket con n ection s gracefully in th e presen ce of un expected con dition s. Baud Rate Emulation Em ul at e t r an sm i ssi on baud rat e: Select to sim ulate a specific baud rate for tran sm ission of requests, an d th en select a rate from th e Baud Rate drop-down fiel d. QALoad th en slows th e tran sm ission of requests appropriately in order to em ulate th e tran saction rat e to a web server, such as a 56 Kbps m odem or DSL. Baud r at e: Th e default is 112000. Option s in clude: 112000, 57600, 33600, 28800, 14400, an d 9600. Em ul at e recept i on baud rat e: Select to sim ulate a specific baud rate for reception of requests, an d th en select a rate from th e Baud Rate drop-down field. QALoad th en slows th e reception of requests appropriately in order to em ulate th e tran saction rat e from a web server, such as a 56 Kbps m odem or DSL. Baud r at e: Th e default is 112000. Option s in clude: 112000, 57600, 33600, 28800, 14400, an d 9600. SSL Session 217 Usin g th e Player, Script Developm en t W orkben ch , an d An alyze Reuse SSL sessi on i d: Select to in struct QALoad to reuse th e curren t session 's com m un ication in form ation (session ID) for all page requests with in th e tran saction . Rest ore def aul t s f or t h i s page: (Con vert on ly) Click th is lin k to restore all con trol values on th is page t o th eir default values. Persisten t Con n ection s Durin g Replay Th is is an option placed i n th e script to be used at replay tim e. Selectin g th is option keeps th e con n ecti on to th e server open for each request sen t to th e server. Considerations Keepin g con n ection s open (persisten t) can in crease th e speed at wh i ch requests are sen t to th e server. Use this option to: Con trol processor an d m em ory usage for requests. M ax Con curren t Con n ect ion s Th is option in dicates th e m axim um n um ber of con n ection s th at a DO_Http or DO_Https com m an d open s to th e server at an y tim e. Th ese sim ultan eous con n ection s are on ly used if sub-requestin g is en abled. Considerations ! Keepin g th e m axim um n um ber of con n ection s open can in crease th e speed at wh ich requests are sen t to th e server. ! In HTTP m ode, if th e Automatically process subrequests option on th e Parsin g Option s page is NOT selected, th is option is disabled. Use this option to: Con trol processor an d m em ory usage for requests. M ax Con n ection Retries Th is option specifies th e n um ber of tim es durin g replay th at QALoad will att em pt to con n ect to th e server after tim in g out. Considerations You m ust select Persisten t con n ection s durin g repl ay to en able th is option . Use this option to: Con trol processor an d m em ory usage for requests. Server Respon se Tim eout Th is option specifies, in secon ds, th e len gth of tim e durin g replay th at QALoad waits for data from th e server before tim in g out. Considerations You m ust select Persisten t con n ection s durin g repl ay to en able th is option . 218 QALoad On lin e Help Use this option to: Con trol processor an d m em ory usage for requests. Baud Rate Use th is option to sim ulate slower con n ection s to a W eb server, such as 56 Kbps m odem or DSL. Specify a baud rate wh en en ablin g baud rate em ulat ion in th e Con vert Opt i on s dialog box. Considerations ! The DO_SetBaudRate command is inserted into the script with the specified baud rate as its only parameter. ! If baud rate emulation must be asymmetric (the upload rate is different than the download rate), use the DO_SetBaudRateEx command. ! DO_SetBaudRateEx takes two parameters: the upload baud rate and the download baud rate. Use this option to: ! Simulate a specific baud rate for transmission of requests. ! Simulate a specific baud rate for reception of requests. Gen er al Proxy HTTP version A W W W script can be set to 1.1 or 1.0. W h en set to 1.1, all proxy HTTP requests an d subrequests are sen t as HTTP/ 1.1. W h en set to 1.0, all proxy HTTP requests an d subrequests are sen t as HTTP/ 1.0. Consideration HTTP 1.1 requests recei ve ch un ked replies. Use this option to: Specify th e HTTP version of requests an d sub-requests sen t to th e server. M ETA Refresh Th resh old W h en th is option is selected, th e tim e value th at you specify in th e secon ds field is com pared to a W eb page’s M ETA Refresh value (e.g. <M ETA HTTP-EQUIV=Refresh CONTENT=” 10” ; URL=” h ttp:/ / www.com puware.com ” >). Considerations ! If the CONTENT field value is less than the time value you specify, the page is treated as a redirected page. ! If the CONTENT field value is greater than the time value you specify, the page is treated as a regular page. Use this option to: Avoid in fin ite loops in th e script. In fin ite loops can occur if a page refresh es periodically to update data. 219 Usin g th e Player, Script Developm en t W orkben ch , an d An alyze Sample Scripts Script Example with the META Refresh Threshold Option Selected Th e followin g exam ple h as th e M ETA Ref resh Th resh ol d ch eck box selected an d is set to a value greater th an 5. ... ... Set(EVERY_REQUEST, HTTP_VERSION, "1.1"); Set(EVERY_REQUEST, M ETA_REFRESH_THRESHOLD, 5); BEGIN_TRANSACTION(); ... ... / * Request: 1 */ Navigate_To(“ h ttp:/ / h ost/ path / to/ page.pl"); Verify(PAGE_TITLE , "You h ave reach ed th e fin al page!!"); Script Example with META Refresh Threshold Option Not Selected Th e followin g exam ple h as th e M ETA Ref resh Th resh ol d ch eck box cleared. Th e exam ple also applies to h avin g th e option selected an d set to a value less th an 5. ... ... / / W W W Gen eral Option s Set(EVERY_REQUEST, HTTP_VERSION, "1.1"); BEGIN_TRANSACTION(); ... ... / * Request: 1 */ Navigate_To(“ h ttp:/ / h ost/ path / to/ page.pl"); Verify(PAGE_TITLE, “ Just W ait” ); DO_SLEEP(5); / * Request: 2 */ Navigate_To(“ h ttp:/ / h ost/ path / to/ real page.pl"); Verify(PAGE_TITLE, "You h ave reach ed th e fin al page!!"); Represen t CJK as Octal Ch aracters W h en th is option is selected, th e double-byte ch aracters used for Ch in ese, Japan ese, an d Korean (CJK) scripts are con verted in to octal form at. Considerations 220 QALoad On lin e Help ! Since CJK characters use Double Byte Character Sets (DBCS), encoding must be enabled for a capture with CJK characters, so that the double-byte characters can be viewed in a legible format. ! Data stays in encoded format throughout the load test: from capture, through convert and replay, to the analysis of the timing file. Use this option to: ! En able th e en codin g of captured data from web application s con tain in g Double Byte Ch aracter Sets (DBCS) such as Ch in ese, Japan ese, or Korean . ! En code all n ative ch aracters wh en n ative ch aracter support can n ot be used. Sample Scripts Example Web Page <html> <head> <title> </title> <meta http-equiv="Content-type" content="text/html; charset=euc-kr"> <meta http-equiv="Cache-Control" content="no-cache"> <meta http-equiv="Pragma" content="no-cache"> <meta http-equiv="Expires" content="Wed, 04 Jul 1973 16:00:00 GMT"> <!--CSS--> <style type='text/css'> </style> <!--/CSS--> </head> <body onload="document.search.p.focus();" topmargin=8> ... ... </body> </html> Script Example with the Represent CJK as Octal Characters Option Selected Th e followin g exam ple h as th e Represen t CJK as Oct al Ch aract ers ch eck box selected. ... ... /* Request: 1 */ DO_Http("GET http://kr.yahoo.com/ HTTP/1.0\r\n\r\n"); DO_VerifyDocTitle("\276\337\310\304!\304\332\270\256\276\306", TITLE); ... ... Script Example with the Represent CJK as Octal Characters Option Not Selected Th e followin g exam ple h as th e Represen t CJK as Oct al Ch aract ers ch eck box cleared. ... ... /* Request: 1 */ DO_Http("GET http://kr.yahoo.com/ HTTP/1.0\r\n\r\n"); DO_VerifyDocTitle(, TITLE); ... ... 221 Usin g th e Player, Script Developm en t W orkben ch , an d An alyze Stream in g M edia QALoad supports two types of stream in g m edia: ! RealOne Player ! Windows Media Player Considerations ! Streaming media is not supported through firewalls and across proxies. ! When streaming media conversion is enabled and you record a transaction that calls streaming media, an additional command is inserted into the script that requests the media. ! You do not have to listen to or view the entire media you are requesting. Simply record its URL and ensure that the appropriate media player is installed on the QALoad Player machines that will execute playback of the script. ! At run time, the script invokes the media player and requests the streaming media resource. Use this option: For audi o an d vi deo down load testin g of scripts wit h W in dows M edia Player or RealOn e Player an d th eir supported m edia form ats th rough a W W W session . Sample Scripts Advanced RealOne Player Media Options Th e followin g statem en ts are exam ples of h ow addit ion al RealOn e Player stream in g m edia com m an ds can be used in a script. ! void ShowMediaRP(BOOL displayAudio, BOOL displayVideo); En able/ disable clien t audio an d video for Real Networks Stream in g M edia. ! void EnableStatisticsRP(int statisticFlags, int interval, BOOL traceOutput); En able clien t-side perform an ce statistics for RealNet works Stream in g M edia. ! void DisableStatisticsRP(void); Disable clien t side perform an ce statistics for RealNetworks Stream in g M edia. Script Examples with Streaming Media Option Selected Th e followin g exam ple h as th e St ream i n g M edi a ch eck box selected an d uses RealOn e Player. ... ... #include "do_www.h" #include "RPLayer.h" ... ... BEGIN_TRANSACTION(); ... ... DO_Http("GET http://www.host.com/index.htm HTTP/1.0\r\n\r\n"); DO_VerifyDocTitle(" QALoad WWW Capture Examples", TITLE); DownloadMediaRP("http://rm.host.com:8099/ramgen/demo.rm", 0); ... ... END_TRANSACTION(); 222 QALoad On lin e Help ... ... Th e followin g exam ple h as th e St ream i n g M edi a ch eck box selected an d uses W in dows M edia Player. ... ... #include "do_www.h" #include "SMPLayer.h" ... ... BEGIN_TRANSACTION(); ... ... DO_Http("GET http://www.host.com/index.htm HTTP/1.0\r\n\r\n"); DO_VerifyDocTitle(" QALoad WWW Capture Examples", TITLE); DO_Http("GET http://www.host.com/wmp-test.asx HTTP/1.0\r\n\r\n"); DownloadMediaFromASX(0); ... ... END_TRANSACTION(); ... ... Script Examples with Streaming Media Option Not Selected Th e followin g exam ple h as th e St ream i n g M edi a ch eck box cleared an d uses RealOn e Player. ... ... #include "do_www.h" ... ... BEGIN_TRANSACTION(); ... ... DO_Http("GET http://www.host.com/index.htm HTTP/1.0\r\n\r\n"); DO_VerifyDocTitle(" QALoad WWW Capture Examples", TITLE); DO_Http("GET http://rm.host.com:8099/ramgen/demo.rm HTTP/1.0\r\n\r\n"); ... ... END_TRANSACTION(); ... ... Th e followin g exam ple h as th e St ream i n g M edi a ch eck box cleared an d uses W in dows M edia Pl ayer. ... ... #include "do_www.h" 223 Usin g th e Player, Script Developm en t W orkben ch , an d An alyze ... ... BEGIN_TRANSACTION(); ... ... DO_Http("GET http://www.host.com/index.htm HTTP/1.0\r\n\r\n"); DO_VerifyDocTitle(" QALoad WWW Capture Examples", TITLE); DO_Http("GET http://www.host.com/wmp-test.asx HTTP/1.0\r\n\r\n"); ... ... END_TRANSACTION(); ... ... Strip All Cookies from Request W h en th is option is selected, n o cookies are sen t wi th requests. Use this option to: Specify wh eth er cookies are sen t with requests. Sample Scripts Script Example with the Strip All Cookies from Request Option Selected Th e followin g exam ple h as th e St ri p Al l Cook i es From Request ch eck box sel ected. ... ... DO_Http("GET http://qawebserv.compuware.com/cgi-bin/cookies5.pl HTTP/1.0\r\n\r\n"); DO_Http("GET http://www.host.com/cgi-bin/cookies5.pl HTTP/1.0\r\n\r\n"); DO_Http("GET http://www.host.com/cgi-bin/cookies5.pl HTTP/1.0\r\n\r\n"); ... ... Script Example with the Strip All Cookies from Request Option Not Selected Th e followin g exam ple h as th e St ri p Al l Cook i es From Request ch eck box cl eared. ... ... DO_Http("GET http://www.host.com/cgi-bin/cookies5.pl HTTP/1.0\r\n Cookie: username=username\r\n\r\n"); ... ... Scripting Options Si m ul at i n g Vari abl e I P Addresses W h ile QALoad can sim ulate m ultiple virtual users from a sin gle system , it generally does so usin g a sin gle source IP address. In m ost testin g situation s th is isn ’t a problem , but with a sm all set of HTTP-based application s, it m ay n ot be th e best way to sim ulate real-life activity. For QALoad Player m ach in es with m ore th an on e static IP address, QALoad can direct each virtual user to use a di fferen t source IP address. 224 QALoad On lin e Help To accom plish th is, a local datapool file con tain in g a list of local static IP addresses m ust be created on each QALoad Player m ach in e. W h en you en able IP spoofin g in th e QALoad Con ductor, th e QALoad Con ductor in structs each QALoad Player to create t h e appropriate datapool fi le at run tim e. Th e QALoad Player uses th ese addresses for con n ection s to HTTP an d SSL servers. Each virt ual user receives on e address for use with all its con n ection s. If th ere are m ore virtual users th an addresses, IP addresses are re-used startin g from th e begin n in g of th e datapool file. M odifyin g a Script to Use Variable IP Addresses In th e Script Devel opm en t W orkben ch , select Vi sual Navi gat or>I n sert Tree I t em >I PSpoof to in sert th e IPSpoof item in to th e Visual Navigator tree-view. You can th en use th e var... button in th e form view pan e to set th e data record to use durin g playback. Creatin g a Datapool of IP Addresses Use th e followin g procedure to creat e a datapool of valid IP addresses from th e QALoad Con duct or. Th is file is autom atically created on th e QALoad Player workstation s (W in dows an d UNIX) at run tim e. To cr eat e a d at ap ool of IP ad d r esses: 1. Start QALoad Conductor. 2. In the Visual Designer menu bar, select Tools>Manage Players. The Manage Players/Groups dialog box displays. 3. Select a Player in the Players pane. 4. Expand the Machine Settings area on the right-hand side of the dialog box. 5. Select the Generate IP Spoof Data (machines with multiple IP addresses only) option in the Player Machine settings field. 6. Click OK. At run tim e, th e QALoad Con ductor sen ds a com m an d to each QALoad Player Agen t to create th e dat apool file of IP addresses, an d th e script is sen t to th e server usin g th e differen t IP addresses. Th e Gen erat e I P Spoof Dat a ch eck box is valid on l y for W W W scripts. Not e: The machine on which the QALoad Conductor resides must have static IP addresses assigned to it. If no static IP addresses are found, the QALoad Conductor displays a warning and the datapool file is not generated. The datapool file is named ipspoof.dat, and is saved in the \Compuware\QALoad\Datapools directory. Con vert i n g a W W W Scri pt QALoad h as been en h an ced to en able you to con trol h ow m uch autom ated processin g is perform ed durin g test execution by ch oosin g HTM L m ode or HTTP m ode for script con version . W h en goin g th rough th e W W W con vert for th e first tim e, you are n ow prom pted to ch oose between HTM L m ode an d HTTP m ode. Tip: Compuware recommends that you use the WWW Convert Options dialog box to convert between modes, rather than manually edit the script. Typical HTM L processin g uses m ore processor cycles an d m em ory durin g test execution , but requires less scriptin g. Th e Visual Navi gator is gen erated usin g QALoad's Docum en t Object M ode (DOM ) approach , wh ich also is used for pl ayback. HTTP processin g in structs QALoad to disable m ost of its autom atic HTM L h an dlin g en gin e durin g replay, an d it also affects h ow th e script is gen erated. In th is m ode, th e con vert process uses som e HTM L parsin g to gen erate th e Visual Navigator. Th is parsin g m eth od also is used for playback in stead of th e DOM . Th e HTTP m ode replaces M in im ized Processor m ode. Scripts con verted before QALoad release 5.6 usin g M in im ized Processor m ode will replay in HTTP m ode. 225 Usin g th e Player, Script Developm en t W orkben ch , an d An alyze Caut ion: Once you convert a script using HTTP mode or HTML mode, you must reconvert the script to change the convert mode. This is necessary so that the convert and replay methods match. Failure to change modes by reconverting the script can cause the script to replay incorrectly. St ream i n g M edi a i n Vi sual Navi gat or If you selected th e Stream in g M edia option on th e W W W Advan ced con versi on option s dialog box before recordin g your script, an d th e recorded tran saction con tain s RealOn e Player or W in dows M edi a stream i n g requests, your stream in g m edia request will be presen ted as a Page in th e tree-view, sim ilar to th e followin g graph ic: Th e form -view (bottom pan e) for a stream in g m edia page sh ows th e title Real Media Request or W indows Media Request to in dicate th e type of request you recorded, an d lists th e followin g fields: Request ed URI : Lists th e requested URI th at in voked th e m edia player. For Real M edia th e file typically is an RM file, wh ile for W in dows M edi a it is typically an ASX file. Pl ay M edi a Request : Select th is ch eck box for th e virtual user to process th e RM or ASX fil e th at is received an d m ake th e n ecessary requests to duplicate wh at th e clien t perform ed wh ile receivin g th e stream in g m edia. If th is ch eckbox is n ot selected, t h en n o furth er processin g is perform ed after receivin g th e RM or ASX file. Pl ay Request ed M edi a f or N secon ds: You can specify h ow m uch of th e stream in g m edia file th e virtual user sh ould play, in secon ds, before m ovin g on to t h e n ext request. A value of zero in dicates th at th e en tire m edia stream sh ould be played. Not e: While a virtual user is playing a media request it will not make any other requests in the transaction loop. This may be different than what the user performed when recording the transaction because a browser is capable of spawning the streaming media player as a separate executable which can execute at the same time that the user continues to make further web requests in the browser. CJK an d Vi sual Navi gat or Th e Visual Navigator h an dles both n ative an d en coded Ch in ese, Japan ese, an d Korean (CJK) ch aract ers. (See CJK Support in QALoad for m ore in form ation about CJK support.) Th e followin g graph ic sh ows h ow th e Visual Navigator provides n ative ch aracter support. Both En glish an d Ch in ese ch aracters are displayed in th e W orkbook Pan e. 226 QALoad On lin e Help Th e sam e capture file, Shanghai.cap, is open in th e graph ic below. Here, th e Visual Navigator displays th e Ch in ese ch aracters in en coded form at. 227 Usin g th e Player, Script Developm en t W orkben ch , an d An alyze X M L Support XM L Support QALoad's XM L support is h an dled th rough th e Script Developm en t W orkben ch 's Visual Navigator, wh ich displays your scri pt's HTTP or XM L requests in an easy-to-use, visually-based in terface th at offers you poin t-an d-click scri pt edit in g. Alth ough XM L is supported th rough th e Visual Navigator, Com puware recom m en ds you read th rough th is h elp topic as well as th e Visual Navigator h elp topics to becom e fam iliar with th e features th at are un ique to QALoad's XM L support. W h en an HTTP request is m ade for an X M L docum en t, eith er in th e form of an HTTP GET request or an HTTP POST request with an XM L docum en t as th e post data, th e dat a is displayed in th e th ree Visual Navigator pan es as illustrated below. Click on a pan e in th e graph ic for a description of its con ten ts an d fun ction ality. Not e: To make the following graphic fit better in this help window, the Script Development Workbench toolbars and panes that are not directly related to this help topic are not displayed. You can hide/ show many of the Script Development Workbench toolbars and panes using commands available from the View menu. XM L Requests W h en an HTTP request is for an XM L docum en t, eith er in th e form of an HTTP GET request, or an HTTP POST request with an XM L docum en t as th e post data, th en an XM L Request tree item is displayed in t h e tree-view (left pan e). Th e form -view (bottom pan e) for an XM L Request item i n cludes th e followin g fields: Repl y St at us: Th e reply st atus code. Th e status code is 200 OK for m ost pages th at return correctly. Request URI : Th is read-on ly field sh ows th e URI requested, wh ich resulted in th is page bein g displayed. 228 QALoad On lin e Help Ch eck poi n t Nam e: If th e page h as a title, it is used as th e ch eckpoin t n am e. If n ot, th e word Checkpoint is used. To m ake sure all ch eckpoin t n am es are un ique, QALoad adds a n um ber to th e begin n in g of th e ch eckpoin t n am e. XML Request Sub-items An XM L Request item can con tain th e followin g sub-item s. XML Reply Th e URI of th e docum en t return ed as a result of th e XM L request. X M L data correspon din g to th e reply is displayed in th e browser-view. HTTP Headers If a h eader exists un der an action item , it is sen t for th at request on ly. If th e h eader h as th e sam e n am e as on e of th e com m on h eaders, it overrides th e com m on h eader for th is request on ly. Th e form -view (bott om pan e) for an HTTP h eader lists its n am e an d value. Because th ere is n o XM L data recorded for a h eader, th e browser-view rem ain s em pty. It is possible to in sert addition al HTTP Headers. Cookies CGI Parameter Th e Cookies tree item con tain s a list of Cookie item s th at were sen t in th e h eader of th e request th at th is item m ade wh ile bein g recorded. Cookies are added autom atically by th e browser based on th e URI th at is bein g requested. Th ey are eith er set as a result of th e previous reply (server ret urn ed a Set-Cookie com m an d), or th ey are set by JavaScript con tain ed i n th e previous reply. Th e form -view for a cookie item lists its n am e an d value. Because th ere is n o X M L data recorded for a h eader, t h e browser-view rem ain s em pty. XM L Docum en t-view W h en you click on an X M L Request item in th e tree-view (left pan e) th e righ t pan e becom es a documentview displayin g a tree-view of details about th e XM L docum en t requested or return ed as th e result of an XM L request. Each in divi dual XM L item appears as a n ode in th e XM L docum en t tree. XM L elem en ts can h ave ch ild elem en ts an d th ese appear as ch ild n odes of th e XM L elem en t. Attributes of an elem en t appear as ch ild n odes of th e elem en t, with th e attribute value appearin g as a ch ild of th e attribute n am e. W hat if no XML data is associated with a request? If th ere is n o XM L docum en t associated with th e XM L request (for exam ple, an HTTP GET) a m essage in dicatin g th at th ere is n o XM L to be displayed is sh own in th e XM L docum en t-view. How does the document-view relate to the form-view? Selectin g an item in th e XM L docum en t tree displays th e form -view details correspon din g to th at XM L elem en t type in th e bottom pan e. Followin g is an exam ple of XM L request data displayed in a portion of th e X M L docum en t-view: 229 Usin g th e Player, Script Developm en t W orkben ch , an d An alyze XM L Form -view W h en an XM L request is displayed in th e docum en t-view (top pan e) — as a result of an XM L request it em or XM L reply ch ild item bein g selected in th e Visual Navigator tree-view — you can click on item s in th e docum en t-view to display in form ation about each i n th e form -view (bottom pan e). If n o XM L item is selected in th e docum en t-view, th e XM L Page form -view displ ays in stead. For XM L item s, th e form view display option s depen d on two th in gs: ! what type of XML item is selected in the Visual Navigator tree-view (left pane): an XML request or an XML reply ! what type of XML item is subsequently selected in the XML document-view (top pane) W h en an XM L item is selected in th e XM L docum en t-view, th e value of th at XM L item is displayed in an edit box in th e form -view. Som e values — attribute values an d text values — can be edited or vari ablized (th at is, substitutin g on e or m ore variables for th e value in an XM L request or selectin g th e return val ue from an XM L repl y item to be recei ved by a variable for later use in th e script). Text item s, wh ich are values between elem en t tags, an d attribute values represen t volatile item s in an XM L docum en t structure, used for passin g values to an d from W eb Services, for exam ple. Th e followin g tables list th e possible action s for X M L item s displayed in a form -view. Valid action s are determ in ed by th e XM L it em type an d wh eth er th e item is from an HTTP POST request or from an HTTP reply. In th e followin g tables: ! If an item is editable, the value in the form-view can be changed and the new value is used during replay. ! If a value can be variablized, a variable can be substituted for all or part of the value. The variable's value is placed in the variable's location at replay. An example is a value received from an item from a previous XML document reply. ! If a variable can receive a replay value, the return value for the item can be placed into a selected variable during replay. The variable can then be substituted for an input value in a later XML request. X M L Request I t em s X M L Request I t em Edi t abl e? Can t h e Val ue be Vari abl i zed? Declaration No No DTD (Docum en t Type Defin ition ) No No PI (Processin g In struction ) No No Com m en t No No 230 QALoad On lin e Help Elem en t No No Attribute (Nam e) No No Attribute (Value) Yes Yes Text Yes Yes X M L Repl y I t em s X M L Request I t em Can Vari abl e Recei ve Repl ay Val ue Declaration No DTD (Docum en t Type Defin ition ) No PI (Processin g In struction ) No Com m en t No Elem en t No Attribute (Nam e) No Attribute (Value) Yes Text Yes Common Scripting Scenarios CGI Param et er En codi n g Com m on Gateway In terface (CGI) is widely used on W orld W ide W eb sites to provi de th e ability to run server-side scri pts th at can take variable in put from a W eb browser. QALoad recogn izes wh en th e browser h as com m un icated to a CGI site an d autom atically creates variables for param eters wh en ever n ecessary. For exam ple, m an y CGI subm ission form s con tain h idden param eters th at th e user can n ot m odify, but are always sen t in th e W W W request. Because th ese val ues can con tain variable data, QALoad in serts statem en ts in to th e script to store th ese h idden param eters in variables an d appen d th em autom atically to CGI requests. CGI requests also in clude param eters th at th e browser h as allowed th e user to m odify. For exam ple, a CGI form m igh t require a user to en ter a n am e an d address an d click a subm it button to con tin ue. QALoad does n ot autom atically store th ese types of param eters in variables, but in stead provides an easy way to m odi fy th e con ten t of th e param eters th at are bein g sen t in th e CGI request usin g th e DO_SetValue com m an d. W h en you m odify param eters th at are passed in to a QALoad CGI request, en sure th at all CGI param eters con tain in g ch aract ers th at are n ot alph an um eric (a-Z, 0-9) are en coded before bein g sen t to th e server. CGI en codin g en tails in sertin g th e ASCII value of a ch aracter, prefixed with th e “ %” ch aracter, in to th e param eter. QALoad autom atically CGI-en codes an y values th at it detects durin g th e recordin g an d 231 Usin g th e Player, Script Developm en t W orkben ch , an d An alyze con version process; h owever, to m an ually add or m odify an y CGI param eter strin gs after your script is created, you m ust m an ual ly en code special ch aracters to en sure th at th e CGI param eter dat a is sen t to th e W eb server properly. For exam ple, to in sert th e “ =” ch aracter in to a CGI param eter, first determ in e its ASCII h exadecim al value (3D), an d in sert th at value in to th e CGI param eter prefixed with “ %” . In th e CGI param eter strin g, “ %3D” would replace “ =” . All CGI param eter en codin g is h an dled by th is m eth od, except for spaces. Blan k spaces m ust be specified in th e en coded CGI strin g by th e ch aracter “ +” , rath er th an the ASCII value. QALoad provides an autom atic way of perform in g th is en codin g usin g th e DO_En codeStrin g com m an d. CGI Get Request s Get requests are h an dled by th e followin g process: 1. The browser makes a request to a server for a URL that contains a call to a Common Gateway Interface (CGI) program. 2. The server calls the CGI program, which usually returns a Web page. The returned page is called a dynamic page because it is created by the CGI program. 3. The browser accepts the resulting dynamic page and displays it. Exam ple W eb Page Th e followin g W eb page con tain s an an ch or (lin k) t h at referen ces a CGI program . Th e referen ce results in a CGI Get request. Th e an ch or calls th e CGI program n am ed perl_1.pl with som e param eters. In perl_1.pl?n am e=FRANK, t h e question m ark (?) den otes th e start of param eters th at n eed to be passed to th e program . Th e n am e/ value pair bein g passed to th e perl_1.pl program is n am e=FRANK. W h en you click th e an ch or text (dyn am ic HTM L page), th e browser m akes a CGI Get request. A Get request, wh en executed by th e server, passes param eters in an en viron m en t variable to th e CGI program . Th is type of param eter h an dlin g is lim ited to 255 ch aracters. <HTML> <HEAD> <TITLE> QALoad WWW Capture Examples</TITLE> </HEAD> <BODY> <A HREF="/cgi-bin/perl_1.pl?name=FRANK">Dynamic HTML Page</A> </BODY> </HTML> Exam ple Script QALoad autom ati cally gen erates all con structs th at are n ecessary for a CGI Get request. Th e followin g script uses a DO_Htt p call for th e CGI Get request. H ow I t W or k s: Th e scri pt processes a CGI Get request th e sam e way it processes URL lin ks to a page. In th e exam ple scri pt below, n ot e th at th e param et ers passed to th e W eb server on th e CGI call are recorded un ch an ged. Th e param eters do n ot ch an ge un less th e page is dyn am ically gen erated. char *Anchor[1]; for(i=0;i<1;i++) Anchor[i]=NULL; DO_InitHttp(s_info); SYNCHRONIZE(); BEGIN_TRANSACTION(); ... ... 232 QALoad On lin e Help DO_Http("GET http://www.host.com/ HTTP/1.0\r\n\r\n"); /* * Anchor 'http://www.host.com/cgi-bin/perl_1.pl?name=FRANK' * 'Dynamic HTML Page' */ DO_GetAnchorHREF("Dynamic HTML Page", &Anchor[0]); DO_SetValue("Anchor000", Anchor[0]); DO_Http("GET {*Anchor000} HTTP/1.0\r\n\r\n"); DO_VerifyDocTitle("Perl Example Page", TITLE); ... ... for(i=0; i<1; i++) { free(Anchor[i]); Anchor[i]=NULL; } END_TRANSACTION(); CGI Post Request s Post requests are h an dled by th e followin g process: 1. The browser makes a request to a server for an HTML page that contains a form that uses an action statement with a Post call to a CGI program. 2. When you click the Submit button on a CGI form, the browser makes a Post request and the server returns a Web page. 3. The browser accepts the dynamic page and displays it. Because it is a CGI Post request, the browser passes the parameters of the program to the CGI script as command line options. Exam ple W eb Page Th e followin g W eb page con tain s a form th at calls a CGI script with a Post Request. <html> <head><title> QALoad's Perl Example Page</title> </head><body><center> QALoad's Perl Example Page</center> <form name = myform method = POST action = perl_1.pl> <input type = text name = yourname size = 50><br> <input type = submit value = "Submit Request"> <input type = reset> </form> </body></html> Exam ple Script QALoad autom ati cally gen erates all th e con structs t h at are n ecessary for a CGI Post request. Th e followi n g script features a DO_HTTP request th at executes a CGI Post request : char *ActionURL[1]; ... ... for(i=0;i<1;i++) ActionURL[i]=NULL; ... ... BEGIN_TRANSACTION(); /* Request: 1 */ DO_SetValue("name", "FRANK"); 233 Usin g th e Player, Script Developm en t W orkben ch , an d An alyze DO_Http("GET http://www.host.com/cgi-bin/perl_1.pl?{name} " "HTTP/1.0\r\n\r\n"); DO_VerifyDocTitle(" QALoad's Perl Example Page", TITLE); /* ActionURL[0]="http://www.host.com/cgi-bin/perl_1.pl" */ DO_GetFormActionStatement(FORM(1), &ActionURL[0]); ... /* Request: 2 From: QALoad's Perl Example Page */ DO_SetValue("action_statement0", ActionURL[0]); DO_SetValue("yourname", "PostFrank"); DO_SetValue("function", "View the log of previous visitors."); DO_Http("POST {*action_statement0} HTTP/1.0\r\n" "Content-Type: application/x-www-form-urlencoded\r\n" "Content-Length: {*content-length}\r\n\r\n" "{yourname}&{function}"); DO_VerifyDocTitle(" QALoad's Perl Example Page", TITLE); ... ... for(i=0; i<1; i++) { free(ActionURL[i]); ActionURL[i]=NULL; } END_TRANSACTION(); Request i n g Passw ord-pr ot ect ed Di rect ori es W eb devel opers use password-protected directories to protect access to som e pages. W h en th e browser requests a page in a password-protected directory, t h e server return s a speci al respon se th at specifies th e page is password-protected. W h en th e browser receives th is type of reply, it gath ers th e user ID an d password, en crypts th em , an d passes th em back to t h e server in a subsequen t request. Exam ple Script QALoad autom ati cally gen erates all th e con structs t h at are n ecessary to execute a request of a passwordprotected directory. Th e exam ple scri pt features th e followin g elem en ts: ! DO_BasicAuthorization, which takes the user ID and password as parameters ! DO_Http request to the password-protected directory BEGIN_TRANSACTION(); DO_BasicAuthorization("frank", "~encr~557A2549474E57444A"); ... ... DO_Http("GET http://www.host.com/access_controlled/secure.htm HTTP/1.0\r\n\r\n"); DO_VerifyDocTitle("Successful Test of a Secured Page", TITLE); ... ... END_TRANSACTION(); Exam ple Script QALoad also h an dles In tegrated W in dows Auth en tication (form erl y NTLM ). Th e exam ple scri pt features th e followin g elem en ts: 234 QALoad On lin e Help ! A DO_NTLMAuthorization call, which takes the domain, user ID, and password as parameters ! DO_Http request to the Integrated Windows Authentication-protected directory BEGIN_TRANSACTION(); DO_NTLMAuthorization("dom1\\frank", "~encr~557A2549474E57444A"); ... ... DO_Http("GET http://www.host.com/ntlm_controlled/secure.htm HTTP/1.0\r\n\r\n"); DO_VerifyDocTitle("Successful Test of a NTLM Page", TITLE); ... ... END_TRANSACTION(); H an dl i n g error m essages f rom t h e W eb ser ver W h en a server return s an error m essage, it return s it in on e of two ways. It eit h er return s an error m essage with a respon se code (for exam ple, 404 Not Foun d) or return s an HTM L page th at con tain s an error m essage. Th e followin g section s provide exam ples of code th at you can use in your script to h an dle errors th at th e W eb server return s to th e browser. Han dlin g error m essages with respon se codes Th e exam ple below dem on strates h ow to write code to h an dle error m essages th at in clude respon se codes th at th e W eb server return s to th e browser. Th e code perform s th e followin g action s: ! Checks for an error code using the DO_GetLastHttpError command ! Aborts or continues script execution, based on the WWW_FATAL_ERROR statement Example int error; char errorString[30]; DO_Http("GET http://www.host.com/ HTTP/1.0\r\n\r\n"); if((error = DO_GetLastHttpError()) > 399) { sprintf(errorString, "Error in response: %d\n", error); WWW_FATAL_ERROR("Request-host", errorString); } Han dlin g error m essages return ed in an HTM L page Th e exam ples below dem on strate h ow to write code to h an dle error m essages th at th e W eb server return s to th e browser in an HTM L page. Using DO_VerifyDocTitle to verify page requests By in sertin g th e DO_VerifyDocTitle com m an d in to your script, you can com pare th e HTM L docum en t titles in your load test script with th e docum en t titles you origin ally captured. Th e code perform s th e followin g action s: ! Calls DO_Http to request an HTML page from the Web server ! Calls DO_VerifyDocTitle with the original HTML document title. If the titles do not match, DO_VerifyDocTitle exits the script Ex am pl e 235 Usin g th e Player, Script Developm en t W orkben ch , an d An alyze DO_Http("GET http://www.host.com/ HTTP/1.0\r\n\r\n"); DO_VerifyDocTitle("Welcome to The Main Page", TITLE); Searching response text for error messages In som e scripts, error m essages are displayed as text in an HTM L page. Th e fol lowin g exam ple dem on strates h ow to detect th ese m essages in a scri pt. Th e code perform s th e followin g action s: ! Searches for errors returned as HTML from the Web server ! Branches to error handling code Ex am pl e int response; response = DO_Http("GET http://www.host.com/ HTTP/1.0\r\n\r\n"); if (strstr (response, "200 OK") == NULL) WWW_FATAL_ERROR("host", "Response did not have 200 OK"); Si m ul at i n g JavaScri pt JavaScript is h an dled by t h e followin g process: 1. The browser makes a page request to a server for a page that contains JavaScript. 2. Because JavaScript is simply uncompiled code, the browser downloads and immediately executes this code upon receipt of the page. Supported Objects QALoad supports th e built-in JavaScript objects (global, object, fun ction , array, strin g, boolean , n um ber, m ath , date, regexp, an d error), docum en t objects, im age objects, an d XM LHt tpRequest Objects. Supported Properties Th e on ly docum en t properties th at QALoad support s are cookies, title, an d th e im ages array. Th e on ly im age property th at QALoad supports is src. Evaluation Errors If an object, property, or fun ction used with in a block of JavaScript code is n ot defin ed, it causes a JavaScript exception . Th e exception stops evaluation of th at block. Example W eb Page Th e followin g W eb page con tain s th e JavaScri pt fun ction an d an on Load tag t h at calls th e scrollit fun ction . Th e on Load tag tells th e browser to execute th e JavaScript im m ediately after l oadin g th e page. Th e scrol lit fun ction displays a scrolli n g ban n er region on th e W eb page. <HTML> <HEAD> <TITLE>Java Script Example</TITLE></HEAD> <SCRIPT LANGUAGE="JavaScript" src="js_do_nothing.js"> function scrollit_r2l(seed) { var var var var var var 236 m1 = " Welcome to Compuware's QALoad homepage."; m2 = " Glad to see you."; m3 = " Thanks for coming. "; msg = m1 + m2 + m3; out = " "; c = 1; QALoad On lin e Help if (seed > 100) { seed--; var cmd="scrollit_r2l(" + seed + ")"; timerTwo=window.setTimeout(cmd,100); } else if (seed <= 100 && seed > 0) { for (c=0 ; c < seed ; c++) { out+=" "; } out+=msg; seed--; var cmd="scrollit_r2l(" + seed + ")"; window.status=out; timerTwo=window.setTimeout(cmd,100); } else if (seed <= 0) { if (-seed < msg.length) { out+=msg.substring(-seed,msg.length); seed--; var cmd="scrollit_r2l(" + seed + ")"; window.status=out; timerTwo=window.setTimeout(cmd,100); } else { window.status=" "; timerTwo = window.setTimeout("scrollit_r2l(100)", 75); } } } </script> <BODY onLoad="timerONE=window.setTimeout('scrollit_r2l(100)',500);"> <!-- End scrolltext --> <center><h2>Java Script Example</h2><hr>Check out the browser's scrolling status bar.<br><br> </center> </BODY></HTML> Example script Th e followin g script features a DO_Http call to retri eve th e JavaScri pt page. H ow I t W or k s: QALoad evaluates th e JavaScri pt in th e con text of script blocks, on Load tags, an d src an d th en executes th em . DO_InitHttp(s_info); ... ... BEGIN_TRANSACTION(); DO_AutomaticSubRequests(TRUE); ... ... DO_Http("GET http://www.host.com/js.htm HTTP/1.0\r\n\r\n"); DO_VerifyDocTitle("Java Script Example", TITLE); ... ... END_TRANSACTION(); 237 Usin g th e Player, Script Developm en t W orkben ch , an d An alyze Si m ul at i n g Cook i es Th is section describes h ow QALoad h an dles cookies. Cookies are h an dled by th e followin g process: 1. The browser makes a CGI request to a server for a dynamic page. 2. When the server sends the page back to the browser, the page includes a cookie in the header. The browser saves the cookie along with information that ties it to the Web server. 3. On all subsequent requests to that Web server, the browser passes the cookie along with the request. Exam ple W eb page Th e followin g CGI Perl script gen erates a Set-Cooki e h eader as a part of subsequen t HTTP requests. Set-Cookie: SaneID=172.22.24.180-4728804960004 Set-Cookie: SITESERVER=ID=f0544199a6c5970a7d087775f83b23af <html> ... The cookies for this site are:<br><br> <B>SaneID=172.22.24.180-4728804960004; SITESERVER=ID=f0544199a6c5970a7d087775f83b23af </B><P> <b>Next cookie for this URL will be : 1</b><br> <br>RELOAD PAGE TO INCREMENT COUNTER<br><br><A HREF=http://www.host.com/index.htm>Return to previous homepage.</A> Exam ple script wh en Dyn am ic Cookie Han dlin g is turn ed on Th is is th e default m eth od by wh ich QALoad h an dles cookies. Th e exam ple script features th e followin g elem en ts: ! Two CGI requests that return dynamic pages ! Cookies are handled by the replay engine BEGIN_TRANSACTION(); DO_DynamicCookieHandling(TRUE); ... ... /* Request: 1 */ DO_Http("GET http://www.host.com/cgi-bin/cookies5.pl" "HTTP/1.0\r\n\r\n"); /* Request: 2 */ DO_Http("GET http://www.host.com/cgi-bin/cookies5.pl" "HTTP/1.0\r\n\r\n"); ... ... END_TRANSACTION(); Exam ple script wh en Dyn am ic Cookie Han dlin g is turn ed off Th e exam ple scri pt features th e followin g elem en ts: 238 ! A CGI request that returns a dynamic page ! Two DO_GetCookieFromReply calls to retrieve the cookie from reply ! Two DO_SetValue calls to set the cookie ! A free cookie QALoad On lin e Help H ow I t W or k s: For cookies th at are set with CGI scripts, th e script stores in com in g cookies in a variable an d passes th em back to t h e W eb browser in th e reply from th e CGI scri pt. Th e script h an dles th ese cookies by executin g a DO_GetCookieFrom Repl y com m an d after th e CGI request. DO_GetCookieFrom Reply stores th e cookie values i n variables, wh ich th e scri pt th en passes back to subsequen t CGI requests usin g th e DO_SetValue com m an d. int i; char *Cookie[4]; ... ... for(i=0;i<4;i++) Cookie[i]=NULL; DO_InitHttp(s_info); ... ... BEGIN_TRANSACTION(); DO_DynamicCookieHandling(FALSE); ... ... /* Request: 1 */ DO_Http("GET http://www.host.com/cgi-bin/cookies5.pl "HTTP/1.0\r\n\r\n"); /*Set-Cookie: NUM=1 */ DO_GetCookieFromReplyEx("NUM", &Cookie[0], '*'); /*Set-Cookie: SQUARE=1 */ DO_GetCookieFromReplyEx("SQUARE", &Cookie[1], '*'); /* Request: 2 */ DO_SetValue("cookie000", Cookie[0]); /* NUM=1 */ DO_SetValue("cookie001", Cookie[1]); /* SQUARE=1 */ DO_Http("GET http://www.host.com/cgi-bin/cookies5.pl " "HTTP/1.0\r\n" "Cookie: {*cookie000}; {*cookie001}\r\n\r\n"); ... ... DO_HttpCleanup(); for(i=0; i<4; i++) { free(Cookie[i]); Cookie[i]=NULL; } END_TRANSACTION(); Ex ecut i n g a Vi sual Basi c scri pt QALoad does n ot evaluate a Visual Basic script. However, an y Visual Basic script request th at occurs is in serted in to th e script as a m ain request. Si m ul at i n g Fram es Fram es are h an dled by th e followin g process: 1. The browser makes a main page request to a Web server for a page that contains frames. 2. The browser parses the frame pages and places them in sub-windows within the browser, each of which displays the frame content. 239 Usin g th e Player, Script Developm en t W orkben ch , an d An alyze Exam ple W eb Page Th e followin g W eb page con tain s four fram es. <HTML> <HEAD> <TITLE>FRAME Example</TITLE> </HEAD> <! -- Here is the FRAME information for browsers with frames --> <FRAMESET Rows="*,*"><!-- Two rows, each equal height --> <FRAMESET Cols="*,*"><!-- Two columns, equal width --> <FRAME Src="findex.htm" Name="ul-frame"> <FRAME Src="findex.htm" Name="ur-frame"> </FRAMESET> <FRAMESET Cols="*,*"><!-- Two columns, equal width --> <FRAME Src="findex.htm" Name="ll-frame"> <FRAME Src="findex.htm" Name="lr-frame"> </FRAMESET> </FRAMESET> </HTML> Exam ple Script QALoad autom ati cally gen erates all con structs n ecessary to request fram es. Th e exam ple scri pt features th e followin g elem en t: ! A DO_Http call to retrieve the main page. H ow I t W or k s: Th e fram es are treated as sub-requests an d are evaluated an d requested by QALoad . BEGIN_TRANSACTION(); DO_AutomaticSubRequests(TRUE); ... ... DO_Http("GET http://www.host.com/frameset.htm HTTP/1.0\r\n\r\n"); DO_VerifyDocTitle("FRAME Example", TITLE); ... ... END_TRANSACTION(); Si m ul at i n g Brow ser Cach i n g Browser cach in g is h an dled by th e followin g process: 1. When the browser makes a request for static HTML pages, it may include an option to retrieve the page only if it is newer than the one held in the browser’s cache. 2. If browser caching is enabled, the server returns only newer versions of the page. If browser caching is not enabled, the server always returns the page. H ow I t W or k s: Th e QALoad Script Devel opm en t W orkben ch disables browser cach in g wh ile recordin g, wh ich m ean s a page is always retrieved. CGI Form s Com m on Gateway In terface (CGI) form s are h an dl ed by th e followin g process: 240 QALoad On lin e Help 1. The browser requests a page that contains a CGI form. It displays the page and provides the interaction for input fields that the CGI form specifies. 2. A user enters data into the CGI form and clicks the submit button. This action causes the browser to process the CGI form’s action statement. 3. The browser processes the action statement, gathers all input fields as name value pairs, and passes them to a CGI call contained in the action statement. Exam ple W eb page Th e followin g W eb page con tain s a CGI form with : ! An action statement ! Input fields ! Hidden fields <HTML> <HEAD><TITLE>Forms Example</TITLE> </HEAD> <BODY> <FORM ACTION="http://www.host.com/cgi-bin/perl_9.pl" method=post> <TABLE> <TR> <TD>Name: <TD><INPUT NAME="name" SIZE="20" MAXLENGTH=20> <TR> <TD>Password: <TD><INPUT TYPE =password NAME="password" SIZE="20" MAXLENGTH=20> There is a hidden field containing data here: <INPUT TYPE=hidden NAME="hidden" VALUE="This rocks!"> Here is another hidden field: <INPUT TYPE=hidden NAME="hidden1" VALUE="Web testing is fun"> </FORM> </BODY> </HTML> Exam ple script QALoad autom ati cally gen erates all th e con structs t h at are n ecessary to m ake a CGI form request. Th e exam ple in cludes th e followin g features: ! A DO_Http call to retrieve the forms page. ! Commented description of the input fields on the page. ! GetFormValueByName commands to retrieve the values of the hidden fields from the form. ! DO_SetValue calls to store the field names and their user-entered values. ! A DO_Http call for the CGI get request. char *Field[2]; char *ActionURL[1]; ... ... for(i=0;i<2;i++) Field[i]=NULL; for(i=0;i<1;i++) ActionURL[i]=NULL; 241 Usin g th e Player, Script Developm en t W orkben ch , an d An alyze ... ... BEGIN_TRANSACTION(); ... ... /* Request: 1 */ DO_Http("GET http://www.host.com/forms.htm HTTP/1.0\r\n\r\n"); DO_VerifyDocTitle("Forms Example", TITLE); /* ActionURL[0]="http://www.host.com/cgi-bin/perl_9.pl" */ DO_GetFormActionStatement(FORM(1), &ActionURL[0]); /* Form:1 text Name: name, Value: , Desc: */ /* Form:1 text Name: password, Value: , Desc: */ /* Form:1 hidden Name: hidden, Value: This rocks! */ DO_GetFormValueByName(FORM(1), "hidden", "hidden", 1, &Field[0]); /* Form:1 hidden Name: hidden1, Value: Web testing is fun */ DO_GetFormValueByName(FORM(1), "hidden", "hidden1", 1, &Field[1]); /* Request: 2 From: Forms Example */ DO_SetValue("action_statement0", ActionURL[0]); DO_SetValue("name", "form-name"); DO_SetValue("password", "form-password"); DO_SetValue("hidden", Field[0]); DO_SetValue("hidden1", Field[1]); DO_Http("POST {*action_statement0} HTTP/1.0\r\n" "Content-Type: application/x-www-form-urlencoded\r\n" "Content-Length: {*content-length}\r\n\r\n" "{name}&{password}"); DO_VerifyDocTitle("Forms Example - Results", TITLE); ... ... for(i=0; i<2; i++) { free(Field[i]); Field[i]=NULL; } for(i=0; i<1; i++) { free(ActionURL[i]); ActionURL[i]=NULL; } END_TRANSACTION(); Overvi ew : Ex t ract i n g an d Reusi n g a St ri n g as a CGI Param et er Page requests som etim es use CGI param eter values received in a previous page respon se. Sin ce th e value is received dyn am ically, th e script m ust extract th at value from th e previous respon se an d in sert it in to th e CGI param eter list at run tim e. Scriptin g W h en you script for strin g extraction an d reuse, you m ust: ! 242 Create the variables to store the extracted string value. QALoad On lin e Help ! Modify the script to extract the string values from the page response. ! Insert the variables into the CGI parameter list. Visual Navigator W h en you use Visual Navigator, you can use th e Rule Library W izard for th is task. Con clusion By followin g th ese scripti n g tech n iques, you can m odify a Visual Scri pt to extract values from page requests an d reuse th e strin g's CGI param eter values in later page requests. You can use sim ilar scriptin g tech n iques for reusin g extracted strin gs in form val ues. Th e sam ple origin al script an d th e sam ple m odified script illustrate th e procedure for extractin g an d reusin g a strin g. Overvi ew : Ex t ract i n g an d Reusi n g a Cook i e In som e load tests, you m ay n eed to extract a cooki e an d use it later in th e script. Scriptin g To extract th e cookie, use th e DO_GetCookie(). Reuse th e value with DO_SetValue. Con clusion Th e sam ple scri pt sn ippet illustrates extractin g an d reusin g a cookie. Overvi ew : Ex t ract i n g an d Reusi n g W eb Servi ce X M L Val ues W h en testin g W eb services, data depen den cies m ay exist between XM L request data values an d XM L values return ed as part of an XM L docum en t reply earlier in th e script. You can retrieve values from a respon se con tain in g an XM L docum en t an d store th e values in a variable, by usin g a version of th e Get com m an d. You can reuse th is value as a CGI param eter, as post data, or you can substitute it into an XM L docum en t strin g sen t as part of a W eb Servi ces XM L request. To m od i f y t h e scr i p t : 1. Extract an XML value by inserting a Get command in the script after the request. 2. Ensure that the XPATH attribute is set and that the XML element is specified. Use the modified XPath syntax used by QALoad to extract text and attribute values from an XML document response page. Visual Navigator Visual Navigator provides a GUI in terface in th e Visual tree pan e. You can use th is to extract text an d attribute values from XM L docum en ts return ed as a reply, an d to param et erize text an d attribute values sen t as part of an X M L request. Con clusion By followin g th ese tech n i ques, you can extract X M L text an d attribute values from XM L docum en ts in to variables for l ater use. Th e sam ple origin al script an d th e sam ple m odified script illustrate th ese tech n iques. Th e m odified scri pt reuses th e value in a subsequen t XM L request. 243 Usin g th e Player, Script Developm en t W orkben ch , an d An alyze Overvi ew : Forci n g a Subrequest t h at i s n ot Bei n g M ade Aut om at i cal l y Occasion ally, on e of th e n ecessary subrequests th at i s recorded is n ot requested autom atically at playback tim e. Th is can be caused by com pl ex javascri pt code n ot executin g correctly, or by an ActiveX con trol th at can n ot be used at playback tim e. You can force th is subrequest by in sertin g an ADDITIONAL_SUBREQUEST statem en t. Scriptin g To request an addition al subrequest, in sert a com m an d like th e on e below before th e action statem en t (Click_On , Navigate_To, or Post_To). Set (NEXT_REQUEST_ONLY, ADDITIONAL_SUBREQUEST, "http://xyz.com/onsale.aspx"); Th is adds th e specified URL to th e list of subrequests autom atically gen erated wh en th e requested page i s parsed. Con clusion Usin g th ese tech n iques, you can m odify a script to force a subrequest. Th e sam ple m odified scri pt illustrates forcin g a subrequest. I P Spoof i n g w i t h a Local Dat apool Datapools can provide IP spoofin g addresses to scri pts on playback m ach in es. By creatin g a speci al IP spoofin g datapool for th e particular playback m ach in e, you can spoof th e correct addresses at run tim e. Not e: For the script to execute properly, the IP addresses in the local datapool must match the IP addresses bound to the network cards on the playback machine. Scriptin g W h en you m odify a Visual Script to allow for IP spoofin g for a local playback m ach in e, you m ust: ! Create a datapool file with the IP addresses associated with the network cards on the playback machine. ! Insert the required scripting code for datapool access into the script. ! Retrieve and use the spoofed IP address. Visual Navigator Visual Navigator provides GUI in terfaces in th e tree view for creatin g datapool files an d usin g spoofed IP addresses. You can use th e datapool variables as IP spoofin g addresses in th e IP spoof in terface. Con clusion By followin g th ese scripti n g tech n iques, you can m odify a Visual Scri pt to extract IP addresses from datapool files for use as spoofed addresses. Th e m odified script sam ple illustrates th e m odification s required in th e scri pt. M ovi n g t h e Tran sact i on Loop St at em en t s Load testin g a web site can require you to l og on an d log out wh en you wan t to perform m ultiple tran saction s durin g a sin gle session . You can m ove t h e BEGIN_TRANSACTION statem en t an d th e END_TRANSACTION stat em en t so th at th e virtual user does n ot log on an d l og out with every tran sact ion . 244 QALoad On lin e Help To m od i f y t h e scr i p t : 1. Move the BEGIN_TRANSACTION and RESTART_TRANSACTION_TOP statements so that they are just below any statements that log the user onto the system. 2. Keep the RESTART_TRANSACTION_BOTTOM, Clear(TRANSACTION), and END_TRANSACTION statements together and move them so that they are immediately above the Logout requests. Ti p: W h en m ovin g th e tran saction loop, you often h ave to add addition al code to clean up m em ory. Th is m ay in volve usin g th e Clear or DO_Clear statem en t to clear cookies, h eaders, values, cach e, an d so on . If a session ID cookie is set at login , it m ay n eed to be m an ually h an dled in order to clear out th e rest of th e cookies set durin g th e tran saction . Visual Navigator If you are usin g Visual Navigator, you can m ove th e Tran saction Loop statem en ts in th e tree view rath er th an in th e C++ script. Sim ply select th e Begin Tran saction item an d click th e M ove Down button un til it m oves below th e Logon pages. Do th e sam e for th e En d Tran saction by selectin g th e Tran saction Clean up tree item an d m ovin g it. An y pages after th e Tran saction Clean up, such as t h e Logout, take place after all tran saction in th e m ain loop h ave fin ish ed executin g. Sam ple Scripts Th e followin g origin al script sam ple an d m odified script sam ple sh ow a script t h at logs in to a n ewsgroup forum , perform s action s, such as readin g th reads an d replyin g to th em , an d t h en logs out. Th e scripts iden tify th e Logon an d Logout requests an d sh ow t h e old an d n ew location s of th e tran saction statem en ts. I n sert i n g cook i es i n t o a scri pt Cookie item s can be added directly to th e Htm l Page item th ey apply to, un der th e Act i on item (for exam ple, a Click on Lin k item ). To i n ser t a cook i e i t em : 1. In the Visual Navigator tree-view (left pane), navigate to the Html Page item requiring the cookie and then click on it to select it. 2. From the menu, choose Visual Navigator>Insert Tree Item>Cookie. A Cookie form-view opens in the bottom pane. 3. In the Name field, type a name for the new Cookie or click Var Wiz... to access the Select Variable dialog box where you can select a value from a datapool file or create a variable for this field. 4. In the Value field, type a value for the new Cookie or click Var Wiz... to access the Select Variable dialog box where you can select a value from a datapool file or create a variable for this field. 5. Click Save to save your changes. Th e Cookie item is added to th e script for th e select ed Htm l Page item . I n sert i n g H TTP h eader s i n t o a Vi sual Navi gat or scri pt You can in sert HTTP h eaders un der th e Com m on Http Headers tree item . To i n ser t a n ew Ht t p Head er i t em : 1. In the Visual Navigator tree-view (left pane), navigate to the Common Http Headers script item, and then click on it. 245 Usin g th e Player, Script Developm en t W orkben ch , an d An alyze 2. From the menu, choose Visual Navigator>Insert Tree Item>Http Header. An Http Header form-view opens in the bottom pane. 3. In the Name field, type a name for the new header or click Var Wiz... to access the Select Variable dialog box where you can select a value from a datapool file or create a variable for this field. 4. In the Value field, type a value for the new header or click Var Wiz... to access the Select Variable dialog box where you can select a value from a datapool file or create a variable for this field. 5. Click Save to save your changes. Th e h eader item is added to th e script, an d will be used for all requests at playback un less it is overwritten by a h eader with th e sam e n am e un dern eath an in di vidual request action . Scri pt Ex am pl es Sam ple Scripts: Persisten t Con n ection s Durin g Repl ay Th is is an option placed i n th e script to be used at replay tim e. Selectin g th is option keeps th e con n ecti on to th e server open for each request sen t to th e server. Tip: The following samples show the option as it appears in a script. Compuware recommends that you use the WWW Convert Options dialog box to convert between HTML and HTTP modes, rather than edit the script manually. C++ Script Samples Script Example with the Persistent Connections During Replay Option Selected ... // WWW Connection Settings Set(EVERY_REQUEST, REUSE_CONNECTION, TRUE); // maintain socket connection if possible ... Script Example with the Persistent Connections During Replay Option Not Selected ... // WWW Connection Settings Set(EVERY_REQUEST, REUSE_CONNECTION, FALSE); // maintain socket connection if possible ... Sam ple Scripts: M ax Con curren t Con n ection s Th is option in dicates th e m axim um n um ber of con n ection s th at a DO_Http or DO_Https com m an d open s to th e server at an y tim e. Th ese sim ultan eous con n ection s are on ly used if sub-requestin g is en abled. Tip: The following samples show the option as it appears in a script. Compuware recommends that you use the WWW Convert Options dialog box to convert between HTM L and HTTP modes, rather than edit the script manually. Th e followin g exam ple h as th e M ax Con curren t Con n ection s field set at 4. C++ Script Sample ... // WWW Connection Settings Set(EVERY_REQUEST, REUSE_CONNECTION, TRUE); // maintain socket connection if possible Set(EVERY_REQUEST, MAX_BROWSER_THREADS, 4); // total browser threads to simulate ... 246 QALoad On lin e Help Sam ple Scripts: M ax Con n ection Retries Th is option specifies th e n um ber of tim es durin g replay th at QALoad will att em pt to con n ect to th e server after tim in g out. Tip: The following samples show the option as it appears in a script. Compuware recommends that you use the WWW Convert Options dialog box to convert between HTM L and HTTP modes, rather than edit the script manually. Th e followin g exam ple h as th e M ax Con n ection Ret ries field set at 4. C++ Script Sample ... // WWW Connection Settings ... Set(EVERY_REQUEST, MAX_CONNECTION_RETRIES, 4); // maximum attempts to connect ... Navigate_To("http://www.host.com/index.htm"); ... Sam ple: Server Respon se Tim eout Th is option specifies, in secon ds, th e len gth of tim e durin g replay th at QALoad waits for data from th e server before tim in g out. Tip: The following samples show the option as it appears in a script. Compuware recommends that you use the WWW Convert Options dialog box to convert between HTM L and HTTP modes, rather than edit the script manually. Th e followin g exam ples h ave th e Ser ver Respon se Ti m eout field set at 120. C++ Script Sample ... // WWW Connection Settings ... Set(EVERY_REQUEST, SERVER_RESPONSE_TIMEOUT, 120); // Maximum time to wait for an HTTP Reply ... Navigate_To("http://www.host.com/index.htm"); ... Sam ple Scripts: Baud Rate Em ulation Use th is option to sim ulate slower con n ection s to a W eb server, such as 56 Kbps m odem or DSL. Tip: The following samples show the option as it appears in a script. Compuware recommends that you use the WWW Convert Options dialog box to convert between HTML and HTTP modes, rather than edit the script manually. C++ Script Samples In th e followin g exam ple, th e Em ulate tran sm ission baud rate ch eck box is selected an d set to 112000. Set(EVERY_REQUEST, RECEPTION_BAUD_RATE, 14400); ... // WWW Connection Settings ... Set(EVERY_REQUEST, TRANSMISSION_BAUD_RATE, 112000); 247 Usin g th e Player, Script Developm en t W orkben ch , an d An alyze ... Navigate_To("http://www.host.com/index.htm"); ... In th e followin g exam ple, th e Em ulate reception baud rate ch eck box is select ed an d set to 14400. ... // WWW Connection Settings ... Set(EVERY_REQUEST, RECEPTION_BAUD_RATE, 14400); ... Navigate_To("http://www.host.com/index.htm"); ... Sam ple: Extractin g an d Reusin g a Cookie Th e followin g sam ple is a portion of a script th at extracts an d reuses a cookie. Sample Script char * userid; char * aspsessionid; ... ... BEGIN_TRANSACTION(); ... ... /* Request: 1 */ DO_Http ("GET http://company.com/ HTTP/1.0\r\n\r\n"); /* * Get a cookie named USER_ID */ DO_GetCookie ( "USER_ID", 1, &userid ); /* * Get the second ASPSESSIONID cookie. ASPSESSIONID * cookies always have extra characters on the end to make * them unique. * * An example ASPSESSIONID: ASPSESSIONIDQQQGGQDO=EBOOONBBFH * BBELAJIMEFAKAP */ DO_GetCookie ("ASPSESSIONID*", 2, &aspsessionid ); DO_SetValue(“User”, userid) DO_Http("POST http://company.com/ HTTP/1.0\r\n\r\n” “Content-Type: application/x-www-form-urlencoded\r\n" "Content-Length: {*content-length}\r\n" “{User}”); Sam ple: M odified W W W Script for Extractin g an d Reusin g W eb Service XM L Values Th e followin g sam ple is a script sn ippet th at is m odified to extract an d reuse W eb service X M L values. Code added to th e script i s h igh ligh ted in bold. M odified code is in bold an d italicized. Sample Script Snippet ... beginning of script ... extern "C" int rhobot_script(PLAYER_INFO* s_info) { // Declare Variables // CLoadString _QALTmpVars[ 4]; CLoadString __Sum = ""; 248 QALoad On lin e Help ... more script to Request 1... //--------- REQUEST # 1 --------// Set (NEXT_REQUEST_ONLY, HEADER, "SOAPAction", "\"http://tempuri.org/Calc/action/Calc.Add\""); _QALTmpVars[0] = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>"; _QALTmpVars[0] += "<SOAP-ENV:Envelope SOAP-ENV:encodingStyle=\"\" xmlns:SOAPSDK1=" "\"http://www.w3.org/2001/XMLSchema\" xmlns:SOAPSDK2=" "\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:SOAPSDK3=" "\"http://schemas.xmlsoap.org/soap/encoding/\" xmlns:SOAP-ENV=" "\"http://schemas.xml"; _QALTmpVars[0] += "lsoap.org/soap/envelope/\">"; _QALTmpVars[0] += "<SOAP-ENV:Body SOAP-ENV:encodingStyle=" "\"http://schemas.xmlsoap.org/soap/encoding/\">"; _QALTmpVars[0] += "<m:Add xmlns:m=\"http://tempuri.org/Calc/message/\" " "SOAP-ENV:encodingStyle=\"\">"; _QALTmpVars[0] += "<A SOAP-ENV:encodingStyle=\"\">10</A>"; _QALTmpVars[0] += "<B SOAP-ENV:encodingStyle=\"\">5</B>"; _QALTmpVars[0] += "</m:Add>"; _QALTmpVars[0] += "</SOAP-ENV:Body>"; _QALTmpVars[0] += "</SOAP-ENV:Envelope>"; Set(NEXT_REQUEST_ONLY, XML_DATA, (char *)_QALTmpVars[0]); XmlRequest( "POST", "http://mssoapsampleserver/MSSoapSamples30/Calc/Service/SrSz/AspVbsCpp/Calc." "asp" ); strSum = Get ( XML, TEXT, "/SOAP-ENV:Envelope[1]/SOAP-ENV:Body[1]/m:AddResponse[1]/Result[1]" ); //--------- REQUEST # 2 --------// Set (NEXT_REQUEST_ONLY, HEADER, "SOAPAction", "\"http://tempuri.org/Calc/action/Calc.Multiply\""); _QALTmpVars[1] = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>"; _QALTmpVars[1] += "<SOAP-ENV:Envelope SOAP-ENV:encodingStyle=\"\" xmlns:SOAPSDK1=" "\"http://www.w3.org/2001/XMLSchema\" xmlns:SOAPSDK2=" "\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:SOAPSDK3=" "\"http://schemas.xmlsoap.org/soap/encoding/\" xmlns:SOAP-ENV=" "\"http://schemas.xm"; _QALTmpVars[1] += "lsoap.org/soap/envelope/\">"; _QALTmpVars[1] += "<SOAP-ENV:Body SOAP-ENV:encodingStyle=" "\"http://schemas.xmlsoap.org/soap/encoding/\">"; _QALTmpVars[1] += "<m:Multiply xmlns:m=\"http://tempuri.org/Calc/message/\" " "SOAP-ENV:encodingStyle=\"\">"; // Original value: <A SOAP-ENV:encodingStyle=\"\">10</A> // Variablized value: <A SOAP-ENV:encodingStyle=\"\">{$ VAR:Sum $}</A> _QALTmpVars[1] += "<A SOAP-ENV:encodingStyle=\"\">"; _QALTmpVars[1] += __Sum; _QALTmpVars[1] += "</A>"; _QALTmpVars[1] += "<B SOAP-ENV:encodingStyle=\"\">5</B>"; _QALTmpVars[1] += "</m:Multiply>"; _QALTmpVars[1] += "</SOAP-ENV:Body>"; _QALTmpVars[1] +="</SOAP-ENV:Envelope>"; Set(NEXT_REQUEST_ONLY, XML_DATA, (char *)_QALTmpVars[1]); XmlRequest( "POST", "http://mssoapsampleserver/MSSoapSamples30/Calc/Service/SrSz/AspVbsCpp/Calc.asp" ); ... rest of script ... 249 Usin g th e Player, Script Developm en t W orkben ch , an d An alyze Sam ple: M odified Script for Forcin g a Subrequest In th is exam ple, on e of th e pages h as an ActiveX object associated with it th at autom atically gen erates a request for item s th at are on sale. However, at playback th is request is n ot m ade because ActiveX obj ects are n ot executed at pl ayback tim e. To force th is subrequest, you can in sert an Addition al Subrequest item just before th e action stat em en t. Relevan t statem en ts are sh own in bold. Sample Script //--------- REQUEST # 5 (see action item on Page 4) --------// // current page url is http://xyz.com/chairs.htm // Set (NEXT_REQUEST_ONLY, ADDITIONAL_SUBREQUEST, "http://xyz.com/onsale.aspx"); Click_On(LINK, 1, DESCRIPTION, "Nuts and Bolts"); Verify(PAGE_TITLE, "Nuts and Bolts"); Sam ple: M odified Script for IP Spoofin g with a Local Datapool Th is sam ple sn ippet sh ows th e scriptin g required to open an d access th e datapool an d use th e extracted IP address as a spoofed address. Poin ts of in terest an d m odified code in th e script are h igh ligh ted in bold. Sample Script Snippet ... beginning of script ... // Before the SYNCHRONIZE command, add a #define to // identify the datapool file and a call to // OPEN_DATA_POOL to open the datapool file // (Note: the datapool file name is “ipspoof.dat”) #define IPSPOOF_DP 1 /* identifier for datapool file */ OPEN_DATA_POOL("ipspoof.dat", IPSPOOF_DP, TRUE); SYNCHRONIZE(); BEGIN_TRANSACTION(); RESTART_TRANSACTION_TOP(); // do not modify this statement // After the start of transaction, read the data record, and // use the Set command to specify that this value is to // be used as the spoofed IP address for every request. READ_DATA_RECORD(IPSPOOF_DP); Set (EVERY_REQUEST, SPOOFED_IP_ADDRESS, GET_DATA_FIELD (IPSPOOF_DP, 1) ); ... rest of script ... Sam ple: Origin al W W W Script Sh owin g th e Tran saction Loop Th e followin g sam ple sh ows th e origin al script. Th e section s in italics are th e requests in volved with th e Login an d Logout. Th e origin al location s of th e tran saction statem en ts are sh own in bold. Sample Script SYNCHRONIZE(); BEGIN_TRANSACTION(); RESTART_TRANSACTION_TOP(); // do not modify this statement //--------- REQUEST # 1 --------// Set (NEXT_REQUEST_ONLY, CHECKPOINT_NAME, "Page 1 - "); Navigate_To("http://www.myforum.org/"); Verify(PAGE_TITLE, "My woodworking forum - powered by vBulletin"); DO_SLEEP(9); 250 QALoad On lin e Help //--------- REQUEST # 2 (see action item on Page 1) --------// // current page url is http://www.myforum.org/ // // The submit button for this form could not be positively identified so // an appropriate action has been added (Post_To or Navigate_To). The // values for the form fields will be set using Set( ) statement. // Set(NEXT_REQUEST_ONLY, POST_DATA, "vb_login_username", "John Smith"); Set(NEXT_REQUEST_ONLY, POST_DATA, "cookieuser", "1"); Set(NEXT_REQUEST_ONLY, POST_DATA, "vb_login_password", ""); Set (NEXT_REQUEST_ONLY, POST_DATA, "s", "3669625a913735e99e31ec9a866a2f28"); Set (NEXT_REQUEST_ONLY, POST_DATA, "do", "login"); Set (NEXT_REQUEST_ONLY, POST_DATA, "forceredirect", "1"); Set (NEXT_REQUEST_ONLY, APPEND_CRLF_AFTER_POST_BODY, TRUE); Set (NEXT_REQUEST_ONLY, POST_DATA, "vb_login_md5password", "df0349ce110b69f03b4def8012ae4970"); Set (NEXT_REQUEST_ONLY, CHECKPOINT_NAME, "Page 2 - "); Post_To("http://www.myforum.org/login.php"); Verify(PAGE_TITLE, "My Woodworking Forum"); DO_SLEEP(3); //--------- REQUEST # 4 (see action item on Page 3) --------// // current page url is http://www.myforum.org/ // Set (NEXT_REQUEST_ONLY, CHECKPOINT_NAME, "Page 4 - "); Click_On(LINK, 1, DESCRIPTION, "Tables and Chairs"); Verify(PAGE_TITLE, "My Woodworking Forum – Tables and Chairs"); DO_SLEEP(2); //--------- REQUEST # 5 (see action item on Page 4) --------// // current page url is http://www.myforum.org/forumdisplay.php?f=17 // Set (NEXT_REQUEST_ONLY, CHECKPOINT_NAME, "Page 5 - "); Click_On(LINK, 1, DESCRIPTION, "Log Out"); Verify(PAGE_TITLE, "My Woodworking Forum"); RESTART_TRANSACTION_BOTTOM(); // do not modify this statement Clear ( TRANSACTION ); END_TRANSACTION(); DO_FreeHttp(); EXIT(); return(0); Sam ple: M odified W W W Script for M ovin g th e Tran saction Loop Statem en ts Th e followin g sam ple sh ows th e script m odified to m ove th e tran saction loop statem en ts. Th e section s in italics are th e requests in volved with th e Logon an d Logout. Th e n ew location s of th e tran saction statem en ts are sh own in bold. 251 Usin g th e Player, Script Developm en t W orkben ch , an d An alyze Sample Script SYNCHRONIZE(); //--------- REQUEST # 1 --------// Set (NEXT_REQUEST_ONLY, CHECKPOINT_NAME, "Page 1 - "); Navigate_To("http://www.myforum.org/"); Verify(PAGE_TITLE, "My woodworking forum - powered by vBulletin"); DO_SLEEP(9); //--------- REQUEST # 2 (see action item on Page 1) --------// // current page url is http://www.myforum.org/ // // The submit button for this form could not be positively identified so // an appropriate action has been added (Post_To or Navigate_To). The // values for the form fields will be set using Set( ) statement. // Set(NEXT_REQUEST_ONLY, POST_DATA, "vb_login_username", "John Smith"); Set(NEXT_REQUEST_ONLY, POST_DATA, "cookieuser", "1"); Set(NEXT_REQUEST_ONLY, POST_DATA, "vb_login_password", ""); Set (NEXT_REQUEST_ONLY, POST_DATA, "s", "3669625a913735e99e31ec9a866a2f28"); Set (NEXT_REQUEST_ONLY, POST_DATA, "do", "login"); Set (NEXT_REQUEST_ONLY, POST_DATA, "forceredirect", "1"); Set (NEXT_REQUEST_ONLY, APPEND_CRLF_AFTER_POST_BODY, TRUE); Set (NEXT_REQUEST_ONLY, POST_DATA, "vb_login_md5password", "df0349ce110b69f03b4def8012ae4970"); Set (NEXT_REQUEST_ONLY, CHECKPOINT_NAME, "Page 2 - "); Post_To("http://www.myforum.org/login.php"); Verify(PAGE_TITLE, "My Woodworking Forum"); BEGIN_TRANSACTION(); RESTART_TRANSACTION_TOP(); // do not modify this statement DO_SLEEP(3); //--------- REQUEST # 4 (see action item on Page 3) --------// // current page url is http://www.myforum.org/ // Set (NEXT_REQUEST_ONLY, CHECKPOINT_NAME, "Page 4 - "); Click_On(LINK, 1, DESCRIPTION, "Tables and Chairs"); Verify(PAGE_TITLE, "My Woodworking Forum – Tables and Chairs"); DO_SLEEP(2); All additional Requests that will occur every transaction RESTART_TRANSACTION_BOTTOM(); // do not modify this statement Clear ( TRANSACTION ); END_TRANSACTION(); //--------- REQUEST # 5 (see action item on Page 4) --------// // current page url is http://www.myforum.org/forumdisplay.php?f=17 // Set (NEXT_REQUEST_ONLY, CHECKPOINT_NAME, "Page 5 - "); Click_On(LINK, 1, DESCRIPTION, "Log Out"); Verify(PAGE_TITLE, "My Woodworking Forum"); DO_FreeHttp(); EXIT(); 252 QALoad On lin e Help return(0); Sam ple: Preven tin g Un wan ted Subrequests Th e followin g sam ple uses a filter strin g to preven t th e un wan ted subrequest. Poin ts of in terest are h igh lighted in bold. Sample Script Set (EVERY_REQUEST, BLOCK_TRAFFIC_FROM, "AcmeAds"); SYNCHRONIZE(); BEGIN_TRANSACTION(); RESTART_TRANSACTION_TOP(); // do not modify this statement //--------- REQUEST # 1 --------// Set (NEXT_REQUEST_ONLY, CHECKPOINT_NAME, "Page 1 - "); Navigate_To("http://www.mystore.com/"); Verify(PAGE_TITLE, "Jack’s Hardware Store"); etc. SSL EasyScri pt Sessi on s EasyScript for Secure W W W supports SSL/ HTTPS requests wh en used in con j un ction with th e W W W m iddleware. W h en you first open th e Script Developm en t W orkben ch , you can set gen eral option s related to wh ich pan es to display, your com piler, an d so on , but you can n ot begin an y m iddl eware-specific activities, such as recordin g a tran saction , un til you open an EasyScript Session . Open in g an EasyScript Session tailors t h e Script Developm en t W orkben ch to a specific m iddleware en viron m en t, providin g you with all th e appropriate option s an d fun ction s for your scri ptin g n eeds. To open an EasyScript Session , ch oose your m iddleware type from th e Session m en u, or click th e appropriate toolbar button . On ce a session is open , th e W orkben ch in terface ch an ges. Not e: The .NET session opens in Microsoft Visual Studio. For more information on .NET sessions, see Overview of the QALoad .NET Sessions. You can also open a Un iversal session to record calls from m ultiple m iddlewares with in a sin gle session. I m port i n g a Cl i en t Cert i f i cat e f rom a W eb Brow ser (SSL) You can im port an d con vert a Clien t Certificate for an y W eb site you pl an to visit. To i m p or t a cl i en t cer t i f i cat e: 1. Start your Web browser. 2. From the browser, select the Client Certificate for the Web site you plan to visit. 253 Usin g th e Player, Script Developm en t W orkben ch , an d An alyze 3. Export the Client Certificate (.p12 of .pfx file) to a directory where you can access it using the Script Development Workbench. Not e: When the browser prompts you to enter a password, do not enter a password. If you enter a password, QALoad cannot process the file. 4. Start a WWW Session in the QALoad Script Development Workbench. 5. Click Tools>Maintain Certificates to open the SSL Certificate Maintenance dialog box. 6. On the Client Certificates tab, click the browse button [...] to browse for the Client Certificate you want to convert. The Select the Exported Client Certificate to Convert dialog box opens. 7. Make sure Files of Type specifies P12 files (*.p12) or PFX files (*.pfx). 8. Select the appropriate Client Certificate and click Open. The path and file name of the selected Client Certificate appears in Enter Certificate to Convert on the Client Certificates tab. 9. On the Client Certificates tab, click Convert. 10. Click Close to exit the SSL Certificate Maintenance dialog box. Creat i n g a Cl i en t Cert i f i cat e i n QALoad (SSL) Th is procedure assum es you h ave a W W W session active. To cr eat e a cl i en t cer t i f i cat e: 1. From the Tools menu, select Maintain Certificates to open the SSL Certificate Maintenance dialog box. 2. On the Client Certificates tab, enter a name in the Certificate Name field. 3. Enter the number of certificates to create. 4. Click the Create button to create the QALoad Client Certificate. QALoad stores it in the QALoad\Certificates directory. Not e: On the Unix player platform, you must create the Certificates sub-directory in the QALoad directory. The directory name is case sensitive. 5. If necessary, configure your Web server to accept QALoad as the Certificate Authority. Refer to your Web server documentation for more information. Creat i n g an SSL Cert i f i cat e Aut h ori t y Note th at creatin g a n ew CA in validates all previously created clien t certificat es. To cr eat e an SSL Cer t i f i cat e Aut h or i t y: 1. Start a WWW session. 2. From the Tools menu, select Maintain Certificates. 3. Click the Certificate Authority tab. 4. Click the Create button to create a new Certificate Authority with the expiration date shown in the field. 5. Exit and re-start the Script Development Workbench. 6. After creating a new Certificate Authority, re-import the CA to your Web server and then create new Client Certificates. Creat i n g an SSL Server Cert i f i cat e 254 QALoad On lin e Help To cr eat e an SSL Ser ver Cer t i f i cat e: 1. Start a WWW session. 2. From the Tools menu, select Maintain Certificates. 3. Click the Server Certificate tab. 4. Click the Create button to create a new Server Certificate with the expiration date shown in the field. Editing Scripts I n t roduci n g Vi sual Scri pt i n g Visual Navigator for W W W is QALoad's easy-to-use visual in terface to QALoad's powerful script developm en t tools. Visual Navigator for W W W ren ders your recorded C++-based tran saction in a tri-pan ed, browser-like en viron m en t sim ilar to popular visuall y-orien ted developm en t tools, with icon s represen tin g all th e elem en ts of your script. In fact, you could set up an d run a W W W scri pt with out ever h avin g to m odify a C++-based scri pt. W ith Visual Navigator's advan ced editin g features, you don 't h ave to kn ow t h e syn tax of QALoad's com m an d set or your HTM L requests or respon ses t o custom ize your script. You can qui ckly an d easily: ! See what URL calls were made and what type they were (for example a POST or GET statement) ! See what information was passed in a call ! See what replies/pages were returned ! Add checkpoints or comments into your script ! Move the begin/end transaction statement ! Move the synchronize statement ! Edit an HTTP header ! Set particular flags and commands ! Add datapools ! Parameterizing your script ! Extract information from a reply to use in subsequent calls ! Save your script and go back to it at any time for further editing ! Create a C++-based script file, if you like Vi sual Navi gat or M en us Th e Visual Navigator h as a n um ber of speci al m en u com m an ds to h elp you develop your script. Visual Navigator M en u Edit M en u Tools M en u Visual Navigator M en u 255 Usin g th e Player, Script Developm en t W orkben ch , an d An alyze Th e Visual Navigator m en u is th e m ain m en u for Visual Scriptin g. Access th e Visual Navigator m en u from th e Script Developm en t W orkben ch 's m ain m en u, or righ t-click on an y item in th e Visual Navigator treeview (left pan e). Dat apool s an d Vari abl es: Open s th e Datapools an d Variables dialog box, wh ere you can add, delete, or m odify dat apool files or variables. Vi ew Scri pt Fi l e: Open s a win dow sh owin g th e C++ (.cpp) file based on wh at is curren tly sh owin g in the Visual Navigator's tree-view. Th is is a read-on ly scri pt. Creat e Edi t abl e Scri pt Fi l e: Creates an editable C++ (.cpp) scri pt based on th e curren t Visual Script. You can m odify th is script directly; h owever, an y ch an ges m ade to th e script will n ot be reflected in th e tree an d vise-versa. Sh ow H i dden Fi el ds: Displays form fields th at are h idden by th e browser. Sh ow Redi rect ed Pages (3x x ):Toggles wh eth er or n ot redirected pages are di splayed. Th ese are pages t h at com e back with a reply st atus code of 3xx, for exam ple: 302 Not Found. Sh ow Aut h en t i cat i on Pages (401 an d 407): Toggles wh eth er or n ot Auth en tication pages are displayed. Th ese are pages th at com e back with a repl y status code of 401 Unauthorized or 407 Proxy Authentication Required. I n sert Tree I t em : Open s a sub-m en u wh ere you can ch oose to in sert cert ain tree item s in to your script. For details, see In sertin g script item s. Del et e Tree I t em : Del etes th e curren tly selected tree item . If th e selected item m ay n ot be deleted from th e script, th is com m an d is un available. Vi ew Source: Open s a text win dow displayin g th e source code of th e curren tly active HTM L Page or Subrequest in th e tree view. Edit M en u Th e Script Developm en t W orkben ch Edit m en u provides special com m an ds for Visual Navigat or fun ction ality as well as com m on Edit m en u com m an ds. Access th e Edit m en u from th e m ain m en u, or righ t-click on an edit box th at can be vari ablized in th e Visual Navigator form -view (bottom pan e). Fiel ds th at can be vari ablized are den oted with a Var button . Th e com m an ds on th e Edit m en u are dyn am ic an d th e availability of certain com m an ds depen ds upon wh eth er you h ave text selected an d wh ere your cursor is. Th e followin g graph ics illustrate th e differen ce: 256 QALoad On lin e Help I n sert Vari abl e/ Subst i t ut e w i t h Vari abl e: Open s th e Datapools an d Variabl es dialog, allowin g you to in sert a variable or repl ace th e selected text with a variable. Substituted text will refer to a local variable or datapool variable an d will look sim ilar to on e of th e followin g exam ples: {$ VAR:Customer Number $} {$ VAR:Last Name:Customer Data $} Th ese com m an ds are on ly available wh en th e cursor is placed in an edit box on a tree-view item th at can be variablized (you will see Var or Var W iz n ext to it). I n sert Ran dom Val ue/ Subst i t ut e w i t h Ran dom Val ue: Open s th e Ran dom Num ber Tag dialog box wh ere you can specify a ran ge wi th in wh ich a ran dom n um ber sh ould be gen erated for th is value. Th e substituted text looks like th is: {$ RANDOM:0:100 $} an d it produces a ran dom n um ber between th e lower an d upper lim it each tim e it is executed. Th ese com m an ds are on ly available wh en th e cursor is placed in an edit box on a tree-view item th at can be variablized (you will see Var n ext to it). I n sert VU Num ber/ Subst i t ut e w i t h VU Num ber (Absol ut e): In serts or replaces th e h igh ligh ted text with th e followin g text: {$ VU:ABS $} Th is is th e virtual user n um ber at run tim e. Th e absolute virtual user n um ber is assign ed depen din g on th e n um ber of Players in use. For exam ple, two Player m ach in es with 50 virtual users on each , woul d assign n um bers 0 th rough 49 for Player 1 an d 50 th rough 99 for Player 2. Typically, th e VU n um ber is com bined with oth er text to form a larger strin g, such as: Customer{$ VU:ABS $} In th is exam ple, Player 1 h as values of Custom er0 th rough Custom er49, an d Player 2 h as values of Custom er50 th rough Custom er99. Th ese com m an ds are on ly available wh en t h e cursor is placed in an edit box on a tree-view item t h at can be variablized (you will see Var or Var W iz n ext to it). I n sert VU Num ber/ Subst i t ut e w i t h VU Num ber (Rel at i ve): In serts or replaces th e h igh ligh ted text with th e followin g text: 257 Usin g th e Player, Script Developm en t W orkben ch , an d An alyze {$ VU:REL $} Th is is th e virtual user n um ber at run tim e. Th e relative virtual user n um ber is assign ed to each Player in use. Each Player h as relati ve n um bers from 0 to N, wh ere N is th e total n um ber of VUs run on th at Player. For exam ple, two Player m ach in es with 50 virtual users on each , woul d assign n um bers 0 th rough 49 to each Player. Typi cally, th e VU n um ber is com bin ed with oth er text to form a larger strin g, such as: Customer{$ VU:REL $} In th is exam ple, Player 1 h as values of Custom er0 th rough Custom er49, an d Player 2 h as values of Custom er0 th rough Custom er49. Th ese com m an ds are on ly available wh en th e cursor is placed in an edit box on a tree-view item t h at can be variablized (you will see Var n ext to it). Revert t o Ori gi n al St ri n g: Rolls th e con ten ts of th e selected edit box back to wh en it was first created, usually wh en th e recordin g was con verted to a Visual Script. Th is m en u item is en abled on ly if th e edit box with in th e form can be variablized an d it h as been ch an ged at som e poin t. Del et e Vari abl e Ref er en ce: Deletes th e vari able from th e selected edit box. Note th at you can also h igh light a variable an d press th e Delete key to delete a vari able with in an edit box. Th is m en u item becom es en abled wh en you h igh ligh t a variable in side of an edit box. Tools M en u Th e Script Developm en t W orkben ch Tools m en u provides access to th e Rule Library for param eterizati on , th e ZipFile wizard for coll ectin g files n eeded by th e Tech n ical Support team t o an alyze an d resolve a problem , an d com m on Tools m en u com m an ds. Access th e Tools m en u from th e Script Developm en t W orkben ch m ain m en u. Rul e Li brary: Open s th e Rule Library di alog box, wh ere you can add, delete, or m odify saved Variable Repl acem en t Rules. Vi sual Navi gat or's Fi n d an d Repl ace Feat ure Visual Navigator h as an en h an ced Fin d/ Replace feature th at allows you to fin d occurren ces of strin gs with in th e tree-view, allowin g you to quickly locat e an d/ or repl ace text. For exam ple, you could fin d occurren ces of Smith an d replace th em all with th e datapool variable {$ Last Nam e:User In fo $}. To access Vi sual Navi g at or 's Fi n d f eat ur e: 1. Select Edi t >Fi n d in th e toolbar. Th e Fin d an d Replace dial og box displays with th e Fin d tab on top. 258 QALoad On lin e Help 2. En ter th e appropri ate option s an d click Fi n d Nex t . W h en all m atch es are foun d, close th e dialog box or click Repl ace to use th e Repl ace feature. To access Vi sual Navi g at or 's Rep l ace f eat ur e: 1. Select Edit>Replace in the toolbar. The Find and Replace dialog box displays with the Replace tab on top. 2. Enter the appropriate options. 3. Do one of the following: 4. ! Click Fi n d Nex t to review each iden tified variable before replacin g it. ! Click Repl ace Al l to replace all variables with out reviewin g th em . Close the Find Replace dialog box. Cut , Copy, an d Past e i n t h e Vi sual Navi gat or Tree Cut, copy, an d paste is available for th e Extract Strin g, Cookie, Http Header, Con ten t Ch eck, CGI Param eter, Prin t Values (debuggin g), an d Com m en t tree item s. Cut, copy, an d paste con sideration s: ! It is possible to cut, copy, and paste across different scripts. ! An error message appears if it is not possible to paste in selected location. ! With Extract String items, variables are not copied and paste results in new variable assignments in the selected paste location. ! With Extract String items, the instance match in the copied item defaults to 1 regardless of the number of instances in the source if the target does not have the same number of instances as the source. ! CGI Parameter items are copied exactly, including variables. To cut , cop y, an d p ast e an i t em : 1. Select the item to cut or copy. 2. Either right-click and select Cut or Copy, choose Edit>Cut or Edit>Copy, or press <CTL>+X or <CTL>+C. 3. Choose destination for copied or cut item. 4. Either right-click and select Paste, chose Edit>Paste, or press <CTL>+V. Look i n g at a Tran sact i on Loop Th e tran saction loop is th e portion of your scri pt th at is played back repeatedl y, represen tin g m ultiple users m akin g requests. Th e elem en ts in your tran saction loop depen d on wh at was origin ally recorded on each page you requested. You can m ove th e tran saction loop up or down in t h e tree-view usin g th e arrow button s, to allow certain requests to be m oved in or out of th e Tran saction Setup area, wh ere th ey will be executed before begin n in g th e tran saction loop. Not e: The following graphic does not show all the possible script elements, but gives a good representation of what your transaction loop might look like in the Visual Navigator. High -level script item s 259 Usin g th e Player, Script Developm en t W orkben ch , an d An alyze Th ere are th ree h igh -level script item s in th e tran saction loop th at represen t th e web pages you've recorded. NavigateTo, HTM L Pages, an d XM L Requests: Navi gat eTo: Th is is always th e first item un der th e Tran saction Loop elem en t , an d is always den oted wi th an arrow i con . It lists th e URL th at was typed in to th e web browser at th e start of recordin g. Th is specifi es th e first request to be m ade. Th e result of th is request is th e n ext item in th e tree, wh ich is gen erally an HTM L Page item . If th e first item is an HTTP request for XM L data, it will appear as an XM L Request item in th e tree. Page (H TM L): Followin g NavigateTo th ere will typi cally be a set of HTM L Page item s, wh ich are always den oted with a globe icon un dern eath th e Tran sacti on Loop elem en t. Th ese represen t pages visited wh i le th e tran saction was bein g recorded. Th e form -view (bottom pan e) lists th e request's reply status, th e requested URI, an d th e associ ated ch eckpoin t n am e for th e page return ed. HTM L Page item s can be paren t to a n um ber of scri pt item s in th e tree-view, such as Action item s. For m ore in form ation about sub-item s th at can exist under a Page item , see HTM L Page sub-item s. X M L Request : Requests for XM L docum en ts are den oted by a docum en t/ arrow icon un dern eath th e Tran saction Loop elem en t . Th ese represen t th e requests for XM L data m ade durin g th e tran saction th at was recorded. XM L Request item s can be paren t to a n um ber of lower-level script sub-item s in th e treeview, such as Header an d Cookie item s an d th e Xm lRepl y docum en t item . See XM L requests to learn about sub-item s th at can exist un der an XM L Request item . St ream i n g M edi a i n Vi sual Navi gat or If you selected th e Stream in g M edia option on th e W W W Advan ced con versi on option s dialog box before recordin g your script, an d th e recorded tran saction con tain s RealOn e Player or W in dows M edi a stream i n g requests, your stream in g m edia request will be presen ted as a Page in th e tree-view, sim ilar to th e followin g graph ic: Th e form -view (bottom pan e) for a stream in g m edia page sh ows th e title Real Media Request or W indows Media Request to in dicate th e type of request you recorded, an d lists th e followin g fields: Request ed URI : Lists th e requested URI th at in voked th e m edia player. For Real M edia th e file typically is an RM file, wh ile for W in dows M edi a it is typically an ASX file. Pl ay M edi a Request : Select th is ch eck box for th e virtual user to process th e RM or ASX fil e th at is received an d m ake th e n ecessary requests to duplicate wh at th e clien t perform ed wh ile receivin g th e stream in g m edia. If th is ch eckbox is n ot selected, t h en n o furth er processin g is perform ed after receivin g th e RM or ASX file. Pl ay Request ed M edi a f or N secon ds: You can specify h ow m uch of th e stream in g m edia file th e virtual user sh ould play, in secon ds, before m ovin g on to t h e n ext request. A value of zero in dicates th at th e en tire m edia stream sh ould be played. Not e: While a virtual user is playing a media request it will not make any other requests in the transaction loop. This may be different than what the user performed when recording the transaction because a browser is capable of spawning the streaming media player as a separate executable which can execute at the same time that the user continues to make further web requests in the browser. 260 QALoad On lin e Help Con f i gurat i on s Set t i n gs Variables Th ese are local vari ables th at h ave been created for th is script. W h en you h igh ligh t a variable in th e tree view, th e fields display data related to th e variable t ype you selected. For in form ation about param eterization , see Param eterization . W W W Playback Option s Th is item con tain s settin gs related to pl ayback such as proxy settin gs, tim e out value, n um ber of con curren t con n ection s, baud rate em ulation , an d filters. Parsin g Cach in g Traffic Filters Con n ection Settin gs Con ten t Type Han dlin g Proxy Gen eral Siebel Param eterization Rules Lists Param eterization Rul es th at you create wh en you defin e a variable to substitute for a value. Savin g th e variable as a rule en ables you to reuse it for oth er i n stan ces of th e vari able. W h en you click Param et eri zat i on Rul es in th e Visual Navigat or tree-view, det ails of th e rules stored in th e Rule Library appears in th e righ t-h an d pan e. Not es: ! Properties for th e rules are defin ed usin g th e Rule Library W izard or th e Vari able Repl acem en t W izard. ! An exclam ation m ark (! ) i n th e first colum n , sign ifies th at th e rule m atch es th e sam e param eter as an oth er rule defin ed in th e script. Th e rule applied first preven ts th e oth er rules from bein g applied. Rules are applied in th e order th ey are displ ayed in th e table. Rul e Nam e: Nam e of th e rule. M at ch i n g I t em : Nam e of th e item with in th e script th at m atch es th e param et ers defin ed in th e rule an d th at will be replaced with th e rule. M at ch i n g Ty pe: Th e type of item with in a script th at is replaced by th is rule. Item types in clude: ! CGI Parameter ! Cookie ! Header ! EditBox ! RadioButton ! TextBox Fi el ds Repl aced: Fields of th e m atch in g item th at are replaced by th is rule. Fields m ay be: ! Name ! Value 261 Usin g th e Player, Script Developm en t W orkben ch , an d An alyze ! Both name and value Appl y: Appl y th e selected rule. Appl y Al l : Apply th e rule to all m atch in g item s in th e script. Un do Appl y: Rem ove th e rule from m atch in g item s in th e script. Edi t : Open s th e Rule Library W izard so you can edi t th e rule. Dupl i cat e: Duplicates th e selected rule in th e list. Del et e: Deletes th e rule from th e script. Th e rule rem ain s in th e library. Add t o Li brary: Adds th e rule to th e Rule Library. On ly rules in th e Rule Library can be applied to future scripts. Not e: You can create a rule using the Variable Replacement Wizard without adding it to the library. Got o Rul e: Displays detail s for th e selected rule. Get f rom Li br ary: Open s th e Get Rule from Library dialog box. Select a rule to add to th e visual tree. Datapool Files Lists datapool files bein g called by th e script. Each datapool listed h as a list of variables un der it represen tin g colum n s in th e datapool file. Datapool s can be Local (specific to a sin gle Player), Sh ared (sh ared with oth er players on a workstation ), or Cen tral (available to all Players). Vi rt ual User s Act i on s Tran saction Setup Lists an y action s th at occurred before th e m ain tran saction loop. An y item s/ action s th at occur un der t h is h eadin g will be executed after th e Syn ch ron ize but before th e BEGIN_TRANSACTION(); statem en t at playback. For exam ple, you m ay h ave logged in to a particular W eb site an d do n ot wan t to log in an d out with every tran saction at playback. You can m ove t h e Tran saction Setup item in th e tree-view by h igh lightin g it an d clickin g th e M ove UP/ M ove DOW N button s. Th e Tran saction Setup can con tain cli en t certificate tree item s. Sleep Sub-item Every page h as a Sl eep item im m ediately before its Act i on item . Th e sleep value specifies h ow m an y secon ds were spen t vi ewi n g th is page (or fillin g out a form ) before an action was taken (such as clickin g on a lin k or button ). 262 QALoad On lin e Help Tran saction Clean up Lists action s th at occur aft er th e script h as fin ish ed executin g th e appropriate n um ber of tran saction s. An y item s th at occur un der th is h eadin g are pl aced after th e END_TRANSACTION statem en t. For exam ple, you m ay wan t to log out of a particular W eb site after com pletin g th e appropriat e n um ber of tran saction s. M ove UP/ M ove DOW N: Click th e arrow to m ove th e selected tran saction clean up item in th e tree-view up or down . Com m en t In serts a Com m en t item after th e curren tly select ed HTM L page. Type your com m en t in to th e form -view (bottom pan e). Prin t Values (debuggin g) In serts a Debug Pri n t item after th e curren tly selected HTM L Page. Th is causes a strin g to be output to th e Player win dow durin g playback. Th is can be useful for debuggin g a script wh ile you are tryin g to variabl ize it so th at it replays correctly with m ultiple virtual users. In crem en t Variable/ Decrem en t Variable/ Reset Vari able Open s th e Datapools an d Variables dialog box, wh ich allows you to select wh ich variable to in crem en t, decrem en t, or reset. It th en in serts th e appropriate i tem (I n crem en t Vari abl e, Decr em en t Vari abl e, Reset Vari abl e) after th e curren tly selected HTM L page. Ch eckpoin t Pair In serts a Begi n Ch eck poi n t item before th e curren tly selected HTM L Page an d an En d Ch eck poi n t after th e curren tly selected HTM L Page. Ch eckpoin ts are used to m easure duration tim es for certain action s to be com pleted. You can m ove ei th er th e Begi n or En d ch eckpoin t item to en com pass several requests, if n ecessary. To m ove eith er item , h igh light it an d th en click M ove Up/ M ove Dow n in th e form -view. Read Dat apool 263 Usin g th e Player, Script Developm en t W orkben ch , an d An alyze Open s th e Datapool an d Variables dialog box, allowin g you to ch oose wh i ch datapool to use, an d th en in serts a Read Dat apool item im m ediately after th e curren tly selected HTM L Page. You can m ove th is item up or down th e tree-view by clickin g Up/ Dow n in th e form -view. Syn ch In serts a Syn ch item im m ediately after th e curren tl y selected HTM L Page. A Syn ch item represen ts a spot wh ere all virtual users will pause durin g replay un til all active virtual users h ave reach ed th e sam e poin t . On ce th e virtual users are syn ch ron ized th is way, th e Con ductor will in struct th em all to con tin ue. A Syn ch item can be m oved up or down th e tree usi n g Up/ Dow n in th e form -view. Tran saction Loop Lists th e requests in your tran saction . All item s/ acti on s th at occur un der th is h eadin g are pl aced between th e BEGIN_TRANSACTION an d END_TRANSACTION statem en ts, causin g th em to be repeated for as m an y tim es as th e Con ductor tells th em to be. Th e tran saction loop h as a n um ber of possible sub-elem en ts, depen din g on th e W eb site you tested. For detailed description s of th e elem en ts th at can be listed in a tran saction loop, see Lookin g at a tran saction loop. W W W Request Act i on s CGI Param eters Sub-item Lists CGI param eters sen t alon g with th e request m ade by th e Action item . If th e En abl e An ch or an d Form Fi el d Ex t ract i on option is selected in th e Gen eral W W W Con version Option s, h idden fields appear in as sub-item s of CGI param eters. Cookies sub-item 264 QALoad On lin e Help W h en a Cookie item is a sub-elem en t of an Action item , it con tain s a list of cookie item s th at were sen t in th e h eader of th e request th at th e Action item m ade wh en recordin g. Cookies are added autom atically by th e browser based on th e URI th at is bein g requested. Th ey are eith er set as a result of th e previous repl y (th e server return ed a Set-Cookie com m an d), or th ey are set by JavaScript con tain ed in th e previous reply. If th e Cookie sh own h as a m atch in g Set-Cookie item , th en n oth in g will display in th e script sin ce th e cookie is created autom ati cally durin g playback. If t h ere is n o m atch in g Set-Cookie item , th en a Set-Cookie type statem en t will be gen erated in th e script. You can in sert addition al cookies in to th e Cookies section of a page as an oth er m ean s of vari ablizin g the playback. How? Http Headers sub-item If a h eader exists un der an Action item , th en it will be sen t for th at request on ly. If th e h eader h as th e sam e n am e as on e of th e com m on h eaders, th en it will override th e com m on h eader for th is request on ly. It is possible to in sert addition al HTTP h eaders. Basic Auth en tication Sub-item Som etim es th e pages bein g requested require Basic Auth en tication , th at is, the user is presen ted with a dialog box askin g for a UserID an d Password. Th is in form ation is recorded an d presen ted in th e tree-view un der th e Action item th at requires it. In tegrated W in dows Auth en tication Sub-item Som etim es th e pages bein g requested require In tegrated W in dows Auth en tication , th at is, you are presen ted with a dialog box askin g for a User ID, Password, an d Dom ain . Th is in form ation is recorded an d listed in th e tree-view un der th e Action item th at requires it. Not e: Integrated Windows Authentication includes support for NTLM, Negotiate, and Microsoft Active Directory. To con figure W eb Auth en tication , select th e In tegrated W in dows Auth en ticat ion tree n ode to vi ew th e In tegrated W in dows Auth en tication dialog box. PostTo sub-item If th e recorded request was a POST request rath er th an a GET request an d th e Script Developm en t W orkben ch could n ot fin d a m atch in g Subm it type button , th en a Post To tree action item will be in serted un der th e page. Th is can som etim es h appen if th e request is in itiated by JavaScript. Click On Button sub-item 265 Usin g th e Player, Script Developm en t W orkben ch , an d An alyze Clickin g on Subm i t is usually associ ated with en teri n g values in to a form (Fi l l I n Form item ). W h en th e Cl i ck On But t on tree-view item is selected, th e associated button in th e browser win dow (top pan e) will be h igh lighted with a blin kin g fram e, m akin g it easier to locate. Form View Fields Th e form -view (bottom pan e) for Cl i ck On But t on s (subm its) lists th e followin g in form ation : I den t i f y by: Click th e appropriate button to ch oose wh eth er to iden tify th e button by Nam e (in tern al n am e as in dicated in th e HTM L), by Label (th e text on th e button ), by Occurren ce (e.g. th e 3rd button ), or by Im age Source (in case t h is subm it button is really an im age). Th e edit Iden t ify by button s will ch an ge appropriately, depen din g upon wh ich option you ch oose. Prev But t on / Nex t But t on : If th ere are oth er subm it button s on th e page, use Prev Button / Next Button to ch oose to use on e of th ose oth er subm it button s. Th e n am e, label, or occurren ce will be updat ed autom atically. Label : Th e Label field (or Nam e, Occurren ce, or Im age Source field) can be m odified or variablized. If you variablize th e field, clicki n g Next Button or Prev Button will n ot affect its con ten ts. However if you ch oose to use on e of th e oth er option s, differen t text will be displayed because variablization is specific to each m eth od of iden tification . I f m ul t i pl e m at ch es t o URL are f oun d, use m at ch : If QALoad fin ds m ultiple m atch es (for exam ple, two button s labeled Buy Me) t h en you can use th is field to specify wh ich m atch to use. For exam ple you could specify th at you wan t to click on th e 4th button with a label of Buy Me wh en lookin g at a page with a lot of item s for sale. Ori gi n al Label : Th e origin al label associat ed with th e button th at was clicked wh ile recordin g. Ori gi n al Nam e: Th e origin al n am e (from th e HTM L source) for th is button . Form Act i on : Th e URL associated with a form . Th is is th e address for th e request th at will sen t wh en th e subm it button is clicked. Subm i t M et h od: W h eth er th is subm it item was a GET or POST. Con vert Cl i ck On : Con verts th e ClickOn Subm it action to a PostTo or Navigat eTo action , depen din g on wh eth er th e ClickOn Subm it will be con verted in to a PostTo or NavigateTo action . Caut i on : Th is action is n ot reversible. If you con vert th e ClickOn Subm it action , it is perm an en tly ch an ged. You m ust create a n ew capture file with a ClickOn Subm it action if you wan t th is action in your script. Click On Lin k sub-item W h en th e user clicks on a text lin k or an im age lin k, th en a Click On Lin k action item is in serted un der th at page. Th is is used to describe th e action th at was taken wh ile on th is page th at resulted in th e n ext page bein g requested. W h en a Click On Lin k tree-view item is selected, th e text or im age in th e browser-view (top pan e) is h igh lighted by a blin kin g fram e to m ake it easier to locate. Th ere are several t ypes of Click On Lin ks: 266 Tex t Li n k s – On e of th e m ore com m on lin ks in web pages are Text based lin ks. Th ese usually appear as un derlin ed text. I m age Li n k s – An im age can h ave a lin k, sim ilar to text. Cl i en t -Si de I m age M ap – A Clien t-Side Im age M ap is an im age on a page th at h as m ultiple lin ks associated with it. Each lin k is associated with a region , wh ich can be an y sh ape. W h en th e user clicks on th e im age, th e browser determ in es wh ich region was clicked on an d requests th e page lin ked to th at region . QALoad On lin e Help Server-Si de I m age M ap – A Server-Side Im age M ap i s an im age on a page th at h as m ultiple lin ks associated with it. Un like Clien t-Side Im age M aps, th ese lin ks are stored on th e server rath er th an th e clien t. W h en a user clicks on th e im age, th e browser sen ds t h e server th e m ouse coordin ate relative to th e top-left corn er of th e im age. Th e server th en replies with th e appropriate page. NavigateTo sub-item Specifies a URI to be requested. If th e Script Developm en t W orkben ch can n ot determ in e h ow th e n ext page was requested (typically due to a JavaScript m akin g th e request) th en it will use a Navi gat eTo tree item in stead of som eth in g m ore specific such as a Cl i ck On Li n k . Fill In Form Sub-item If a requested page con tai n s a Form (h tm l elem en t) th at was filled in by th e user, th en a Fi l l I n Form item an d its associated elem en t s will be created in th e tree-view. W h en th is tree item is selected, a blin kin g fram e will appear aroun d th e form in th e browser-view (top pan e). Form View Fields Th e form -view (bottom pan e) for a Form elem en t li sts th e followin g in form ation : Form Act i on St ri n g: Th e Action Strin g associated with th is form . For exam ple, th e URI wh ich will be requested. Form Num ber: Th e n um ber assign ed to th e form , in dicatin g wh ich form will be used. A Fill In Form item in th e tree-view can in clude a n um ber of sub elem en ts. For details, see Form sub-item s. IP Spoof In serts an I P Spoof item i m m ediately after th e curren tly selected HTM L page. In order for IP Spoofin g to work with Visual Navigat or, it is n ecessary to create or in sert an existin g local datapool file called IPSPOOF.dat in th e Visual Navi gator tree-view. For m ore in form ation about creatin g th is datapool file an d in sertin g it, see Settin g Up IP Spoofin g. Com m on Http Headers Lists h eaders th at were recorded from at least 50% of your requests. Th ese h eaders will be sen t out with every request th at is m ade at playback un less th ey are overwritten by a h eader of th e sam e n am e un dern eath an in dividual request action . You can in sert n ew h eader item s from th e tree-view by clickin g Vi sual Navi gat or>I n sert Tree I t em >H t t p H eader. In addition , you can m odify th e values in th e Http Header form in th e righ t pan e. 267 Usin g th e Player, Script Developm en t W orkben ch , an d An alyze Clien t Certificate Tree Item If th e recorded tran saction con tain s a lin e with a ssl-clientcert com m an d, th en Visual Navigator will creat e a Clien t Certificate tree item an d place it directly ben eath th e Tran saction Setup tree item . Th e Clien t Certificate strin g can be m odified or variablized in th e form -view. Th e Clien t Certificate item can also be m oved up an d down th e tree like oth er tree item s, such as ch eckpoin ts. Th is allows you to m ove it in to th e Tran sacti on Loop area if you wish to ch an ge th e certificate with each tran saction . A Clien t Certificate item will gen erate a script lin e sim ilar to th e followin g: Set (EVERY_REQUEST, CERTIFICATE, “qaload_cl”); If th e Requi res Passw ord ch eck box is selected, th e gen erated scri pt lin e is sim ilar to th e followin g: Set (EVERY_REQUEST, CERTIFICATE_PASSWORD, "~encr~250F7641455876"); W W W Repl y Act i on s Radi o sub-item Form View Fields Th e form -view (bottom pan e) for a Radio Button el em en t lists th e followin g in form ation : General Group Nam e: Th e Group Nam e is sh ared by all radi o button s th at belon g to th e sam e group. Val ue: Th e Value field is wh at differen tiates on e radio button from an oth er. Th e group n am e an d value of th e selected radio button will be sen t alon g with the request to th e server. Th e Value of a radio button can be, an d often is, differen t th an th e text sh own in the browser. use t h i s val ue but t on : W h en you select a radio but ton in th e browser-view (t op pan e) its value will display in th is text box. Click th is button to tran sfer th is value in to th e above Value fi eld. Matching Parameter Rules Rul e: Lists th e rules th at h ave been created for th is variable type. Th ese rules m ay or m ay n ot h ave been placed in th e Rule Library. Appl i ed t o I t em : In dicates wh eth er th e rule is appli ed to th is variable. GoTo Rul e: Goes to th e i n dividual rule un der th e Param eterization Rules tree item . In th e righ t-h an d pan e, in form ation in th e M at ch i n g I t em tab of th e Rule Details dialog box displays. Previ ous M at ch : Goes to th e n ext m atch in g variable im m ediately precedin g th e curren t item in th e script. Nex t M at ch : Goes to th e n ext m atch in g variable im m ediately followin g th e curren t item in th e script. Appl y: Applies th e rule h igh ligh ted in th e listbox to th is variable. On ly on e rule can be applied to an in stan ce of a variable. Un do Appl y: Rem oves application of th e rule h igh ligh ted in th e listbox from th is variable. Oth er m atch in g variables to wh i ch th is rule is applied are n ot affected. 268 QALoad On lin e Help TextArea sub-item A Text Area item is a m ulti-lin e text box. Form View Fields Th e form -view (bottom pan e) for a TextArea elem en t lists th e followin g in form ation : General Nam e: Th e n am e of th e Text Area field. Val ue: Th e value of th e Text Area field. An y ch an ges you en ter in to th is edit box are reflected in th e browser-view (top pan e). To en ter a lin efeed, press Ctrl+Enter. Matching Parameter Rules Rul e: Lists th e rules th at h ave been created for th is variable type. Th ese rules m ay or m ay n ot h ave been placed in th e Rule Library. Appl i ed t o I t em : In dicates wh eth er th e rule is appli ed to th is variable. GoTo Rul e: Goes to th e i n dividual rule un der th e Param eterization Rules tree item . In th e righ t-h an d pan e, in form ation in th e M at ch i n g I t em tab of th e Rule Details dialog box displays. Previ ous M at ch : Goes to th e n ext m atch in g variable im m ediately precedin g th e curren t item in th e script. Nex t M at ch : Goes to th e n ext m atch in g variable im m ediately followin g th e curren t item in th e script. Appl y: Applies th e rule h igh ligh ted in th e listbox to th is variable. On ly on e rule can be applied to an in stan ce of a variable. Un do Appl y: Rem oves application of th e rule h igh ligh ted in th e listbox from th is variable. Oth er m atch in g variables to wh i ch th is rule is applied are n ot affected. Selectbox sub-item A select box is often called a drop down selection box or list box. Th e form -view will appear sligh tly differen t depen din g upon wh eth er th e Select Box is capable of supportin g m ultiple selection s or n ot. Form View Fields Th e form -view (bottom pan e) for a Select Box elem en t lists th e followin g in form ation : Nam e: Th e n am e (in th e HTM L) of th e select box. I t em s f rom t h e Sel ect Box : Lists th e item s presen t in th e Select Box in th e browser-view. An item h as a ch eckbox n ext to it to in dicate if it h as been selected. To ch an ge a selection , select or clear th e ch eckbox. Your ch oices will be reflected in th e browser. If th e Select Box on ly supports on e selection , th en on ly th e m ost recen t selection is selected. Vari abl i zed Sel ect i on s: Edit boxes th at allow th e use of variables (local or from a datapool ) to specify wh at option s are ch osen from t h e Select Box. For a m ultiple selection Select Box, it is possible to add up to six variables in addition to an y item ch osen usin g th e ch eck boxes. For a sin gle selection Select Box, a sin gle edit box is provi ded to allow you to use a vari able (local or from a datapool) t o specify th e option you wan t ch osen from th e Select Box. 269 Usin g th e Player, Script Developm en t W orkben ch , an d An alyze Ch eckbox Sub-item Th e form -view (bottom pan e) for a Ch eckbox elem en t lists th e followin g in form ation : Nam e: Nam e of th e Ch eckbox. Val ue: Value of th e Ch eckbox. St at e: Reflects wh eth er th e box is ch ecked (selected) or n ot. If th e State is 1 (ch ecked), th en th e Nam e an d Value are passed alon g in th e request to th e server. If th e State is 0 (n ot ch ecked) th en th e Nam e an d Val ue are n ot passed al on g. You can ch an ge th e value of t h e State by clickin g on th e ch eckbox con trol in th e browser-view (top pan e). Editbox sub-item On e of th e m ore com m on elem en ts in a form is an edit box. W h en th is tree item is selected, QALoad will draw a blin kin g fram e aroun d th e appropriate edit box in th e browser-view (t op pan e). Th e edit box in th e browser-view will sh ow th e value th at was origin ally typed in wh en th e tran saction was recorded. Form View Fields Th e form -view (bottom pan e) for an Edit Box elem en t lists th e followin g in form ation : General Nam e: Th e n am e of th e edit box. Val ue: Th e value of th e edit box. An y ch an ges m ade to th is field will be reflected in th e edit box in th e browser win dow. Matching Parameter Rules Rul e: Lists th e rules th at h ave been created for th is variable type. Th ese rules m ay or m ay n ot h ave been placed in th e Rule Library. Appl i ed t o I t em : In dicates wh eth er th e rule is appli ed to th is variable. GoTo Rul e: Goes to th e i n dividual rule un der th e Param eterization Rules tree item . In th e righ t-h an d pan e, in form ation in th e M at ch i n g I t em tab of th e Rule Details dialog box displays. Previ ous M at ch : Goes to th e n ext m atch in g variable im m ediately precedin g th e curren t item in th e script. Nex t M at ch : Goes to th e n ext m atch in g variable im m ediately followin g th e curren t item in th e script. Appl y: Applies th e rule h igh ligh ted in th e listbox to th is variable. On ly on e rule can be applied to an in stan ce of a variable. Un do Appl y: Rem oves application of th e rule h igh ligh ted in th e listbox from th is variable. Oth er m atch in g variables to wh i ch th is rule is applied are n ot affected. Hidden sub-item 270 QALoad On lin e Help Form s can con tain h idden fields th at do n ot sh ow up on th e page. Th ese fiel ds are n ot visible to th e en d user in teractin g with th e browser, but th ey m ay n eed to be variablized for a l oad test, for exam ple a field th at con tain s a session ID m ay n eed to be variablized. Form View Fields Th e form -view (bottom pan e) for a Hidden Field el em en t lists th e followin g in form ation : Nam e: Th e n am e of th e h idden field Val ue: Th e value of th e h i dden field. Al l ow t h i s h i dden f i el d t o be vari abl i zed: Select to variablize th is field. Click th e var... button to select a variable. Con ten t Ch eck Sub-item In serts a Con t en t Ch eck item for th e curren tly-selected HTM L page. Th is veri fies th at th e correct page was return ed based on th e existen ce or absen ce of a part icular search strin g in th e server's reply for th at page. Con ten t ch ecks can in clude vari ables. Th e search st rin g is com pared to th e raw HTM L return ed by th e server, so you m ay n eed to in clude HTM L tags in your search to m at ch th e text th at appears in th e browser. Th e top pan e displ ays th e source for th e HTM L page. You can easily select text in th e top pan e an d add it to th e con ten t ch eck defin ition by clickin g th e Copy f rom Sour ce button . GetForm Action Statem en t If a click on even t occurs t h at leads from th e existin g page to th e n ext page, GetForm Action Statem en t appears in th e Visual Navi gator Tree as a Page sub-item . If Let Con vert H an d l e Param t erai zat i on is n ot selected in Post to, th e val ue will rem ain static from th e capture tim e an d th e script replay could fail. GetForm Value If th e page con t ain s a form th at requires dyn am i c in teraction , th e request param eters are set as vari ables to extract dyn am i c data from th e appropri ate W eb page. Th e variables appear as a sub-item of th e page. If Let Con vert H an dl e Param t erai zat i on is n ot selected i n th e CGI Param eters, th e value will rem ain static from th e capture tim e an d th e script replay could fail. Fram es If an HTM L page th at is recorded con t ain ed fram es, th ey will be represen ted in th e tree-view (left pan e) with a circle icon con tain in g a capital F. A fram e page will be in den ted ben eath th e page th at is its paren t. If you click on a fram e icon in th e tree-view, th e correspon din g fram e will be h igh lighted in th e browserview (top pan e) with a bli n kin g fram e aroun d it for iden tification . Duplicated frameset pages Som etim es wh en a user clicks on a lin k or takes som e oth er action in side of a fram e, th e n ew page th at was requested sim ply replaces th e con ten ts of on e of th e fram es already sh own in th e browser. To in dicate t h at th e fram eset page (th e m ain page th at h olds th e fram es) h as n ot ch an ged, Visual Navigator ren am es it Duplicated Frameset n. W h ere n is an iden tifyin g n um ber for th e fram eset th at is in crem en ted as m ore fram eset pages are duplicated. 271 Usin g th e Player, Script Developm en t W orkben ch , an d An alyze SubRequests Sub-item Lists all subrequests (such as im ages) th at th e page perform ed in order to be fully ren dered in th e browser. Subrequests can n ot be ch an ged an d are sh own strictly to provi de det ailed in form ation about th e requests th at were m ade durin g th e recordin g session . Cookies Set by Server Sub-item If th e reply from th e server for th e requested page con tain s a Set-Cookie com m an d, it is listed h ere. Th is item can n ot be m odified, it is listed for your in form ation on ly. Addition alSubRequests Sub-item Som e requests are con tain ed in applets, ActiveX com pon en ts, or oth er obj ect s th at are captured, but n ot played back by QALoad . Th ese subrequests, wh ich are n ot recogn ized as n orm al subrequests, are listed in th e Addi t i on al SubRequest s tree item . Each addition al subrequest item appears in th e script as a pre-loaded subrequest just before th e m ain action . As a result, th e playback en gin e requests th e m ain page, regular subrequests, an d th en th e preloaded subrequests. For exam ple: //--------- REQUEST # 2 --------// // current page url is http://c96852d01/pda/ // // Pre-load the following image requests before the next request is made. // These requests seem to have been made by javascript or applets associated // with the next page but will not be made automatically by the replay engine, // hence they are here in the script. // Set (NEXT_REQUEST_ONLY, ADDITIONAL_SUBREQUEST, "http://c96852d01/pda/images/LeftBackgrnd.jpg"); Set (NEXT_REQUEST_ONLY, ADDITIONAL_SUBREQUEST, "http://c96852d01/pda/menuopen.gif"); Set (NEXT_REQUEST_ONLY, ADDITIONAL_SUBREQUEST, "http://c96852d01/pda/menuclose.gif"); Set (NEXT_REQUEST_ONLY, ADDITIONAL_SUBREQUEST, "http://c96852d01/pda/menuclose.gif"); Set (NEXT_REQUEST_ONLY, ADDITIONAL_SUBREQUEST, "http://c96852d01/pda/images/browsex.gif"); Click_On(IMAGE, 1, SRC_ATTRIBUTE, "http://c96852d01/pda/images/browse.gif"); PageCh eck Sub-item Allows you to verify th at th e title of th e page th at was requested is correct. 272 QALoad On lin e Help HTM L Page sub-item s Th e followin g script item s can exist un der a Page (HTM L) item in th e Visual Navigator's tree-view. Each possible page sub-item is listed below, alon g with description s for th e fields th at appear in th e form -view in th e righ t pan e wh en you select th e item in th e tree-view. In addition , a Page item can con tain sub-item s th at you in sert m an ually after recordin g th e tran saction . Con ten t Ch eck sub-item PageCh eck sub-item Addition alSubRequests sub-item SubRequests sub-item Cookies Set by Server sub-item Sleep sub-item Fill In Form sub-item Action sub-item s Extract Strin g Sub-item In serts an Extract Strin g item wh en you n eed to extract in form ation from th e script an d store it in a variable to use lat er in th e script. W h en an Extract Strin g item is in serted in to th e tree-view, th e browser-vi ew displays th e HTM L source for th e page in wh ich th e item is in serted. Th e strin g to extract is recogn ized by th e text precedin g it an d t h e text followin g it. Th e test strin g in between is extracted an d saved in to a local variable. You m ust specify th e local variable th at receives th e extracted strin g at run tim e by clickin g on Sel ect Var. Com m on Con ten t Ch ecks Lists com m on con ten t ch ecks, wh ich apply to all replies sen t by th e server. Con ten t ch ecks en able you to verify wh eth er th e correct page was return ed based on th e existen ce or absen ce of a specific search stri n g. You can also set con ten t ch ecks at th e page level. Click th e Add New Con t en t Ch eck I t em button in the form -view to add n ew com m on con ten t ch ecks. Com m on con ten t ch ecks can in clude variables. Com m on con ten t ch ecks en able you to gen erate an error code on a set con dition even if n o in dividual page-level con ten t ch ecks are en abled. Th e search strin g is com pared to th e raw HTM L return ed by th e server, so you m ay n eed to in cl ude HTM L tags in your search to m atch th e text th at appears in th e browser. 273 Usin g th e Player, Script Developm en t W orkben ch , an d An alyze Par am et eri zat i on i n t h e Vi sual Navi gat or Param eterization Param eterization is th e process of substitutin g certain values in a script with variables you defin e. Param eterization is used in Visual Scriptin g for W W W scripts. W h en you m odify QALoad scripts before repl ayin g th em , th e m odification s usually are repetitive an d con sisten t. Param eterizati on provides th e m ean s for replacin g values with system -gen erated variables th rough out your scripts. Th e values for variables are derived from a datapool, an extract strin g, or a calculated value. Methods for Parameterizing a Script Values in a script th at you can param eterize are n oted in th e form -view (bottom pan e) with th e var... button n ext to th e field. Th is gives you access to th e Datapool an d Variables dialog box, wh ere you can defin e values for variables. Certain values in th e script support th e Vari able Replacem en t W izard. Th e Variable Replacem en t W izard sim plifies th e process of param eterization by takin g you th rough th e n ecessary steps for defin in g variables for th e fields you wan t to replace. Fields for wh ich th e Variable Replacem en t W izard is available are sh own in th e form -view with Var W i z... button n ext to th e field. Saving Parameters as Rules You can create an d m ain tain a table of th e vari ables you defin e by storin g th em as rules in th e Rule Library. On ce stored, th e script looks for th ese rules an d repl aces th e value wi th th e param eters you assi gn to th at rule. Usin g Variables with Visual Navigat or Overview of Variables W h en you record a tran saction , th e resultin g script is a recordin g of th e action s of a sin gle en d-user. W h en you play back th at scri pt m ultiple tim es durin g a load test, you probably wan t it to em ulate th e action s of multiple users m akin g differin g requests of your server in stead of th e sin gle user th at was recorded. On e way to ach ieve th at is to replace cert ain data with a vari able th at draws its value from a list of values th at you provi de. Here are som e exam ples of wh y an d h ow you m igh t use variables in a script: ! If your original script recorded a user logging on to a site using an ID and password, you can replace the ID and password with variables in the script. At test time, those variables draw their values from a datapool file of acceptable values, using a different set of values for each transaction run. In other words, that one script could emulate a number of different users by utilizing a different user ID/password combination for each transaction. ! If your script inserted new records into a customer database, you might want the names to be unique each time the script is run (each transaction). You could create a datapool file of names, and then insert a variable into the script where the name was typed. At test time, the variable inserts a different name from the datapool file with each transaction. ! If an ID string is returned from the server and that ID is then used as part of future requests to the server, and each virtual user may get back a different ID from the server, you can use a variable to use a specific ID. You could extract an ID from the reply, place it into a variable, and then use the value in that variable in place of the actual ID for future requests, ensuring you only use the ID you specify. Th ere are a n um ber of val ues in your script th at can be replaced with variables. Th ose values are n ot ed i n th e form view (bottom pan e) with var.... Values th at use th e Variable Replacem en t W izard are sh own in th e form view with Var W i z. Typi cally variables derive th eir values from a datapool an extracted strin g, or a calcul ated value. 274 QALoad On lin e Help Using Variables in a Visual Script Th is topic describes several m eth ods of workin g with variable data in a scri pt. Using Variables in a string Suppose you are testin g a site wh ere users m ust register th em selves with a server. To register, th ey m ust type a n am e, password, address, an d so on in to a form . Th e resultin g Visual Script con tain s a Fill In Form item in th e tree-view un der th e appropriate Page item . Clickin g on a form item open s th e item 's form -view in th e bottom pan e, wh ich m igh t look like th e followin g graph ic: In th is exam ple, th e edit box requires th e user to type th eir n am e. Assum e th at a secon d edit box requires th e user to type th eir password. Each edit box on th e form results in a separate item un der th e Fill In Form tree item . At run tim e, you m igh t wan t to param eteri ze th e n am e an d password edit boxes, so th at a differen t user n am e an d correspon din g password is en tered for every tran sacti on . On e way of variablizi n g th ese two fields is to creat e a dat apool file con tain in g two variables (colum n s) n am ed Nam e (user ID) an d Password, populated with valid user n am es an d passwords. To p ar am et er i ze t h e n am e ed i t b ox : 1. Highlight the text in the form-view. In this example, that would be Kim Walker. 2. Right-click on the highlighted text and choose Substitute with Variable, or simple click on the var... button. 3. On the Datapools and Variables dialog box that opens, click on the Name (user ID) variable and click OK. 4. The Value field in the form-view for that particular field will look something like the following: At run tim e, th is form field will be filled in with a value from th e User name colum n of th e datapool file n am ed User names and Passwords. Working with an inserted variable Here are som e h in ts for workin g with variables: ! Clicking anywhere on an inserted variable selects the entire variable. ! You can delete a variable by clicking on it to select it, and then pressing the Delete key on your keyboard. Alternately, you can right-click on a variable and choose Delete Variable Reference from the menu to delete it. ! Rename a variable easily by double-clicking on it to open the Datapools and Variables dialog box with that variable highlighted. You can easily rename the variable from there. ! You can restore the contents of an edit box to whatever its contents were immediately after being converted by rightclicking on it and choosing Revert to Original String… from the menu. This will automatically delete any variables that have been inserted since the most recent conversion. Mixing regular text with variables 275 Usin g th e Player, Script Developm en t W orkben ch , an d An alyze An edit box can con tain a com bin ation of regular text an d an y n um ber of vari ables, depen din g upon h ow com plicated th e strin g n eeds to be. Using local variables An oth er m eth od of variablizin g data, for in stan ce th e user ID an d password describe previously, is to use local variables to create a un ique n am e an d password on each pass th rough th e tran saction loop with a form at of User1 an d Pass1, User2 an d Pass2, an d so on . You coul d accom p l i sh t h i s usi n g a com b i n at i on of r eg ul ar t ex t an d a l ocal var i ab l e: 1. In the edit box for the User ID, type: User. 2. Then while the cursor is still at the end of the text you just typed, click the var... button to open the Datapools and Variables dialog box. 3. On the Datapools and Variables dialog box, create a local variable by clicking the New Variable button. Name the variable User Number. In the Initial Value field, assign the variable an initial value of 0 (zero). 4. Click OK. The Value field in the form-view will now display this value: User{$User Number$} At run tim e, QALoad will create a value for th at field th at will be a con caten ation of User an d th e value of th e local vari able n am ed User Num ber. 5. Assum e th at th e value sh ould be 1 (on e) for th e first tran saction , 2 (two) for th e secon d tran saction , an d so on . To accom plish th at, th e value of User Num ber m ust be in crem en ted before each iteration of th e tran saction . To in crem en t th e value before each tran saction , i n sert an In crem en t Variable item before th e Page item th at uses th e User Num ber variable. Variablizing with a random value An oth er m eth od of variablization is to in sert or substitute selected text with a Ran dom Value tag. 1. Select text or position your cursor and then click the var… button. 2. On the Datapools and Variables dialog box, click the Random Number button. The Random Number Tag dialog box opens. 3. Type values in the Lower and Upper fields to specify a range from which the number should be drawn. 4. Click OK. The Value field in the form-view will now display a value similar to the following: User{$Random:1:500$} 5. At run time, this variable will create strings similar to the following: User17, User394, and so on. To m odify a ran ge, doubl e-click on th e Ran dom tag to open th e Ran dom Num ber Tag dialog box wh ere you can adjust th e ran ges as n eeded. Variablizing with a VU number An oth er m eth od of variablization is to in sert or substitute selected text with a virtual user n um ber tag. 1. Highlight the text to replace or position your cursor in a field and then click the var... button. 2. On the Datapools and Variables dialog box, click the VU Number (Absolute) or VU Number (Relative) button. The Value field in the form-view will be filled in with something similar to the following: {$VU NUM ABS$} or {$VU NUM REL$}. At run tim e, th e VU Num ber tag will be substituted with th e n um ber of th e particular virtual user th at i s run n in g th is script. Th e strin g created will look sim ilar to th is: User45, User187, an d so on . Find/replace a variable Visual Navigator h as a Fin d/ Replace feature th at allows you to qui ckly fin d occurren ces of strin gs with in th e tree-view an d replace th em with oth er strin gs. For exam ple, you could fin d all occurren ces of Smith an d 276 QALoad On lin e Help replace th em with th e dat apool vari able {$Last Nam e:User In fo$}. For details about th e fin d/ replace feat ure, see Visual Navigat or's Fin d an d Replace feature. Naming Variables W h en you first create a datapool file, th e in cluded variables are autom atically assign ed th e default n am es Var1, Var2, Var3, an d so forth . QALoad allows you to ren am e th ose vari ables with m ean in gful n am es th at can even in clude spaces. Th i s m akes it m uch easier to work with datapools. For exam ple, you could n am e a datapool variable som eth i n g logical like City, rath er th an tryin g to rem em ber th at Var4 in your dat apool i s th e City variable. Renaming Variables You can qui ckly an d easily ren am e local or datapool variables from th e tree-vi ew. Sim ply h igh ligh t th e variable un der th e Datapool Files or Variables tree-vi ew item , an d th en ch an ge th e variable n am e in th e resultin g form -view (bottom pan e). You can also edit from th e Datapools an d Vari ables dialog box. To access it, righ t-click an ywh ere in th e tree-view an d th en ch oose Dat apool s an d Vari abl es from th e sh ortcut m en u. High ligh t th e variable to ren am e an d click Ren am e. Datapools and Variables Datapools an d variables can be added or m odified by several m eth ods. To sim ply create, delet e, or m odi fy datapool files an d variables at an y tim e wh ile a script is open in th e editor, ch oose Vi sual Navi gat or >Dat apool s an d Vari abl es from th e m en u to access th e Datapools an d Variables dialog box. Altern ately, th e sam e dial og box will open autom at ically wh en ever you are asked to ch oose a variable or datapool file wh ile workin g with th e script, allowin g you to create th e vari ables you n eed on -th e-fly. Data th at can be variablized is den oted in th e form -view (bottom pan e) by th e var... button . Clickin g th e var... button will open th e Datapools an d Variables dialog box. Types of Variables Types of Variables W h en values in a script are replaced with variables, th e variables typically are derived from extract strin gs, datapools, or calculat ed variables. Extract Strings In sert an Extract Strin g item wh en you n eed to extract in form ation from a reply an d store it in a variable to use in future requests or sim ply for loggin g th e in form ation . For exam pl e, if a strin g is located in side a JavaScript or in a h idden tag th at is n ot visible in the browser, an d it m igh t ch an ge each tim e th is page i s requested, use an Extract Strin g to extract th e value. Extract strin gs search on th e text precedin g an d th e text followin g th e strin g you wan t to extract. Datapools Datapools draw values from a file of acceptable values an d use a differen t set of values each tim e a param eter is repl aced. You can select an existin g datapool file or create a n ew datapool file to add to your 277 Usin g th e Player, Script Developm en t W orkben ch , an d An alyze script from your datapool directory. Each datapool h as a list of variables un der it represen tin g colum n s in th e datapool file. W h en you create a dat apool, you specify th e n um ber of col um n s (variables) an d rows (values) it con tain s. Th e datapool file you ch oose is added to your script an d is listed un der Dat apool Files in th e Visual Navigator tree-view. You can ch oose to add a cen tral or local datapool to a script. Not e: You can have only one central datapool file associated with a script, but can have any number of local datapool files. Central Cen tral datapools are Con ductor-based. Th ey reside on th e sam e workstation as th e QALoad Con duct or, an d are avail able to an y Pl ayer system on th e n etwork th at requests it from th e Con ductor. You can apply on ly on e cen tral datapool file to a script. Local Local datapools are Pl ayer-based. Th ey reside on a Player workstation , an d are on ly avail able to th at Player. You can apply an y n um ber of local datapool files to a script. Shared A sh ared dat apool is a dat apool th at resided on th e Player workst ation an d is available to th e players assign ed to th e Player workstation . Because a sh ared datapool resided locally an d is on ly available to th e Player agen t an d it's Players, it does n ot gen erate an y n etwork traffic. You can apply an y n um ber of sh ared datapool files to a script. Calculated Variables Calculated variables are gen erated dyn am ically at run tim e an d are based on a form ula you defin e. For exam ple, you m igh t wan t each virtual user to h ave a un ique strin g, such as Sm ith 1, Sm ith 2, an d so forth , or you m ay wan t to calcul ate a n ew value each tim e th rough th e tran saction loop. Calculated variables are strin gs built from on e or m ore elem en ts. Th ese can i n clude dat apools, local variables, an d text, as well as th e followin g: Date and Time In sert th e date an d tim e i n th e form at you select. Random Alphanumeric Substitutes th e value with ran dom al ph an um eric ch aracters at run tim e. Specify th e type an d len gth of ch aracters to use. You can select: letters on ly, n um bers on ly, or both letters an d n um bers. Th e value can be a fixed l en gth , wh ere you specify th e n um ber of ch aracters, or vari able len gth , wh ere you specify th e m in im um an d m axim um n um ber of ch aracters. Random Numeric Substitutes th e value with a ran dom n um ber at run t im e. You specify th e m in im um value, m axim um value, th e n um ber of decim al pl aces, an d th e n um ber of l eadin g digits. Num bers gen erated with fewer leadin g digits are padded with zeros. Local Variable A variable with a static val ue th at you set wh en you create it. Virtual User Number 278 QALoad On lin e Help Th e n um ber used to iden tify th e virtual users durin g a test. You can in clude a virtual user n um ber (VU) in th e calculation . VUs m ay be absolute (assign ed by t h e Con ductor) or relative (assign ed by th e Player at run tim e). Absol ut e Th e absolute virtual user n um ber is assign ed by th e Con ductor based on th e total n um ber of virtual users on all Players. Each virtual user is assign ed a n um ber an d n o n um bers are repeated. In sert an absolute virtual user n um ber wh en it is n ecessary to use a com pletely un ique virtual user n um ber in place of a variable. Rel at i ve Th e relative virtual user n um ber is th e n um ber assign ed to th e virtual user by its Player. Because a test h as m ultiple Players an d each Player assign s virtual user n um bers from 0-n , a relative virtual user n um ber is on ly un ique on a sin gle Player. Local Variable A local variable is a static value th at you can substitute wh erever variables can be used. You can qui ckly add local variables to your script from th e Visual Navigator tree-view. In sert In crem en t Variable, Decrem en t Variable, an d Reset Vari able item s in to th e tree-view to m an ipul ate th e value of an y vari ables. About Calculated Variables Calculated variables gen erate th eir values dyn am ical ly at run tim e based on th e form ula you defin e for th em . Th ey can gen erate strin gs th at con tain an y com bin ation of text, ran dom alph an um eric ch aracters, tim e an d date values, an d values from oth er variables, such as datapool values, extract strin gs, or oth er alph an um eric an d n um eric elem en ts. Build a cal culated variable by ch oosin g th e elem en ts you wan t to in clude an d in sertin g th em in th e calculation . For exam pl e, you m igh t wan t to calculate a n ew value dyn am ically each tim e th rough th e tran saction loop rath er th an use a dat apool file of differen t values. An oth er exam ple is wh en you wan t each virtual user (VU) to h ave a un ique ID strin g, such as Sm ith 1, Sm ith 2, and so forth . Usin g calculated variables serves th is purpose. About Datapool Variables Datapools are text files con tain in g data records th at you can use to replace variable data in your script. Each dat apool com prises a set of vari ables represen t in g colum n s in th e datapool file. For dat a th at you can param eterize, th e var... button appears in th e form -view (bottom pan e). Clickin g th e var... button open s th e Datapools an d Variables dialog box. Datapools can be Local (specific to a sin gle Player), Sh ared (sh ared by Players on a workstation ), or Cen tral (available to all Players on all workstation s). Not e: You can parameterize certain variables using the Variable Replacement Wizard. Central Datapool A cen tral dat apool is a dat apool th at resides on th e sam e workstation as th e QALoad Con duct or. Its data is available to an y Player system on th e n etwork th at requests it from th e Con ductor. A cen tral datapool is con trolled by th e Con ductor, an d you use th e Con ductor to set an y option s relatin g to it. You can apply on ly on e cen tral datapool file to a script. 279 Usin g th e Player, Script Developm en t W orkben ch , an d An alyze Local Datapool A local dat apool is a dat apool file th at resides on a Player workstation an d is on ly available to Player in stan ces on th at workstation . Each Player in stan ce on th at workstation reads th e file in dividually with out regard for file reads don e by oth er Player in stan ces. Not e: Each script is lim ited to a com bin ed t otal of 64 local an d/ or sh ared dat apools. Because a local dat apool resides locally an d is on ly available to th e local Player in stan ces, it does n ot gen erate an y n etwork traffic. Shared Datapool A sh ared dat apool is a dat apool file th at resides on a Player workstation an d is on ly avail able to Player in stan ces on th at workstation . Un like a local datapool file, a sh ared datapool file h as a sin gle ‘reader’ on th e Player workstation . Each Player in stan ce obtain s data records from th e ‘reader’ th us preven tin g records from bein g used by m ultiple Player in stan ces. Not e: Each script is lim ited to a com bin ed t otal of 64 local an d/ or sh ared dat apools. Because a sh ared dat apool resides locally an d is on ly available to th e local Player in stan ces, it does n ot gen erate an y n etwork traffic. About Extract Strings In sert an Extract Strin g item in your script wh en you n eed to repl ace a system -gen erated value or reuse a system -created value later in a script. You can extract in form ation from a repl y an d store it in a variable to use in future requests. For exam ple, if a system -created order n um ber is assign ed durin g a tran saction t h at m ust be used again later in th e tran saction , you can use an Extract Strin g to store th e value an d in sert it in to th e script at th e appropriate poin t. W h en you select text to store in an extract strin g, Visual Navigator uses 10 or m ore ch aracters on eith er side of th e extracted text t o m ake th e search strin g un ique an d fin d th is copy of th e extracted text. You can in crease or decrease th e si ze of th e strin gs. You also can specify wh ich occurren ce of th e search strin gs to fin d in th e respon ses before extractin g th e text between th em . About Local Variables A local variable h as a con stan t value th at you assign wh en you create th e vari able. It can be substituted wh erever vari ables can be used. You can quickly add local variables to your script by righ t-clickin g in the Visual Navigator tree-view an d selectin g Dat apool s an d Vari abl es. Not e: You can insert Increment Variable, Decrement Variable, and Reset Variable items into the tree-view to manipulate the value of any variables. Adding a Variable Add variables to th e script from th e Visual Navigator tree-view. Types of variables are: 280 ! Local variables ! Datapools ! Calculated variables ! Extract Strings QALoad On lin e Help Not e: You can insert Increment Variable, Decrement Variable, and Reset Variable it ems into the treeview to manipulate the value of any variables. Creating a Calculated Variable Th e followin g procedure provi des step-by-step in struction s for creatin g an d editin g a n ew calculated variable usin g th e Dat apool s an d Vari abl es dialog box. Not e: You can also use the Variable Replacement Wizard to create calculated variables. To cr eat e a cal cul at ed var i ab l e: 1. Access the Datapools and Variables dialog box by doing one of the following: ! Click Vi sual Navi gat or >Dat apool s an d Vari abl es. ! Righ t-click in th e Visual Navigator tree-view, th en select Dat apool s an d Var i abl es. ! In th e Visual Navigator tree-view, click th e value you wan t to replace, an d th en click var... in th e form -view. 2. Click New Calc Variable. A new calculated variable name appears in the list box with all the other variables assigned to the script. The new variable is added to the Variables section in the Visual Navigator tree-view (left pane). 3. Type a name for the variable, then click OK. 4. In the Visual Navigator tree-view, scroll to the Variables section and select the name of the variable you just created. Details of the calculation variable display in the right-hand pane. 5. Click Edi t Cal cul at i on . Th e Edit Calculation Variable dialog box displays. 6. Build th e calculation variable by clickin g a form in th e Tem plates area. 7. Select or type th e associ ated in form ation in th e Det ails area. 8. Click I n sert i n t o Cal cul at i on , th en click OK to save th e ch an ges. Adding a Variable to a Datapool Add dat apool variables to th e script from th e Visual Navigator tree-view. Not e: You can insert Increment Variable, Decrement Variable, and Reset Variable items into the tree-view to manipulate the value of any variables. To ad d a var i ab l e t o a d at ap ool : 1. Right-click anywhere in the Visual Navigator tree-view. 2. From the shortcut menu, select Datapools and Variables. The Datapools and Variables dialog box displays. 3. Select a Datapool in the tree-view. 4. Click the New Variable button. A variable with the default name Var# is added to the list of variables in the selected datapool. Rename the new variable or accept the default name. 5. Click OK. In the Visual Navigator, the new variable is added to the datapool in the tree-view,and a new column for the variable displays in the form-view. 6. Type a value for the variable in each cell of the column. 281 Usin g th e Player, Script Developm en t W orkben ch , an d An alyze Creating, Editing, and Importing Datapools Th e followin g section s provide step-by-step in struction s for creatin g an d edit in g datapools, an d for im portin g a datapool file i n to a script. To cr eat e a n ew d at ap ool : 1. W ith a script open , ch oose Vi sual Navi gat or >Dat apool s an d Vari abl es from th e m en u. Th e Dat apool s an d Vari abl es dialog box displays. 2. Click New Dat apool Fi l e. 3. Th e Ch oose Dat apool Type dialog box open s. Specify wh eth er th e datapool you are about to create sh ould be cen tral (Con ductor-based), local (Player-based), or sh ared (W orkstation -based) th en click OK. Th e Creat e New Dat apool Fi l e dialog box appears. 4. In th e Fi l en am e field, type th e n am e for th e n ew datapool. 5. Type th e n um ber of rows an d colum n s for th e dat apool file. 6. Click OK to create th e dat apool. You are return ed to th e Dat apool s an d Vari abl es dialog box. Th e Datapools an d Variables dialog box n ow displays all datapool files assign ed to th e script, in cludin g th e on e you just created. Th e n ew datapool is added to th e Datapool Files section in th e Visual Navigator tree-view (left pan e). 7. Click OK. 8. In th e Visual Navigator tree-view, scroll to th e Datapool Files section of th e script an d click th e n am e of th e datapool file you just created. 9. In th e righ t-h an d pan e, type values in to th e datapool fields to be used at test tim e. To i m p or t a d at ap ool f i l e: 1. Copy your datapool file, which must be in .dat format, to the Datapools directory of the QALoad installation. 2. Insert the datapool into a script. To ed i t a d at ap ool f i l e: If you n eed to m ake ch an ges to a datapool file, Com puware recom m en ds th at you m ake a backup copy of th e file first. If a backup copy is n ot available, you m ay n eed to ch eck all oth er scripts th at use th at datapool file an d m ake appropriate ch an ges. Caut ion: Because it is possible for more than one script to use the same datapool file, care should be taken when modifying a datapool file's contents. Doing so for one script may cause errors in other scripts that use the datapool file. 1. W ith your script open , scroll to th e Datapool Files section in th e Visual Navigator tree-view (left pan e). 2. Select th e datapool file you wan t to edit. A table open s in th e righ t-h an d pan e displayin g th e con ten ts of th e datapool file. 3. Perform an y of th e followin g fun ction s: ! 282 Edit a cell's con ten ts: Click in a cell an d type over th e existin g con ten ts to edit th e value. QALoad On lin e Help 4. ! In sert colum n s or rows: Ri gh t-click on a row or colum n h eader an d ch oose I n sert Row or I n sert Col um n from th e m en u. Ch oose wh eth er to in sert th e n ew item before or after th e selected item , an d type th e n um ber of item s to in sert. ! Delete colum n s or rows: Righ t-click on a row or col um n an d ch oose Del et e Row or Del et e Col um n from th e m en u. (Press SHIFT to select m ul tiple con tiguous item s or CTRL to select m ultiple n on -con tiguous item s.) ! Rearran ge colum n s or rows: Select on e or m ore colum n s or rows by clickin g on th e h eaders (press SHIFT first to select m ultiple item s). Drag th e rows or colum n s to a n ew position . As you drag th em , a th in red lin e in dicates wh ere th e selection are m oved. ! Ren am e a colum n h eader (vari able):Click on th e col um n n am e an d th en type th e n ew n am e in th e Vari abl e Nam e field. Click File>Save to save your changes. Inserting a Datapool into a Script You can qui ckly add an existin g datapool to your script from th e Visual Navi gator tree-view. Not e: Data th at can be param eterized is den oted in th e form -view (bottom pan e) by th e var... button or th e Var W i z... button . Clickin g th e var... button open s th e Dat apool s an d Vari abl es dialog box. Clickin g th e Var W i z... button open s th e Param eterization W izard. To i n ser t a d at ap ool f r om t h e Vi sual Navi g at or : 1. Right-click anywhere in the tree-view. From the shortcut menu, choose Datapools and Variables. The Datapools and Variables dialog box appears. 2. Click Insert Datapool File. 3. The Choose Datapool Type dialog box opens, where you can designate your datapool file as a central, local, or shared datapool. If your script already includes a central datapool, you can designate your datapool file as either local or shared. 4. Click OK, the Open dialog box appears. 5. From the Open dialog box, navigate to the datapool file to add to your script. Datapool files are normally located in the directory \Compuware\QALoad\Datapools. 6. Select the appropriate file and click Open. Th e file you selected is added to your script an d is listed in your Dat apool s an d Vari abl es dialog box, wh ere you can edit or del ete it as n ecessary. If you expan d th e view of th e file in th e Datapools an d Variables dialog box, you can see th e variables (colum n s) saved in th e file. Th e n am es for th ose colum n s are stored in th e datapool file as a com m en t lin e. If th ey are n ot n am ed, Visual Navigator assign s th em th e default n am e Var#. Creating Extract Strings You can extract a value from th e web page wh ere it first occurs an d place it i n to a variable usin g an ExtractStrin g tree item . W h en you in sert th e tree item , th e HTM L source for t h e page appears in th e browser-view so th at you can h igh ligh t th e text to extract. W h en you h igh ligh t th e strin g, som e of th e text precedin g an d followin g th e strin g is selected to iden tify wh ere th e strin g occurs durin g playback. 283 Usin g th e Player, Script Developm en t W orkben ch , an d An alyze To cr eat e an ex t r act st r i n g b y i n ser t i n g a t r ee i t em : 1. Right-click in the Visual Tree where you want to place the extract string. The HTML source for the page appears in the right-hand pane. 2. In the shortcut menu, click Insert Tree Item>ExtractString. 3. In the form_view (bottom pane), type the text you want to extract in the Search for field. Select Match Case to make your search case-sensitive. 4. Click Find prev and Find next to select the occurrence of the variable you want to replace. 5. Click Select var.... The Datapool and Variable dialog box displays. 6. Select the variable in which to store the extract string, and click OK. 7. Do one of the following: ! High ligh t th e desired text in th e HTM L page (top pan e) an d click Copy f rom source. Th is copies th e selected text from th e source win dow in to th e edit boxes. Th e text im m ediately before th e selected text appears in th e Preceded by field. Th e text im m ediately after th e selected appears in th e Fol l ow ed by field. Not e: Use the arrows next to the fields to include more or less of the preceding and following text. ! Click En t er st ri n gs m an ual l y an d type th e text before an d after th e strin g in th e Preceded by an d Fol l ow ed by fields. 8. In the Extracted field, click Next to view each instance of the variable in the page. The extracted string is added to the Visual Tree. 9. In the Extract Nth Occurrence area, specify the occurrence of the search string to find in the responses before extracting the text between them. Do one of the following: ! Type th e n um ber of th e occurren ce in th e occurren ce edit box. Th is is th e occurren ce of th e search strin g to fin d in th e respon ses before extractin g th e text between th em . Click Prev or Nex t to fin d th e previous an d n ext occurren ce of th e search strin g in t h e source pan e. Th is in crem en ts or decrem en ts th e occurren ce n um ber in th e edit box. ! Click Ex t ract Last to search for th e last occurren ce of th e search strin gs in the source pan e an d place th e keyword LAST in th e edit box. Click Prev to ch an ge th e occurren ce in th e edit box to LAST-1, LAST-2, an d so forth . Not e: You cannot edit the occurrence field manually when the LAST keyword is in the field. ! Click Ex t ract Ran dom to search for a ran dom occurren ce of th e search strin gs in th e source pan e an d place th e keyword RANDOM in th e edit box. ! Click Reset to restore 1 in th e occurren ce edit box an d fin d th e first occurren ce of th e search strin gs in t h e source pan e. 10. Select Search includes Redirects and Additional Subrequests to add the source for any Redirect pages preceding this main page, and any Additional Subrequests it may contain to the source pane. Not e: This is always selected for scripts generated in HTTP mode. 11. Click OK to return to the Replace Parameter with Variable page of the Variable Replacement Wizard. Adding a Local Variable Add local vari ables to th e script from th e Visual Navigator tree-view. A local variable can be substituted wh erever vari ables can be used. Not e: Insert Increment Variable, Decrement Variable, and Reset Variable items into the tree-view to manipulate the value of any variables. 284 QALoad On lin e Help To ad d a l ocal var i ab l e: 1. Right-click anywhere in the Visual Navigator tree-view. 2. From the shortcut menu, select Datapools and Variables. The Datapools and Variables dialog box displays. 3. Select th e Vari abl es item in th e tree-view. 4. Click New Vari abl e. An un n am ed vari able is added to your list of local variabl es. 5. Type a n am e for th e n ew variable. 6. In th e I n i t i al Val ue field, type th e value for th e variable. 7. Click OK. Th e local variable is added to th e Visual Navigator tree-view un der Vari abl es. Usin g th e Variable Replacem en t W izard Using the Variable Replacement W izard Th e Variable Replacem en t W izard guides you th rough th e process of defin in g variables an d substitutin g th em for param eters in th e script. Usin g th e wizard, you ch oose wh ich fields of a param eter to replace with variables, defin e th e variable th at replaces th e field, an d select addition al param eters to replace with th e variable. W h en you use th e Variabl e Replacem en t W izard, th e variable you defin e is saved as a rule. W h en you save th e rule in th e Rule Library, you can apply th e sam e param eters to future scripts. Subsequen t captures use th e stored rules durin g th e con vert process to iden ti fy m atch in g param et ers. Th e Variable Replacem en t W izard is available for th e Visual Navigator tree item s th at h ave a Var W i z... button associated with th em in th e form -view (bottom pan e). Th ese in clude: ! ! ! ! ! ! CGI Param eter Cookie Editbox TextArea Radi o button Header Step 2: Define the Variable that Replaces the Name or Value Field To d ef i n e t h e var i ab l e t h at r ep l aces t h e Nam e or Val ue f i el d : Not es: ! Th e variable you defin e can replace th e en tire origin al value or portion s of it. ! 1. W h en you ch oose t o repl ace Bot h n am e an d val ue f i el ds in th e previous step, th e curren t step becom es St ep 2.1: Def i n e t h e vari abl e t o repl ace t h e Nam e f i el d. W h en you com plete th is step an d cli ck Nex t , th e dialog box appears again as St ep 2.2: Def i n e t h e vari abl e t o repl ace t h e Val ue f i el d. Com plete th is step for th e Value field an d click Nex t to proceed to Step 3. In the Variable Name box, type a name for the variable or accept the default name. The default name is name#, where # is the number incremented by one for each new variable. 285 Usin g th e Player, Script Developm en t W orkben ch , an d An alyze 2. Click the down arrow on the Frequency box to display selections for when the original value is replaced with the variable. You can select: ! ! ! 3. On ce per test On ce per tran saction (default) Every usage Do one of the following: ! Type a value for th e variable in th e Cal cul at i on field. ! In th e Tem pl at es area, cli ck th e type of value you wan t to use , th en select or type th e associated details in th e Det ai l s area of th e di alog box. Click a tem plate below to display th e associated det ail fields: o Date an d Tim e o Ran dom Alph an um eric o Ran dom Num ber o Datapool Variable o Local Vari able o Virtual User Num ber o Extract Strin g Not e: The text you type or the template you select can represent the entire variable, or you can combine it with other elements. 4. Repeat Step 3 until you include all elements for the calculation. 5. Click Insert into Calculation. 6. Click Next to proceed to the next step, where you select additional parameters to replace. Click Back to edit fields in the preceding dialog box. To r evi ew an d cr eat e t h e var i ab l e: 1. In the Summary dialog box, review the information you entered for the variable. The information appears in three tabs: ! ! ! Vari abl e Propert i es - Sh ows th e elem en ts you used to defin e th e variable an d its frequen cy of use. Clickin g Det ai l s displays th e Calculation Details dialog box. I t em s t o Repl ace - Sh ows th e param et ers with th e sam e n am e in th e script th at you ch ose to replace with th is variable defin ition . Rul e Propert i es - Sh ows details of th e variable an d rule. 2. Click Back to return to the appropriate dialog box to edit information. 3. Click Finish to create the variable, apply it as a rule, and use it in the script. Usin g th e Rule Library Overview of the Rule Library You can save variable replacem en ts you defin e as rules. Th ese are stored in th e Rule Library, wh ere you can use th em in future recordin gs an d reduce repetitive param eterization tasks. 286 QALoad On lin e Help W h en subsequen t captures are con verted, th e Visual Navigator scan s th e Rule Library for m atch in g param eters. For exam ple, if a rule param eterizes th e value of a CGI Param eter n am ed Session ID, th e Visual Navigator scan s th rough th e Visual Tree for an y CGI Param eters th at m atch t h e description defin ed in th e rule. If a m atch is foun d, th e rule is added to th e Visual Tree, wh ere you can apply it to th e scri pt. From th e Rule Library, you can create rules, edit rules, an d view details of in dividual rules an d th e folders in wh ich th ey are stored. Elements of the Rule Library Dialog Box Create or m odify param et er rules from th e Rul e Li brar y dial og box. Th e dialog box con tain s th e followin g areas: ! Menus ! Tree view ! Details Rule Library Menus M en u Com m an d Descri pt i on Fi l e New Rul e - Open s th e Rul e Creation W izard. Use th e wizard to defin e a rule th at you can use to param eterize future scripts. New Fol der - Creates a n ew folder in th e tree-view. Edi t Use th e Edit m en u to cut, copy, paste, delete, or ren am e rules. Rul e Edi t Rul e - Open s th e Rule Creation W izard so you can edit a rule you select in th e Rule Library. H el p Displays QALoad h el p. Rule Library Tree-View Th e Rule Library tree-vi ew displays a h ierarch ical view of all rules an d folders with in th e Rule Library. 287 Usin g th e Player, Script Developm en t W orkben ch , an d An alyze Rule Library Dialog Box Details Th e Details area of th e Rule Library dialog box displ ays in form ation on th e rules defin ed in th e Rule Library. Th ere are two levels of detail: ! Folder - When you select a folder name in the Rule tree, the Details area of the dialog box displays information for each rule in the folder. ! Individual Rule - When you select a rule in a folder in the Rule tree, the Details area of the dialog box displays information for the individual rule in three tabs. Applying a Rule W h en you defin e values to replace variables in a script, you can save th em as rules an d apply th em to oth er scripts. To ap p l y a r ul e f r om t h e Vi sual Tr ee: 288 1. In the Visual Navigator vistree, click the Parameterization Rules script item and select the rule to apply. A description of the rule displays in the form-view. 2. Click the Matching Items tab. The properties that determine the matching items and each matching item found in the script display. QALoad On lin e Help 3. Do one of the following: ! Click Apply Rule on the left-hand side of the dialog box to apply the rule to all the matching items. ! Select an item or items in the table and click Apply to Item on the right-hand side of the dialog box. Not e: When a different rule has been applied to an individual item, a red exclamation mark (!) appears next to the item in the table. Only one rule can be applied at a time. Click Go t o It em and review the information in the Matching Parameter Rules area of the form-view to view the rule applied to the item. To ap p l y a r ul e f r om t h e f or m -vi ew f or a var i ab l e: 1. In the Visual Navigator vistree, select the variable to which you want to apply the rule. 2. In the Matching Parameter Rules area at the bottom of the form-view (right-hand pane), select the rule you want to apply. 3. Click Apply. The rule is applied to the variable. Editing a Rule Follow th ese steps to edit rules stored in th e Rule Library. To ed i t a r ul e: 1. Select a rule in the Rule Library visual tree, and click Rule>Edit Rule. The Rule Creation Wizard opens and displays the information on the rule you selected. 2. Follow the procedure for creating a rule to make changes to the rule elements. Creating Rules from the Rule Library Create a n ew rule from th e Rule Library usin g th e Rule Creation W izard. To op en t h e Rul e Li b r ar y W i zar d : 1. Select Tools>Rule Library. The QALoad Rule Library opens. 2. Select the folder in the tree-view where you want to store the new rule. 3. Click File>New Rule. The Welcome dialog box of the Rule Creation Wizard displays. Usin g th e Rule Library W izard Step 1 of 3: Choose the Fields to be Replaced To ch oose t h e f i el d s t o r ep l ace: 1. Choose which fields of the matching item get their values from this rule. You can select: ! Nam e field ! Value field ! Both n am e an d value fiel ds 289 Usin g th e Player, Script Developm en t W orkben ch , an d An alyze 2. Click the down arrow on the Item Name box to display options for how the item you are replacing is identified in the script. This enables the wizard to find and replace similar matching items. You can select: 3. ! is equal to (variable to replace) ! ! ! starts with (variable to replace_XXX) en ds with (YYY_variable to replace) con tain s (YYY_variable to replace_XXX ) Select the parameter type to which you want the rule applied. Choose: 4. ! On ly item s of th e specified type ! All param eter types Select the URLs from which the item should be matched. Choose: 5. ! M atch an y item s of th e specified h ost URL an d t ype th e n am e of th e URL. ! An y h ost Click Next to proceed to the next step, where you define the variable. Step 2 of 3: Define the Variable To d ef i n e t h e var i ab l e: Not e: The variable you define can replace the entire original value or portions of it. 1. In the Variable Name box, type a name for the variable or accept the default name. The default name depends on the field you chose to replace in the previous step. The default name is: ! Nam eVar - if you ch ose to replace th e Nam e field in th e previous step. ! ValueVar - if you ch ose to replace th e Value field in th e previous step. Not e: When you choose to replace both the Name and Value in the previous step, the default is NameVar. When you complete this step and click Next , the dialog box displays again with ValueVar in the Variable Name field. Complete Step 1 through Step 5 for the Value variable. 2. Click the down arrow on the Frequency box to display selections for when the original value is replaced with the rule. You can select: ! ! ! On ce per test On ce per tran saction (default) Every usage 3. In the Templates area, click the type of value you want to use , then select or type the associated details in the Details area of the dialog box. Click a template below to display the associated detail fields: 290 ! Date an d Tim e ! Ran dom Alph an um eric ! Ran dom Num eric ! Datapool Variable ! Local Vari able ! Virtual User Num ber ! Extract Strin g QALoad On lin e Help Not e: The text you type or the template you select can represent the entire variable, or you can combine it with other elements from the templates. 4. Repeat Step 3 and Step 4 until you include all elements for the calculation. 5. Click Insert into Calculation. 6. Click Next to proceed to the next step, where you select additional parameters to replace. Click Back to edit fields in the preceding dialog box. Not e: When you choose to replace Bot h name and value fields in the previous step, clicking Next repeats the current step so you can define the variable for the Value field. Complete Step 1 through Step 5 for the Value field and click Next to proceed to the next step. < Previous Next > Step 3 of 3: Rule Description Review th e rule you created. To vi ew t h e r ul e: 1. Review the details in the Description box. This is a summary of the elements you used to define the rule. Not e: A default name is provided in the Rule Name field. You can type a new, descriptive name for the rule or accept the default. 2. Store the rule in a folder by doing one of the following: 3. ! Click th e down arrow in t h e Rul e Fol der list an d select th e folder n am e wh ere th e rule will be stored. ! Click New Fol der. Th e Creat e New Rul e Fol der dialog box appears. In th e Fol der Nam e field, type th e n am e of th e n ew folder, th en click OK. Click Next to proceed to the Summary dialog box. Summary To r evi ew an d cr eat e t h e r ul e: 1. In the Summary dialog box, review the information you entered for the rule. The information is displayed in two tabs: ! ! Vari abl e Propert i es - Sh ows th e elem en ts you used to defin e th e rule an d its frequen cy of use. Clickin g Det ai l s displays th e Vari able Det ails dialog box. Rul e Propert i es - Sh ows details of th e variable an d rule. 2. Click Back to return to the appropriate dialog box and edit any elements of the rule. 3. Click Finish to create the rule and store it in the Rule Library. Devel opi n g a Scri pt Usi n g t h e Vi sual Navi gat or (W W W ) Recordin g a Visual Navigator Script 291 Usin g th e Player, Script Developm en t W orkben ch , an d An alyze You record a Visual Navigator script th e sam e way you record a regular QALoad script — by settin g opti on s to determ in e th e beh avior of QALoad wh ile recordin g, an d th en clickin g th rough a tran saction to m im ic a user. QALoad will record all sen t an d received HTTP an d SSL calls usin g th e Script Developm en t W orkben ch 's W eb proxy an d write th e activity t o a capture file. After recordin g, th e capture file m ust be con verted t o an editable, C++-based script. Your capture file dat a turn s in to a Visual Navigator Script th at allows you to view th e actual W eb pages you recorded in a browser-like in terface, wh ere you can m an ipulate t h e tran saction an d easily i n sert variable in form ation in to your script with out directly editin g a lin e of code. It is possible to save th e script as an oth er n am e t o view th e code in stead of t h e Visual Navigator script . By doin g th is, th e code i s separated from th e Visual Navigator script. An y ch an ges m ade in th e code wil l n ot appear in th e Visual Navigator script just as an y ch an ges m ade in th e Visual Navigat or script will n ot appear in th e saved as code. To r ecor d a Vi sual Scr i p t : If you are run n in g your application on W in dows X P SP2, Com puware recom m en ds you turn off th e 'popup blocker' feature before recordin g a tran saction . Th e feature can be disabled via th e browser win dow's Tool s m en u in I n t ern et Opt i on s>Pri vacy. 1. Open a WWW session in the Script Development Workbench. 2. Click Options>Record. The WWW Record Options dialog box opens. Set any relevant options. 3. Click OK. 4. For convenience, set conversion options now also. (You can set conversion options after recording your transaction, if you prefer, or even change pre-set options at any time after recording and then re-convert the capture file to apply the changes.): a. Click Options>Convert. The Universal Convert Options dialog box opens. b. Set any applicable options. c. Click OK. 5. From the toolbar, click the Start Record button. QALoad launches your application and any proxies, if necessary, and begins recording calls. 6. Record the transaction. 7. When you are finished, click the Stop Record button. You will be prompted to save your capture file. By default, capture files (.cap) are saved in the directory QALoad\Middlewares\WWW\captures. 8. If you previously set options to prompt automatic conversion, your capture file will be converted to a Visual Script and will open automatically in the editor. For more information about setting up automatic conversion, see Configuring the Script Development Workbench. If n ot, you will be prom pt ed to save an d n am e your file. W h en you are fin ish ed, click OK. 9. Click the Script Development Workbench's Captures tab and locate the capture file you just saved. 10. Right-click the file and choose Convert. QALoad will convert your capture file to a Visual Navigator script and open it in the editor. Visual Navigator Files W h en you create a scri pt usin g Visual Navigator, QALoad saves im port an t in form ation about your script in th e followin g files. Th ese files are saved in th e directory \Compuware\QALoad\Middlewares\WWW in th e subdirectories \Scripts an d \Captures. Som e of th ese files can be m odified, an d can be open ed from th e Script Developm en t W orkben ch 's W orkspace pan e, if n ecessary. Not e: If you choose to enable support for Siebel while converting a capture file, you must copy the ssdtcorr.hpp, ssdtcorr.lib, and ssdtcorr.dll Siebel files from the Siebel installation folder to the C:\Program 292 QALoad On lin e Help Files\Compuware\QALoad\BinaryFiles. If you do not modify the Siebel instance, you only have to move the ssdtcorr.dll file. Fi l en am e Descri pt i on Fi l es Gen erat ed From Recordi n g <filename>.cap A file con tain in g all of th e requests an d respon ses th at were recorded. <filename>.rfd Replies to subrequests, wh ich m ostly con sist of im ages, style sh eets, an d javascripts. Th is data is used to visually recreate th e pages as th ey appeared wh en recordin g. Fi l es Gen erat ed From Con ver si on t o a Vi sual Scri pt <filename>.vistree Con tain s m ost of th e elem en ts of th e Visual Navigator tree, in cludin g an y elem en ts th at you m odify later or add to your scri pt. <filename>.VisHtml Con tain s th e HTM L pages of all th e m ain requests as well as i m ages, stylesh eets, an d oth er subrequested pages. Th is data is used to visually recreate th e pages as th ey appeared wh en recordin g. <filename>.VisXml Con tain s an y XM L/ SOAP in form ation th at was recorded. <filename>.cpp A C++ represen tation of your script. In sertin g Script Item s Inserting Script Items You can in sert a n um ber of script item s in to your con verted script. To i n ser t t r ee i t em s: 1. 2. Do one of the following: ! From th e Script Developm en t W orkben ch m ain m en u, ch oose Vi sual Navi gat or >I n sert Tree I t em . ! Righ t-click in th e tree-view (left pan e) an d ch oose I n sert Tree I t em . Choose the item to insert. M ost of th e in serted item s can be m oved up an d down th e tree usin g th e Up/ Dow n arrows in th e form view (bottom pan e) for th at item . You can also del ete an item h igh ligh ted in th e tree-view by ch oosin g Del et e Tree I t em from th e m en u. 293 Usin g th e Player, Script Developm en t W orkben ch , an d An alyze Th e followin g script item s can be in serted from th e Vi sual Navi gat or m en u: Extract Strin g Cookie Http Header Con ten t Ch eck CGI Param eter Syn ch IP Spoof Read Dat apool Ch eckpoin t pair In crem en t Variable/ Decrem en t Variable/ Reset Vari able Prin t Values (debuggin g) Com m en t Inserting cookies into a script Cookie item s can be added directly to th e Htm l Page item th ey apply to, un der th e Act i on item (for exam ple, a Click on Lin k item ). To i n ser t a cook i e i t em : 1. In the Visual Navigator tree-view (left pane), navigate to the Html Page item requiring the cookie and then click on it to select it. 2. From the menu, choose Visual Navigator>Insert Tree Item>Cookie. A Cookie form-view opens in the bottom pane. 3. In the Name field, type a name for the new Cookie or click Var Wiz... to access the Select Variable dialog box where you can select a value from a datapool file or create a variable for this field. 4. In the Value field, type a value for the new Cookie or click Var Wiz... to access the Select Variable dialog box where you can select a value from a datapool file or create a variable for this field. 5. Click Save to save your changes. Th e Cookie item is added to th e script for th e select ed Htm l Page item . Inserting HTTP headers into a Visual Navigator script You can in sert HTTP h eaders un der th e Com m on Http Headers tree item . To i n ser t a n ew Ht t p Head er i t em : 294 1. In the Visual Navigator tree-view (left pane), navigate to the Common Http Headers script item, and then click on it. 2. From the menu, choose Visual Navigator>Insert Tree Item>Http Header. An Http Header form-view opens in the bottom pane. 3. In the Name field, type a name for the new header or click Var Wiz... to access the Select Variable dialog box where you can select a value from a datapool file or create a variable for this field. QALoad On lin e Help 4. In the Value field, type a value for the new header or click Var Wiz... to access the Select Variable dialog box where you can select a value from a datapool file or create a variable for this field. 5. Click Save to save your changes. Th e h eader item is added to th e script, an d will be used for all requests at playback un less it is overwritten by a h eader with th e sam e n am e un dern eath an in di vidual request action . XM L Support XML Support QALoad's XM L support is h an dled th rough th e Script Developm en t W orkben ch 's Visual Navigator, wh ich displays your scri pt's HTTP or XM L requests in an easy-to-use, visually-based in terface th at offers you poin t-an d-click scri pt edit in g. Alth ough XM L is supported th rough th e Visual Navigator, Com puware recom m en ds you read th rough th is h elp topic as well as th e Visual Navigator h elp topics to becom e fam iliar with th e features th at are un ique to QALoad's XM L support. W h en an HTTP request is m ade for an X M L docum en t, eith er in th e form of an HTTP GET request or an HTTP POST request with an XM L docum en t as th e post data, th e dat a is displayed in th e th ree Visual Navigator pan es as illustrated below. Click on a pan e in th e graph ic for a description of its con ten ts an d fun ction ality. Not e: To make the following graphic fit better in this help window, the Script Development Workbench toolbars and panes that are not directly related to this help topic are not displayed. You can hide/ show many of the Script Development Workbench toolbars and panes using commands available from the View menu. XML Support QALoad's XM L support is h an dled th rough th e Script Developm en t W orkben ch 's Visual Navigator, wh ich displays your scri pt's HTTP or XM L requests in an easy-to-use, visually-based in terface th at offers you 295 Usin g th e Player, Script Developm en t W orkben ch , an d An alyze poin t-an d-click scri pt edit in g. Alth ough XM L is supported th rough th e Visual Navigator, Com puware recom m en ds you read th rough th is h elp topic as well as th e Visual Navigator h elp topics to becom e fam iliar with th e features th at are un ique to QALoad's XM L support. W h en an HTTP request is m ade for an X M L docum en t, eith er in th e form of an HTTP GET request or an HTTP POST request with an XM L docum en t as th e post data, th e dat a is displayed in th e th ree Visual Navigator pan es as illustrated below. Click on a pan e in th e graph ic for a description of its con ten ts an d fun ction ality. Not e: To make the following graphic fit better in this help window, the Script Development Workbench toolbars and panes that are not directly related to this help topic are not displayed. You can hide/ show many of the Script Development Workbench toolbars and panes using commands available from the View menu. XML Requests W h en an HTTP request is for an XM L docum en t, eith er in th e form of an HTTP GET request, or an HTTP POST request with an XM L docum en t as th e post data, th en an XM L Request tree item is displayed in t h e tree-view (left pan e). Th e form -view (bottom pan e) for an XM L Request item i n cludes th e followin g fields: Repl y St at us: Th e reply st atus code. Th e status code is 200 OK for m ost pages th at return correctly. Request URI : Th is read-on ly field sh ows th e URI requested, wh ich resulted in th is page bein g displayed. Ch eck poi n t Nam e: If th e page h as a title, it is used as th e ch eckpoin t n am e. If n ot, th e word Checkpoint is used. To m ake sure all ch eckpoin t n am es are un ique, QALoad adds a n um ber to th e begin n in g of th e ch eckpoin t n am e. XML Request Sub-items An XM L Request item can con tain th e followin g sub-item s. XML Reply 296 QALoad On lin e Help Th e URI of th e docum en t return ed as a result of th e XM L request. X M L data correspon din g to th e reply is displayed in th e browser-view. HTTP Headers If a h eader exists un der an action item , it is sen t for th at request on ly. If th e h eader h as th e sam e n am e as on e of th e com m on h eaders, it overrides th e com m on h eader for th is request on ly. Th e form -view (bott om pan e) for an HTTP h eader lists its n am e an d value. Because th ere is n o XM L data recorded for a h eader, th e browser-view rem ain s em pty. It is possible to in sert addition al HTTP Headers. Cookies CGI Parameter Th e Cookies tree item con tain s a list of Cookie item s th at were sen t in th e h eader of th e request th at th is item m ade wh ile bein g recorded. Cookies are added autom atically by th e browser based on th e URI th at is bein g requested. Th ey are eith er set as a result of th e previous reply (server ret urn ed a Set-Cookie com m an d), or th ey are set by JavaScript con tain ed i n th e previous reply. Th e form -view for a cookie item lists its n am e an d value. Because th ere is n o X M L data recorded for a h eader, t h e browser-view rem ain s em pty. XML Document-view W h en you click on an X M L Request item in th e tree-view (left pan e) th e righ t pan e becom es a documentview displayin g a tree-view of details about th e XM L docum en t requested or return ed as th e result of an XM L request. Each in divi dual XM L item appears as a n ode in th e XM L docum en t tree. XM L elem en ts can h ave ch ild elem en ts an d th ese appear as ch ild n odes of th e XM L elem en t. Attributes of an elem en t appear as ch ild n odes of th e elem en t, with th e attribute value appearin g as a ch ild of th e attribute n am e. What if no XML data is associated with a request? If th ere is n o XM L docum en t associated with th e XM L request (for exam ple, an HTTP GET) a m essage in dicatin g th at th ere is n o XM L to be displayed is sh own in th e XM L docum en t-view. How does the document-view relate to the form-view? Selectin g an item in th e XM L docum en t tree displays th e form -view details correspon din g to th at XM L elem en t type in th e bottom pan e. Followin g is an exam ple of XM L request data displayed in a portion of th e X M L docum en t-view: XML Form-view W h en an XM L request is displayed in th e docum en t-view (top pan e) — as a result of an XM L request it em or XM L reply ch ild item bein g selected in th e Visual Navigator tree-view — you can click on item s in th e docum en t-view to display in form ation about each i n th e form -view (bottom pan e). If n o XM L item is 297 Usin g th e Player, Script Developm en t W orkben ch , an d An alyze selected in th e docum en t-view, th e XM L Page form -view displ ays in stead. For XM L item s, th e form view display option s depen d on two th in gs: ! what type of XML item is selected in the Visual Navigator tree-view (left pane): an XML request or an XML reply ! what type of XML item is subsequently selected in the XML document-view (top pane) W h en an XM L item is selected in th e XM L docum en t-view, th e value of th at XM L item is displayed in an edit box in th e form -view. Som e values — attribute values an d text values — can be edited or vari ablized (th at is, substitutin g on e or m ore variables for th e value in an XM L request or selectin g th e return val ue from an XM L repl y item to be recei ved by a variable for later use in th e script). Text item s, wh ich are values between elem en t tags, an d attribute values represen t volatile item s in an XM L docum en t structure, used for passin g values to an d from W eb Services, for exam ple. Th e followin g tables list th e possible action s for X M L item s displayed in a form -view. Valid action s are determ in ed by th e XM L it em type an d wh eth er th e item is from an HTTP POST request or from an HTTP reply. In th e followin g tables: ! If an item is editable, the value in the form-view can be changed and the new value is used during replay. ! If a value can be variablized, a variable can be substituted for all or part of the value. The variable's value is placed in the variable's location at replay. An example is a value received from an item from a previous XML document reply. ! If a variable can receive a replay value, the return value for the item can be placed into a selected variable during replay. The variable can then be substituted for an input value in a later XML request. X M L Request I t em s X M L Request I t em Edi t abl e? Can t h e Val ue be Vari abl i zed? Declaration No No DTD (Docum en t Type Defin ition ) No No PI (Processin g In struction ) No No Com m en t No No Elem en t No No Attribute (Nam e) No No Attribute (Value) Yes Yes Text Yes Yes X M L Repl y I t em s X M L Request I t em Can Vari abl e Recei ve Repl ay Val ue Declaration No DTD (Docum en t Type No 298 QALoad On lin e Help Defin ition ) PI (Processin g In struction ) No Com m en t No Elem en t No Attribute (Nam e) No Attribute (Value) Yes Text Yes Test Part ner Creating a TestPartner Script To create a TestPartn er script, in sert an y n um ber of TestPartn er tran saction s (TestPartn er scripts) in to a QALoad tem plat e script accessible from th e QALoad Script Developm en t W orkben ch . Th e tem plate scri pt is a sim ple QALoad script th at can be com piled an d run ; h owever, it con tain s n o fun ction ality un til you in sert th e TestPartn er tran saction s appropriate for your testin g n eeds. Not e: TestPartner must be installed and properly configured on your machine to create a TestPartner script. To create a QALoad script to execute a TestPartn er tran saction , follow th e steps below. To cr eat e a n ew Test Par t n er scr i p t : 1. With a TestPartner session open, choose Session>Generate Script from the menu. The Create New TestPartner Execution Script dialog box opens. 2. In the DSN drop-down list, select the DSN, which gets populated from the DSNConfiguration.ini file in TestPartner. 3. In the Userid and Password fields, type the user id and password associated with the DSN. Click Connect. The TestPartner Script Selection fields are enabled. 4. In the Project Name drop-down list, select a project that exists in the selected DSN. The Available Scripts list displays all the scripts and visual tests that belong to the selected project name. 5. Select the Automatically include Checkpoint check box to automatically insert checkpoints in the script when it is created. If you do not want checkpoints inserted, clear this check box. 6. In the Available Scripts list, select a script or visual test name to add it to the Selected Scripts list. Click Add to add the selected script. Repeat this step to continue adding individual scripts. To add all scripts at once, click Add All. Tip: You can add multiple scripts and visual tests to the Selected Scripts list. The scripts and tests can be from the same or different projects and also from different DSNs. 7. (optional) In the Selected Scripts list, move the script up or down on the list by selecting the script and clicking Up or Down to execute scripts in a certain order. To remove a script, select a script and click Remove to delete the selected script from the list. To remove all scripts at once, click Remove All. 8. In the QALoad Script Name field, type a new script name. To edit an existing script, click the ...(Browse) button to open the Choose Script Name dialog box and select an existing script. 9. Click Create Script to generate the QALoad script. 299 Usin g th e Player, Script Developm en t W orkben ch , an d An alyze 10. To compile the script for testing, select Session>Compile. Caut ion: When validating the script, you may need to increase the value in the Wait up t o field, which is the amount of time needed for the script to execute before timing out. Inserting a TestPartner Script You can in sert an y n um ber of TestPartn er tran saction s (TestPartn er scripts) in to a QALoad tem pl ate script accessible from th e QALoad Script Developm en t W orkben ch . Not e: TestPartner must be installed and properly configured on your machine to insert a TestPartner script. To i n ser t a Test Par t n er scr i p t : 1. Start the Script Development Workbench and open a TestPartner session. From the Session menu, choose New Template to create a new script from the QALoad template script. 2. In the Choose Script Name dialog box, type a name for the QALoad script in the Script Name field and click OK. The script is saved in the directory \Program Files\Compuware\QALoad\Middlewares\TestPartner\Scripts, and the script opens in the script editor. 3. Edit the script as necessary. You can manually enter any transactions or scripting commands directly in the script. 4. To insert a TestPartner transaction in the script, position your cursor anywhere after the SYNCHRONIZE() or before the TP_Uninit() command. 5. From the Session menu, choose Insert>TestPartner Script. The Insert New TestPartner Execution Script dialog box appears. 6. In the DSN drop-down list, select the DSN, which gets populated from the DSNConfiguration.ini file in TestPartner. 7. In the Userid and Password fields, type the user id and password associated with the DSN. Click Connect. The TestPartner Script Selection fields are enabled. 8. In the Project Name drop-down list, select a project that exists in the selected DSN. The Available Scripts list displays all the scripts and visual tests that belong to the selected project name. 9. Select the Automatically include Checkpoint check box to automatically insert checkpoints in the script. If you do not want checkpoints inserted, clear this check box. 10. In the Available Scripts list, select a script or visual test name to add it to the Selected Scripts list. Click Add to add the selected script. Repeat this step to continue adding individual scripts. To add all scripts at once, click Add All. Tip: You can add multiple scripts and visual tests to the Selected Scripts list. The scripts and tests can be from the same or different projects and also from different DSNs. 11. (optional) In the Selected Scripts list, move the script up or down on the list by selecting the script and clicking Up or Down to execute scripts in a certain order. To remove a script, select a script and click Remove to delete the selected script from the list. To remove all scripts at once, click Remove All. 12. Click OK. When you are finished, save any changes. 13. To compile the script for testing, select Session>Compile. Caut ion: When validating the script, you may need to increase the value in the Wait up t o field, which is the amount of time needed for the script to execute before timing out. Selecting M ultiple TestPartner Scripts You can in sert an y n um ber of TestPartn er tran saction s (scripts) in to a QALoad tem plate scri pt accessibl e from th e QALoad Script Developm en t W orkben ch . Th ese TestPartn er scripts an d visual tests can h ave th e sam e n am e an d can be from th e sam e or differen t projects or from differen t DSNs. Th e wrappin g of each execute script com m an d in a QALoad ch eckpoin t h as t h e sam e script n am e, but is autom atically labeled by a dash (–) an d a n um ber. For exam ple, if th e script n am e called 'TestScript1' exists 300 QALoad On lin e Help m ore th an on e tim e, QALoad assign s th e n am es, checkpoint(TestScript1-1), checkpoint(TestScript1-2), an d so on . Ex am pl e Developing a Script Recording a Transact ion Recording Middleware Calls QALoad begin s recordin g before startin g your application , en surin g th at an y early startup activity is recorded. Hint : You can save yourself some steps later by setting options now to automatically convert your recorded capture file and compile it into a script. To r ecor d a m i d d l ew ar e cal l : (W W W on ly) If you are run n in g your application on W in dows XP SP2, Com puware recom m en ds you turn th e 'pop-up blocker' feature off before recordin g a tran saction . Th e feature can be disabled via th e browser win dow's Tool s m en u in I n t ern et Opt i on s>Pri vacy . 1. Open an appropriate middleware session in the QALoad Script Development Workbench. 2. (Oracle Forms Server only) Choose Options>Workbench, then click the Compiler Settings tab. In the Java section of the dialog box, set the location of your Java files for recording. 3. Select Session>Record>Start. QALoad launches your application and any proxies, if necessary, and begins recording any calls. 4. Run the desired user operations using your application. 5. (WWW only) If you are capturing SSL requests using EasyScript for Secure WWW, the browser generates one or more prompts indicating the following: 301 Usin g th e Player, Script Developm en t W orkben ch , an d An alyze ! It does n ot recogn ize th e auth ority wh o sign ed th e server certificate. ! Th e server certificate presen ted by th e W eb site does n ot con tain th e correct site n am e. W h en you recei ve th ese prom pts, click th e browser’s Next or Con tin ue button so you can con n ect to an d exch an ge in form ation with th e desired W eb site. 6. (Optional) At any time during the recording process, you can insert any necessary commands or comments into the capture file. 7. When you have recorded a complete transaction, stop the application from which you are recording. 8. When you finish, click Stop Record. You are prompted to save your capture file. By default, capture files (.cap) are saved in the QALoad\Middlewares\<middleware_name>\captures directory. Not e: If QALoad is not able to record from your application, try QALoad’s alternate procedure for recording. Th e Script Developm en t W orkben ch autom atically con verts a capture file to a script file wh en you stop th e recordin g process. You are prom pted if a scri pt by th e sam e n am e already exists, so th at you can decide wh eth er to overwrite an existin g script or to save your script un der a differen t n am e. Inserting Commands/ Comments into a Capture File You can in sert com m an ds or com m en ts wh ile recordin g a capture file. To i n ser t com m an d s/ com m en t s i n t o a cap t ur e f i l e: 1. On the Recording toolbar, click Insert Command. The toolbar expands into a window where you can select options for inserting commands into your capture file. 2. In the Command Type area, select whether you want to insert a comment or a begin/end checkpoint. 3. In the Command Info area, type your comment or a description of the checkpoint. 4. Do one of the following: 5. ! Click I n sert to in sert your com m en t or ch eckpoin t com m an d in to your capture file. ! Click I n sert Com m an d again to close th e expan ded win dow with out in sertin g a com m an d. Continue recording your transaction as usual. Recording with Manual Program Startup Use th is procedure to m an ually start your application an d th e Record facility. You can start your application at an y tim e before or after startin g to record. Th is procedure on ly appli es to W in sock an d SAP. To r ecor d w i t h m an ual p r og r am st ar t up : 302 1. Access the QALoad Script Development Workbench. Details 2. Choose the appropriate session from the Session menu. 3. From the Options menu, choose Record to open the Record Options wizard. 4. On your middleware tab, select the User Started Program option. Click OK. QALoad On lin e Help 5. WWW Only: Start your browser. 6. Click Start Record. 7. Start your application (SAP only: start QALSAP.EXE, which is located in the \QALoad directory). 8. Run the user operations you want to record. As you execute the operations, QALoad records the operations in a capture file (.cap). 9. (Optional) At any time during the recording process, you can insert any necessary commands or comments into the capture file. Details 10. When you finish, click Stop Record. You must stop recording before you shut down the application from which you are recording. QALoad prompts you to save your capture file. By default, capture files are saved in the QALoad\Middlewares\<middleware_name>\Captures directory . Changing recording options without recording You can view an d ch an ge recordin g option s at an y t im e with out recordin g a capture file. To ch an g e r ecor d i n g op t i on s w i t h out r ecor d i n g : 1. Access the QALoad Script Development Workbench. Details 2. From the Session menu, select the appropriate middleware or start a Universal session. 3. From the Options menu, choose Record. The Record Options wizard opens, showing a page of recording options for the middleware you selected. 4. On the middleware page, select options and enter information as appropriate. 5. Click OK. For a description of available recordin g option s, see Record Option s W izard. Convert ing a Transact ion t o a Script Converting A capture file con tain s all th e raw dat a th at was recorded, but it n eeds to be con verted in to an edit able script file before you can proceed. Th e scri pt file can th en be open in th e Script Developm en t W orkben ch editor an d edited as n eeded. To con ver t a cap t ur e f i l e t o a scr i p t : 1. Access the QALoad Script Development Workbench. Details. 2. From the Session menu, choose the session you want to start. 3. If you have not already done so, set conversion options. 4. In the Workspace Pane, click the Captures tab. 5. Click the capture file you want to convert and click Session>Convert. The capture file is converted to a script. In the Workspace Pane, click the Scripts tab to view the list of scripts you have converted. Not e: If an Error/ Warning Summary opens in the Out put Pane, resolve any errors. 6. Compile the script. Not e: You can set an option to automatically convert your recorded transactions into scripts. How? 303 Usin g th e Player, Script Developm en t W orkben ch , an d An alyze Setting Conversion Options Before you begin recordin g, you can set option s to autom atically custom ize your script durin g con versi on . Com puware recom m en ds you set con version option s before recordin g, th en use th e option to autom atically con vert your capture files to scripts. Details 1. Access the Script Development Workbench. Details 2. From the Session menu, select the appropriate middleware or start a Universal session. 3. Select Options>Convert to open the appropriate Convert Options dialog box. 4. Choose General>Convert Options from the options tree and set any applicable options. This tree-view contains common options that apply to all the middleware environments QALoad supports. 5. Click the middleware-specific convert options in the Session Options tree, and set any appropriate middlewarespecific options. Not es: For th e Citrix W eb In terface en viron m en t, you m ust select option s in both th e Citrix Con vert Option s an d th e W W W Con vert Option s in th e tree view. For WWW, refer to Using the WWW Convert Options. 6. When you are finished, click OK to save the current settings. Hint : Press F1 from any middleware options tab for a description of available options. Set Up Automatic Conversion and Compilation of a Script Th e Script Developm en t W orkben ch autom atically con verts a capture file wh en you stop th e recordin g process an d com pile th e resultin g script. You are prom pted if a script by th e sam e n am e already exists, so th at you can decide wh eth er to overwrite an existin g script or to save your script un der a differen t n am e. If th e default settin gs to autom atically con vert a capture file h ave been ch an ged, follow th e steps below to reset th e autom atic con version an d com pilation . To set up aut om at i c con ver si on an d com p i l at i on : 1. From the Script Development Workbench menu, choose Options>Workbench. 2. Click the Convert Options item, and select the check box Automatically Convert Capture. 3. Click the Record Options tree item. 4. Select the check box Automatically compile scripts. 5. Select the check box Prompt before overwriting script to ensure that a script is not overwritten accidentally. 6. Click OK to save your settings. Edit ing a Script Editing a Script Th e Fun ction W izard allows you to qui ckly an d easily edit your scri pt by ch oosin g from th e QALoad com m an ds available to your script an d in sertin g th em with a click of your m ouse. 304 QALoad On lin e Help Th e Fun ction W izard is located in th e Script Devel opm en t W orkben ch in a pan e on th e righ t side of th e win dow. You can en able or disable th e Fun ction W izard from th e Vi ew m en u or by clickin g th e Sh ow or H i de Fun ct i on W i zard button on th e toolbar. Th e Fun ction W izard lists all fun ction s th at are vali d to use in your open script. Fun ction s are grouped in logical section s with in th e top win dow of th e wizard. W h en you h igh ligh t a function in th e top win dow of th e wizard, th e lower win dow lists a descri ption of th at fun ction an d its param eters. To in sert a fun ction in to your script, locate it in th e Fun ction W izard an d th en sim ply drag-an d-drop t h e fun ction in to your script. Th e fun ction will be written in to your script at th e poin t you ch ose. W h en you in sert a fun ction usin g th e wizard, a text box open s sh owin g th e proper syn tax an d param eter opt ion s. (Th e text box m ay n ot appear if an associated variable or object h as n ot been declared in th e script.) As you edit th e fun ction 's param eters, th e text box h igh ligh ts th e param eter th at is curren tly bein g edited. Using Custom Counters and Messages QALoad allows you to defi n e your own coun ters an d in sert m essages in to your script, wh ere th ey are written to your tim in g file an d are viewable in An al yze or at run tim e in th e Con ductor. Coun ters can be eith er cumulative or instance. Th is determ in es h ow th ey are graph ed in An alyze: ! For a cumulative counter, Analyze keeps a running sum of the counter while graphing verses elapsed time. This type of counter is used for all the WWW error counters. Each time a WWW error occurs, a value of 1 (one) is written for that counter. When looking at a detailed view in Analyze, you can see at what times that error occurred. When you graph a counter in Analyze, the graph shows the total number of occurrences verses the elapsed time. ! For an instance counter, Analyze graphs each value directly. No summing of previous values is done. Coun ters m ust be added m an ually usin g th e QALoad com m an ds DEFINE_COUNTER an d COUNTER_VALUE. M essages m ust be added m an ually usin g th e QALoad com m an d SCRIPT_M ESSAGE. Th e followin g sam ple scri pt illustrates both script coun ters an d m essages: #include <stdio.h> #include "smacro.h" #include "do_www.h" int rhobot_script( PLAYER_INFO *s_info ) { char buf1[256]; int id1, id2, id3, id4; DEFINE_TRANS_TYPE( "ScriptCounters " ); DO_InitHttp(s_info); 305 Usin g th e Player, Script Developm en t W orkben ch , an d An alyze // "Counter Group", "Counter Name", "Counter Units (Optional)", // Data Type, Counter Type. id1 = DEFINE_COUNTER( "Cumulative Group", "Cumulative long", 0, DATA_LONG, COUNTER_CUMULATIVE); id2 = DEFINE_COUNTER( "Cumulative Group", "Cumulative float", 0, DATA_FLOAT, COUNTER_CUMULATIVE); id3 = DEFINE_COUNTER( "Instance Group", "Instance long", 0, DATA_LONG, COUNTER_INSTANCE); id4 = DEFINE_COUNTER( "Instance Group", "Instance float", 0, DATA_FLOAT, COUNTER_INSTANCE); SYNCHRONIZE(); BEGIN_TRANSACTION(); // add value to cumulative counter 1 COUNTER_VALUE( id1, 1 ); DO_SLEEP( 2 ); // add value to cumulative counter 2 COUNTER_VALUE( id2, 1.5 ); RND_DELAY( 6 ); // add value to instance counter 1 COUNTER_VALUE( id3, s_info->nRndDelay ); // add custom message for this user wsprintf( buf1, "User %d slept for %d milliseconds during transaction %d", s_info->nAbsVUNum, s_info->nRndDelay, s_info->s_trans_count ); SCRIPT_MESSAGE( "User Messages", buf1 ); DO_SLEEP( 2 ); // add value to instance counter 2 // relative user number plus pi times the current transaction number COUNTER_VALUE( id4, s_info->nRelVUNum + ( 3.14159 * s_info->s_trans_count ) ); END_TRANSACTION(); DO_FreeHttp(); REPORT(SUCCESS); EXIT(); } Defining Checkpoints Ch eckpoin t statem en ts collect tim in gs of even ts, such as th e execution of SQL statem en ts. If you m an ually in sert ch eckpoin t statem en ts in to your capture file durin g th e recordin g process, or if you select th e I n cl ude Def aul t Ch eck poi n t St at em en t s con version option before con vertin g a script, your scri pt in cludes ch eckpoin ts. Oth erwise, you m ust m an ually in sert ch eckpoin ts in your scripts to collect tim in gs. Defining Transaction Loops If you did n ot in sert begin -an d en d-tran saction com m an ds in to your capture file, QALoad’s Con vert faci lity autom atically places begin -an d en d-tran saction com m an ds at th e start an d en d of th e recorded sequen ce. QALoad scri pts execute th e code between th e begin -an d en d-tran saction com m an ds in a loop accordin g to th e n um ber of tim es you specify in th e QALoad Con ductor wh en settin g up a test. Depen din g on h ow you com pleted your recordin g, you m ay wan t to m ove on e or both of th ese tran saction com m an ds to an oth er place in th e script to m ore accurately defin e th e tran saction th at run s durin g th e load test. 306 QALoad On lin e Help For exam ple, let’s say duri n g th e recordin g process you log in an d log out as part of th e procedure. However, durin g th e load test you do n ot wan t to log in an d log out as part of every tran saction . To avoid a login an d logout with every procedure, m ove th e begin - an d en d-tran saction com m an ds so th e login an d logout com m an ds are out side of th e tran saction loop. Simulating User-Entered Data W h en you create a scri pt, you probably h ave som e con stan t data em bedded in th e script, for exam ple, an em ployee n um ber, th at autom atically en ters your application ’s in put fields wh ile recordin g. If you run a load test usin g th is script, th e script uses th e sam e data for each tran saction . To run a realistic test, you can m odify th e script to use variable dat a from a datapool file. By varyin g th e data in put over th e course of a test, th e beh avior m ore realistically em ulates th e beh avior of m ultiple users. You can use th e QALoad Script Devel opm en t W orkben ch to create, m ain tain , an d use datapool files (.dat) to in sert variable dat a in to your scripts. A datapool can be defin ed as eith er cen tral or local: ! Central: a datapool that resides on the same workstation as the QALoad Conductor, and is available to any Player system on the network that requests it from the QALoad Conductor. A central datapool is controlled by the QALoad Conductor, and you use the QALoad Conductor to set any options relating to a central datapool. ! Local: a datapool that resides on a Player workstation, and is only available to that Player. Because a local datapool resides locally and is only available to the local Player, it does not generate any network traffic. Use the QALoad Script Development Workbench to insert local datapools into a script. Th e followin g section s describe h ow to create an d use cen tral an d local datapools. Creat i n g a Dat apool Fi l e You can create a datapool file usin g th e Script Developm en t W orkben ch . To cr eat e a d at ap ool f i l e: 1. Open a middleware session in the QALoad Script Development Workbench. 2. From the File menu, choose New. 3. On the New dialog box that opens, select New from the Datapools tree item. 4. In the Filename field, type a unique name for your datapool file. 5. In the Rows: and Cols: fields, type the number of rows and columns your new datapool should have. 6. Click OK. 7. Enter your datapool records in the grid that opens in the Workbook Pane. 8. When you are finished entering datapool records, click File>Save As to name your datapool file. 9. Click OK to save the file. QALoad saves the file in your \QALoad\Datapools directory. M odi f yi n g a Dat apool Fi l e You can m odify a dat apool file usin g th e Script Developm en t W orkben ch . To m od i f y a d at ap ool f i l e: 1. In the Workspace Pane, click the Datapools tab. 2. Double-click the datapool file you want to modify. The datapool file opens in the Workbook pane. 3. Make the appropriate changes and save the file. 307 Usin g th e Player, Script Developm en t W orkben ch , an d An alyze Usi n g a Cen t ral Dat apool Fi l e i n a Scri pt You assign a cen tral dat apool file to a specific scri pt by selectin g th e datapool file an d settin g an y appropriate option s usin g th e Con ductor. Each scri pt can use a sin gle cen tral datapool. Th e cen tral datapool is available to all Player workstation s run n i n g th e test. Th e followin g procedures describe h ow to assign an d extract dat a from a cen tral dat apool. Th ese procedures assum e you h ave already created th e datapool file as described above. To assi g n a cen t r al d at ap ool f i l e: 1. With a session ID file open in the QALoad Conductor, click the script icon the script Properties panel on the right-hand side of the window. in the Visual Designer to display 2. In the External Data section for the selected script, click the browse [...] button in the Central Datapools field. The Central Datapools page of the Script Properties dialog box appears. 3. Click Browse, select the correct datapool file, then click Open. 4. (Optional) If you wish to re-use the datapool records when the script reaches the end of the file, select Rewind. To only use each record once, and then discard it, select Strip. 5. When you are done, click OK. The Central Datapools field in the Properties panel now displays the number of central datapool files you've attached to the script. Usin g Data Records from a Cen tral Datapool File To use data from a cen tral datapool in your load test, you will h ave to m odify your script. Typically, you will read on e record per tran saction . To ad d d at ap ool st at em en t s t o your scr i p t : 1. With your script open in the QALoad Script Development Workbench, navigate to the place where you want to insert a datapool variable and highlight the text to replace. 2. From the Session menu, choose Insert>Datapool. The Insert New Datapool dialog box appears. 3. Select a datapool from the list and click OK, or click Add to open the Select Datapool dialog box where you can choose a datapool file to add to your test. 4. When you are finished, the QALoad Script Development Workbench places several datapool functions into your script, denoting them with markers so you can easily identify them. Usi n g Local Dat apool Fi l es i n a Scri pt You assign a local datapool file to a specific script by selectin g th e datapool fi le an d settin g an y appropriate option s usin g th e QALoad Script Developm en t W orkben ch . Each script can use up to 64 local datapool s. Use th e followin g procedures to assign an d extract data from a l ocal datapool file. Th ese procedures assum e you h ave created a datapool as described above. To assi g n a l ocal d at ap ool : 308 1. Open a session in the QALoad Script Development Workbench. 2. In the Workspace pane, click the Scripts tab, then double-click a script to open in the Workbook pane. 3. From the Session menu, choose Insert>Datapool. The Insert Datapool Commands dialog box appears. 4. On the Insert Datapool Commands dialog box, click Add. The Select Datapool dialog box opens. 5. In the Type field, select Local. Note that you can also choose to insert a central datapool from this dialog box. If you choose to insert a central datapool from here, the QALoad Script Development Workbench places the Conductor QALoad On lin e Help command GET_DATA into the script just after the BEGIN_TRANSACTION command, bookmarks the command in the margin of the script, and uses any options set for the specified datapool in the QALoad Conductor. 6. In the ID field, give the datapool a unique identifier. The name can contain alphanumeric characters only. Use underscores ( _ ) for spaces. This ID will help you identify the datapool in your script, for example “ACCOUNT_NUMS”. 7. In the Filename field, type (or browse for) the fully qualified path of your datapool file. For example: c:\Program Files\Compuware\QALoad\Workbench\<middleware_name>\Scripts\datapool.dat 8. If you wish to re-use the datapool records when the script reaches the end of the file, select Rewind at End of File. To only use each record once, and then discard it, clear this option. 9. When you are finished, click OK. The selected datapool is displayed on the Insert New Datapool dialog box. 10. Click OK. The QALoad Script Development Workbench will place a #define statement identifying the datapool file near the beginning of your script, and place the datapool commands OPEN_DATA_POOL, READ_DATA_RECORD, and CLOSE_DATA_POOL at the default locations in the script. These statements will be bookmarked in the margin for easy identification. 11. When you are finished modifying the script, save any changes. For det ailed in form ation about an y of th ese com m an ds, refer to th e Lan guage Referen ce section . Usin g Data Records from a Local Datapool File To use data from a local datapool file you will h ave to m odify your script to read data records an d fields at th e appropriate pl ace in t h e script. Dat apool files sh ould typically be open ed with th e statem en t OPEN_DATA_POOL just before th e BEGIN_TRANSACTION statem en t, th en datapool fields can be called i n to th e script to repl ace variable strin gs. Th e OPEN_DATA_POOL statem en t is autom atically in serted in to your script wh en you use th e QALoad Scri pt Developm en t W orkben ch to in sert your datapool. 1. Read a record from the datapool file using the following command, which reads a single record from the local datapool file you specify: READ_DATA_RECORD(<LOCAL DATAPOOL ID>); 2. To access the fields of this record, substitute GET_DATA_FIELD(ACCOUNT_NUMS, n) expressions in place of variable strings. 3. After the END_TRANSACTION statement, close the local datapool file by using the following statement: CLOSE_DATA_POOL( LOCAL DATAPOOL ID ); Note th at th is statem en t is added autom atically if you use th e QALoad Script Devel opm en t W orkben ch to in sert your datapool. For det ailed in form ation about an y of th ese com m an ds, refer to th e Lan guage Referen ce section . I n sert i n g Vari abl e Dat a w i t h Act i veDat a Subst i t ut i on Th e QALoad Script Devel opm en t W orkben ch allows you to tran sform strin g data from quoted con stan ts or substrin gs into variables. ActiveData variable substitution lets you iden tify an d righ t-click on a strin g to declare th e selected strin g a variable with in th e QALoad scri pt. Th is facility also lets you select or edit datapool en tries m ore dyn am ically, m akin g script developm en t easier an d m ore efficien t. To sub st i t ut e a d at ap ool val ue or a var i ab l e i n p l ace of a sel ect ed st r i n g i n your scr i p t : 1. Start the appropriate session in the QALoad Script Development Workbench. 2. In the Workspace pane, click the Scripts tab. 3. On the Script tab, double-click the script you wish to open. The script opens in the Workbook pane. 4. In the script, highlight the string you wish to replace. 5. Right-click anywhere in the highlighted string. ! To substitute a value from a datapool: 309 Usin g th e Player, Script Developm en t W orkben ch , an d An alyze ! 6. ! — Click Act i veDat a>Dat apool Subst i t ut i on in th e sh ortcut m en u th at open s. Th e Act i veDat a Dat apool Subst i t ut i on dialog box open s. ! In th e Dat apool (s) area, h igh ligh t th e datapool to use. Th e con ten ts of th e datapool file display bel ow. If th e datapool you wan t to use is n ot listed, click th e Add button to add it to th e list of available datapools. ! In th e Fi el d: I D field, type th e field n um ber of th e specific value to use from t h e datapool. ! W h en you are fin ish ed, cl ick OK. Th e QALoad Scri pt Developm en t W orkben ch will place a #define statem en t iden tifyin g th e datapool file at th e begin n in g of your script. It will also in sert th e datapool com m an ds OPEN_DATA_POOL, READ_DATA_RECORD, GET_DATA_FIELD an d CLOSE_DATA_POOL at th e default location s in th e script, an d bookm ark th em in th e m argin for easy iden tification . Refer to th e Lan guage Referen ce section for detailed in form ation about an y of th ose com m an ds. To substitute a variable: ! Click Act i veDat a>Vari abl e Subst i t ut i on from th e sh ortcut m en u th at appears. Th e Act i veDat a Vari abl e Subst i t ut i on dialog box open s. ! Assign a variable n am e for th e selected strin g in th e Vari abl e Nam e field. ! Click OK. Th e QALoad Script Developm en t W orkben ch will declare th e variable at th e begin n in g of your script an d substitute th e n am ed variable for th e select ed strin g. It will also bookm ark both locati on s for easy iden tification . When you are finished, save your script changes. Compuware recommends that you also compile your script to check for any errors. Compiling a Test Script A QALoad script is a real C++- or Java-based script, an d th erefore n eeds to be com piled before it can be used. QALoad works with your existin g com piler to com pile usable test scri pts. If you m ake ch an ges to an existin g script, you m ust re-com pile it before you can successfully use it in a test. If you add an un com piled or out-of-date scri pt to a l oad test, th e QALoad Con ductor will prom pt you to com pile th e scri pt. Set Up Automatic Conversion and Compilation of a Script Th e Script Developm en t W orkben ch autom atically con verts a capture file wh en you stop th e recordin g process an d com pile th e resultin g script. You are prom pted if a script by th e sam e n am e already exists, so th at you can decide wh eth er to overwrite an existin g script or to save your script un der a differen t n am e. If th e default settin gs to autom atically con vert a capture file h ave been ch an ged, follow th e steps below to reset th e autom atic con version an d com pilation . To set up aut om at i c con ver si on an d com p i l at i on : 310 1. From the Script Development Workbench menu, choose Options>Workbench. 2. Click the Convert Options item, and select the check box Automatically Convert Capture. 3. Click the Record Options tree item. 4. Select the check box Automatically compile scripts. 5. Select the check box Prompt before overwriting script to ensure that a script is not overwritten accidentally. 6. Click OK to save your settings. QALoad On lin e Help Validating Scripts in Workbench Before addin g a scri pt to a load test, validate it to en sure th at it run s with out problem s. Th e followin g procedure is on ly valid for W in 32 scripts. To validat e a UNIX scri pt, see Validatin g a UNIX script. Not e: Durin g validation of SAP scripts, do n ot m in im ize th e SAP win dow. If th e win dow is m in im ized, th e validation m ay fail. Th is problem does n ot occur if you de-select th e Sh ow Graph i cal User I n t erf ace f or SAP Users m iddleware option in th e Con ductor. Th is SAPGUI option run s SAP on an altern ate deskt op th at is n ot visible. To con f i g ur e t h e Scr i p t Devel op m en t W or k b en ch f or val i d at i on : 1. Click Options>Workbench and select the Validation item. 2. Select the Automatically Recompile check box if you want QALoad to compile a script before attempting to validate it. QALoad lists any compilation errors in the editor after compiling. 3. Select the Only Display Player Output on Script Failure check box to view only Player messages upon script failure, if applicable. 4. Select Display mouse coordinates on right-click in validation window if using Citrix, select this option to display the window coordinates in a tooltip window when right-clicking in the virtual replay window during validation. 5. Type a value in the Script Validation Timeout field. This is the number of seconds that the QALoad Script Development Workbench should wait for a script to execute before timing out. 6. In the Player Settings area, select the Abort on Error check box for QALoad to stop script execution upon encountering an error. 7. Select the Debug Data check box for the script to display a debug message indicating which command the script is executing. 8. In the Run As area, indicate whether the transaction should be run as thread- or process-based. Not e: Oracle Forms Server, Citrix, and Java scripts are limited to process-based validation only. 9. In the Number of users field, type a number of virtual users to run this script for validation. The default is 1. 10. Enter a value in the Transactions field. For validation, Compuware recommends that you accept the default value of 1 transaction. 11. In the Sleep Factor % field, type the percentage of each DO_SLEEP (pause in the script) to maintain. For validation, you may not need to run every pause in the script at its full length. The value can be a percentage between 0 and 100. The default is 0. 12. Click OK to save your changes. To val i d at e a scr i p t i n W or k b en ch : 1. In the Workspace Pane, click the Scripts tab. 2. Double-click on the appropriate script name to open the script. 3. From the Session menu, choose Validate Script. You receive a m essage an d trace in form ation in th e Output pan e. W h en th e script executes successfully, you receive a con firm ation m essage. If it does n ot execute successfully, use th e trace in form ation to h el p you iden tify errors. 311 Usin g th e Player, Script Developm en t W orkben ch , an d An alyze Using Datapools Creat i n g a Dat apool Fi l e To create a dat apool file usin g th e Script Developm en t W orkben ch , follow th e steps below. To cr eat e a d at ap ool f i l e: 1. Open a middleware session in the QALoad Script Development Workbench. 2. From the File menu, choose New. 3. On the New dialog box that opens, select New from the Datapools tree item. 4. In the Filename field, type a unique name for your datapool file. 5. In the Rows: and Cols: fields, type the number of rows and columns your new datapool should have. 6. Click OK. 7. Enter your datapool records in the grid that opens in the Workbook Pane. 8. When you are finished entering datapool records, click File>Save As to name your datapool file. 9. Click OK to save the file. QALoad saves the file in your \QALoad\Datapools directory. M odi f yi n g a Dat apool Fi l e To m odify a datapool file usin g th e Script Developm en t W orkben ch , follow th e steps below. To m od i f y a d at ap ool f i l e: 1. In the Workspace Pane, click the Datapools tab. 2. Double-click the datapool file you want to modify. The datapool file opens in the Workbook pane. 3. Make the appropriate changes and save the file. Usi n g a Cen t ral Dat apool Fi l e i n a Scri pt Assign a cen tral datapool file to a specific script by selectin g th e datapool file an d settin g an y appropriate option s usin g th e Con ductor. Each script can use a sin gle cen tral datapool. Th e cen tral datapool is available to all Player workstation s run n in g th e test. Th e followin g procedures describe h ow to assign an d extract dat a from a cen tral datapool. Th ese procedures assum e you h ave already created th e datapool fil e. To assi g n a cen t r al d at ap ool f i l e: 312 1. With a session ID file open in the QALoad Conductor, click the Script Assignment tab. 2. In the External Data column for the selected script, click Browse. 3. In the External Data dialog box, navigate to the datapool you wish to use. Select it and click Open. 4. If you wish to re-use the datapool records when the script reaches the end of the file, select Rewind. To only use each record once, and then discard it, select Strip. QALoad On lin e Help 5. When you are done, click OK. Using Data Records from a Central Datapool File To use data from a cen tral datapool in your load test, m odify your scri pt. Typi cally, you read on e record per tran saction . To i n ser t d at ap ool st at em en t s t o your scr i p t : 1. With your script open in the QALoad Script Development Workbench, navigate to the place where you want to insert a datapool variable and highlight the text to replace. 2. From the Session menu, choose Insert>Datapool. The Insert New Datapool dialog box appears. 3. Select a datapool from the list and click OK, or click Add to open the Select Datapool dialog box where you can choose a datapool file to add to your test. 4. When you are finished, the QALoad Script Development Workbench places several datapool functions into your script, denoting them with markers so you can easily identify them. Usi n g a Local Dat apool Fi l e i n a Scri pt Assign a local datapool file to a specific scri pt by selectin g th e datapool file an d settin g an y appropriate option s usin g th e QALoad Script Developm en t W orkben ch . Each script can use up to 64 local/ sh ared datapools. Use th e followi n g procedures to assign an d extract dat a from a local datapool file. Th ese procedures assum e you h ave created a datapool. To assi g n a l ocal d at ap ool : 1. Open a session in the QALoad Script Development Workbench. 2. In the Workspace pane, click the Scripts tab. 3. On the Scripts tab, double-click on the appropriate script name to open it in the Workbook pane. 4. From the Session menu, choose Insert>Datapool. The Insert Datapool Commands dialog box appears. 5. On the Insert Datapool Commands dialog box, click Add. The Select Datapool dialog box opens. 6. In the Type field, select Local. You can also choose to insert a central datapool from this dialog box. If you choose to insert a central datapool from here, the QALoad Script Development Workbench places the Conductor command GET_DATA into the script just after the BEGIN_TRANSACTION command, bookmarks the command in the margin of the script, and uses any options set for the specified datapool in the QALoad Conductor. 7. In the ID field, give the datapool a unique identifier. The name can contain alphanumeric characters only. Use underscores ( _ ) for spaces. This ID helps you identify the datapool in your script, for example “ACCOUNT_NUMS”. 8. In the Filename field, type (or browse for) the fully qualified path of your datapool file. For example: c:\Program Files\Compuware\QALoad\Workbench\<middleware_name>\Scripts\datapool.dat 9. If you wish to re-use the datapool records when the script reaches the end of the file, select Rewind at End of File. To only use each record once, and then discard it, select Do not rewind file. Note that the strip option is not available to local datapools. 10. When you are finished, click OK. The selected datapool is displayed on the Insert New Datapool dialog box. 11. Click OK. The QALoad Script Development Workbench places a #define statement identifying the datapool file near the beginning of your script, and place the datapool commands OPEN_DATA_POOL, READ_DATA_RECORD, and CLOSE_DATA_POOL at the default locations in the script. These statements are bookmarked in the margin for easy identification. 12. When you are finished modifying the script, save any changes. 313 Usin g th e Player, Script Developm en t W orkben ch , an d An alyze For det ailed in form ation about an y of th ese com m an ds, refer to th e Lan guage Referen ce section . Using Data Records from a Local Datapool File To use data from a local datapool file you h ave to m odify your script to read data records an d fields at th e appropriate place in th e script. Datapool files sh ould typically be open ed wit h th e statem en t OPEN_DATA_POOL just before th e BEGIN_TRANSACTION statem en t, th en datapool fields can be called i n to th e script to repl ace variable strin gs. Th e OPEN_DATA_POOL statem en t is autom atically in serted in to your script wh en you use th e QALoad Scri pt Developm en t W orkben ch to in sert your datapool. 1. Read a record from the datapool file using the following command, which reads a single record from the local datapool file you specify: READ_DATA_RECORD(<LOCAL DATAPOOL ID>); 2. To access the fields of this record, substitute GET_DATA_FIELD(ACCOUNT_NUMS, n) expressions in place of variable strings. 3. After the END_TRANSACTION statement, close the local datapool file by using the following statement: CLOSE_DATA_POOL( LOCAL DATAPOOL ID ). This statement is added automatically if you use the QALoad Script Development Workbench to insert your datapool. For det ailed in form ation about an y of th ese com m an ds, refer to th e Lan guage Referen ce section . Usi n g a Sh ared Dat apool Fi l e i n a Scri pt Assign a sh ared datapool file to a specific script by selectin g th e datapool file an d settin g an y appropriate option s usin g th e QALoad Script Developm en t W orkben ch . Each script can use up to 64 sh ared an d local datapools. Use th e followi n g procedures to assign an d extract dat a from a sh ared dat apool file. Th ese procedures assum e you h ave created a datapool. To assi g n a sh ar ed d at ap ool : 1. Open a session in the QALoad Script Development Workbench. 2. In the Workspace pane, click the Scripts tab. 3. On the Scripts tab, double-click on the appropriate script name to open it in the Workbook pane. 4. From the Session menu, choose Insert>Datapool. The Insert Datapool Commands dialog box appears. 5. On the Insert Datapool Commands dialog box, click Add. The Select Datapool dialog box opens. 6. In the Type field, select Shared. You can also choose to insert a central datapool from this dialog box. If you choose to insert a central datapool from here, the QALoad Script Development Workbench places the Conductor command GET_DATA into the script just after the BEGIN_TRANSACTION command, bookmarks the command in the margin of the script, and uses any options set for the specified datapool in the QALoad Conductor. 7. In the ID field, give the datapool a unique identifier. The name can contain alphanumeric characters only. Use underscores ( _ ) for spaces. This ID helps you identify the datapool in your script, for example “ACCOUNT_NUMS”. 8. In the Filename field, type (or browse for) the fully qualified path of your datapool file. For example: c:\Program Files\Compuware\QALoad\Workbench\<middleware_name>\Scripts\datapool.dat 9. If you wish to re-use the datapool records when the script reaches the end of the file, select Rewind at End of File. To only use each record once, and then discard it, select Do not rewind file. 10. If you wish to remove used datapool records after a test completes, select Strip file at end of test. Note that rewinding the datapool is not possible if you choose this option. 11. When you are finished, click OK. The selected datapool is displayed on the Insert New Datapool dialog box. 12. Click OK. The QALoad Script Development Workbench places a #define statement identifying the datapool file near the beginning of your script, and places the datapool commands OPEN_DATA_POOL, READ_DATA_RECORD, 314 QALoad On lin e Help and CLOSE_DATA_POOL at the default locations in the script. These statements are bookmarked in the margin for easy identification. 13. When you are finished modifying the script, save any changes. For det ailed in form ation about an y of th ese com m an ds, refer to th e Lan guage Referen ce section . Using Data Records from a Shared Datapool File To use data from a sh ared datapool file you h ave to m odify your script to read data records an d fields at th e appropriate place in th e script. Datapool files sh ould typically be open ed wit h th e statem en t OPEN_DATA_POOL just before th e BEGIN_TRANSACTION statem en t, th en datapool fields can be called i n to th e script to repl ace variable strin gs. Th e OPEN_DATA_POOL statem en t is autom atically in serted in to your script wh en you use th e QALoad Scri pt Developm en t W orkben ch to in sert your datapool. 1. Read a record from the datapool file using the following command, which reads a single record from the shared datapool file you specify: READ_DATA_RECORD(<SHARED DATAPOOL ID>); 2. To access the fields of this record, substitute GET_DATA_FIELD(ACCOUNT_NUMS, n) expressions in place of variable strings. 3. After the END_TRANSACTION statement, close the shared datapool file by using the following statement: CLOSE_DATA_POOL( <SHARED DATAPOOL ID> ). This statement is added automatically if you use the QALoad Script Development Workbench to insert your datapool. For det ailed in form ation about an y of th ese com m an ds, refer to th e Lan guage Referen ce section . Used Sh ared Dat apool Records Rem ov al Un like th e cen tral datapool, th e user is n ot prom pt ed to rem ove used records from a sh ared datapool. In stead, th e used records are autom ati cally rem oved from th e sh ared datapool at th e en d of a test. I n sert i n g Vari abl e Dat a w i t h Act i veDat a Subst i t ut i on Th e QALoad Script Devel opm en t W orkben ch allows you to tran sform strin g data from quoted con stan ts or substrin gs into variables. ActiveData variable substitution lets you iden tify an d righ t-click on a strin g to declare th e selected strin g a variable with in th e QALoad scri pt. Th is facility also lets you select or edit datapool en tries m ore dyn am ically, m akin g script developm en t easier an d m ore efficien t. To sub st i t ut e a d at ap ool val ue or a var i ab l e i n p l ace of a sel ect ed st r i n g i n your scr i p t : 1. Start the appropriate session in the QALoad Script Development Workbench. 2. In the Workspace pane, click the Scripts tab. 3. On the Script tab, double-click the script you wish to open. The script opens in the Workbook pane. 4. In the script, highlight the string you wish to replace. 5. Right-click anywhere in the highlighted string. ! To substitute a value from a datapool: ! Click Act i veDat a>Dat apool Subst i t ut i on in th e shortcut m en u th at open s. Th e Act i veDat a Dat apool Subst i t ut i on dialog box open s. ! In th e Dat apool (s) area, h igh ligh t th e datapool to use. Th e con ten ts of th e datapool file display bel ow. If th e datapool you wan t to use is n ot listed, click th e Add button to add it to th e list of available datapools. ! In th e Fi el d: I D field, type th e field n um ber of th e specific value to use from t h e datapool. 315 Usin g th e Player, Script Developm en t W orkben ch , an d An alyze ! ! 6. W h en you are fin ish ed, cl ick OK. Th e QALoad Scri pt Developm en t W orkben ch places a #define statem en t iden tifyin g th e datapool file at th e begin n in g of your script. It also in serts th e datapool com m an ds OPEN_DATA_POOL, READ_DATA_RECORD, GET_DATA_FIELD an d CLOSE_DATA_POOL at th e default location s in th e script, an d bookm arks th em in th e m argin for easy iden tification . Refer to th e Lan guage Referen ce section for detailed in form ation about an y of th ose com m an ds. To substitute a variable: ! Click Act i veDat a>Vari abl e Subst i t ut i on from th e sh ortcut m en u th at appears. Th e Act i veDat a Vari abl e Subst i t ut i on dialog box open s. ! Assign a variable n am e for th e selected strin g in th e Vari abl e Nam e field. ! Click OK. Th e QALoad Script Developm en t W orkben ch declares th e variable at th e begin n in g of your script an d substitutes th e n am ed variable for th e selected st rin g. It also bookm arks both locat ion s for easy iden tification . When you are finished, save your script changes. Compuware recommends that you also compile your script to check for any errors. Debugging a Script Setting Debugging Options for a Script If you en coun tered errors wh ile validatin g or testin g a script, use QALoad's debuggin g option s to m on itor th e Player(s) th at gen erated errors wh ile th ey are run n in g or after th e test. You can wat ch a virtual user execute a script on a Pl ayer W orkst ation wh ile it is run n in g. To m on itor selected virtual users at run tim e, en able th e Debug Trace option before you run your test. Each virtual user for wh ich you en abled Debug Trace displays m essages on its assign ed Player workstation in dicatin g wh ich com m an ds are bein g executed. You can in struct th e Con ductor to gen erate an d save details about th e script execution of selected virt ual users by en ablin g Logfile Gen eration before you run your test. Th is applies t o Citrix, ODBC, Oracle, Oracle Form s Server, SAP, W in sock, or W W W on ly. You can set th e Debug Option s usin g th e Script Properties pan el in th e Visual Design er, or usin g th e Grid View win dow. To en ab l e t h e Deb ug op t i on s: 1. Do one of the following: ! In th e Visual Design er, click th e script icon for th e appropri ate script to display th e Script Properties pan el on th e ri gh t-h an d side of th e win dow, th en click th e brow se [...] button in th e Debug Opt i on s field. Th e Debug win dow of th e Script Properties dialog box appears. OR ! 2. On the Debug Options dialog box, you can choose the following options: ! 316 In th e Grid View win dow, select th e Scri pt Assi gn m en t t ab, th en click th e brow se [...] button in th e Debug Opt i on s colum n , for th e appropriat e script. Th e Debug win dow of th e Script Properties di alog box appears. To en able th e Debug Trace option : in th e Debug Trace Virtual User Ran ge area, ch oose wh ich virtual users (if an y) to m on itor. You can ch oose Non e or All Virtual Users, or ch oose Virtual User(s) an d th en type th e n um bers assign ed to th e virtual users you wan t to m on itor. You can m on itor in dividual virtual users or ran ges of virtual users. QALoad On lin e Help ! To en able Logfile Gen erat ion : in th e Logfile Gen eration Virtual User Ran ge area, ch oose wh ich virtual users (if an y) to m on itor. You can ch oose Non e or All Virtual Users, or ch oose Virtual User(s) an d th en type th e n um bers assign ed to th e virtual users you wan t to m on itor. You can m on itor in dividual virtual users or ran ges of virtual users. 3. Click OK to save your changes. 4. From the Conductor's main menu, click File>Save to save your test session ID. 5. Run your test as usual. Not e: Some log files are generated automatically when you run a test in the Script Development Workbench or Player. QALoad Support Log Files Th e table below iden tifies th e QALoad log (support) files th at are gen erated autom atically durin g a test. Not e: Some log files are generated automatically when you run a test in the Script Development Workbench or Player. Each virtual user for wh ich you en abled Logfile Gen eration in Con ductor creates a file con tain in g in form ation about th eir perform an ce. After th e test is fin ish ed, th e Con ductor requests all log files from th e Players an d save th em in th e directory \Program Files\Compuware\QALoad\LogFiles on th e workstation wh ere th e Con ductor is in stalled. Log files are n am ed <scriptname>_<middleware>_vu<AbsoluteVirtualUserNumber>.<ext>, wh ere: ! <scriptname> is the name of the script the virtual user ran ! <middleware> is the name of your middleware application ! <AbsoluteVirtualUserNumber> is the identification number assigned to the virtual user ! <.ext> is the file extension, dependent upon which middleware application you are testing M i ddl ew are .RI P Fi l e .CAP Fi l e (Repl ay Capt ure) .TRC Fi l e Pl ayer Trace .LOG Fi l e Citrix Yes Yes Yes No ODBC No No Yes *Yes Oracle Form s Server Yes Yes Yes No SAP No No Yes Yes W in sock No No Yes *Yes WWW Yes Yes Yes No Not e: *This middleware also uses the .log file in replay capture. Verifying script checkpoints You can qui ckly verify th e syn tax of th e ch eckpoin t com m an ds Begin Ch eckpoin t() an d En dCh eckpoin t() in your script every tim e you com pile your scri pt by settin g a sin gle option , or on -th e-fly with a sin gle m en u com m an d. 317 Usin g th e Player, Script Developm en t W orkben ch , an d An alyze To aut om at i cal l y ver i f y scr i p t ch eck p oi n t s, ever y t i m e you com p i l e a scr i p t : 1. From the Script Development Workbench's main menu, click Options>Workbench. 2. On the Configuration Options dialog box, click the Compilation item. 3. Select the Verify Checkpoints option. 4. Click OK. Every tim e you com pile your script, th e Script Developm en t W orkben ch verifies th e syn tax of your ch eckpoin t statem en ts, an d en sures th e param eters passed in each pair m atch . If an y errors are en coun tered, an error m essage displays in th e Output pan e. You can click on an y error lin e to go directl y to th at lin e in th e script. To m an ual l y ver i f y scr i p t ch eck p oi n t s, f or t h e op en scr i p t on l y: W ith your script open in th e W orkbook pan e, click Sessi on >Veri f y Ch eck poi n t s. Th e Script Developm en t W orkben ch verifies th e syn tax of your ch eckpoin t statem en ts, an d en sures th e param eters passed in each pair m atch . If an y errors are en coun tered, an error m essage displays in th e Output pan e. You can click on an y error lin e to go directly to th at lin e in th e script. 318 QALoad On lin e Help Pl ayer Overview of t he QALoad Player Th e QALoad Player sim ulates on e or m ore virtual users run n in g C++-based scripts. Th ese scripts m im ic user activities to load test th e application , n etwork, an d server com pon en ts of a cli en t-server system . Th e QALoad Player sim ulates m ultiple clien ts sen din g m iddleware calls back to a server. Differen t types of m iddleware l ayers can be tested. W h en run n in g virtual user sim ulation , QALoad Player can em ulate m ultiple users from a sin gle platform usin g th e m ulti-taskin g features of 32-bit W in dows. Th e n um ber of users th at a sin gle h ardware system can em ulate is determ in ed by th e processor speed, m ain m em ory size, m iddleware l ayer, an d sim ulated tran saction rate. Please con tact your QALoad distributor for furth er sizin g in form ation . On ce started, QALoad Player fun ction s en tirely in th e backgroun d with out an y direct user in teraction . All com m an ds to QALoad Player com e from th e QALoad Con ductor. In fact, on ce QALoad Player h as been started, th e on ly in teracti on you m ay h ave with it is to ch an ge startup param eters or to save th e con ten ts of th e display win dow to a file. W h en th e Con ductor process closes for an y reason durin g a load test, th e associated Player processes term in ate. Citrix an d SAP scripts play back in a virtual user wi n dow on th e desktop. It is possible to en able or disable th e VU win dow from th e Con ductor's M iddl eware Option s dialog box. For in form ation about in stallin g UNIX Players, refer to th e QALoad Installation and Configuration Guide. You can access th is guide by clickin g St art >Al l Progr am s>Com puw are>QALoad>Docum en t at i on >I n st al l at i on Gui de. Inst alling UNIX Players For in form ation about in stallin g UNIX Players, please refer to th e QALoad Installation and Configuration Guide. You can access th is guide by clickin g St art >Al l Progr am s>Com puw are>QALoad>Docum en t at i on >I n st al l at i on Gui de. Transferring Script s t o a UNIX Player Norm ally, th e appropri ate script is automatically uploaded from th e QALoad Con ductor to th e Players an d com piled at run tim e. However, if it is ever n ecessary to m an ually tran sfer a script, use th e procedure th at follows. Not e: The machine where the QALoad Script Development Workbench is installed must have Winsockbased TCP/ IP to transfer a script to the UNIX machine where you wish to run it. To t r an sf er a scr i p t : Th e followin g procedure describes h ow to tran sfer a script file from th e W in dows workst ation wh ere t h e QALoad Script Devel opm en t W orkben ch resides to t h e system run n in g th e QALoad Player. 1. Access the Script Development Workbench. 319 Usin g th e Player, Script Developm en t W orkben ch , an d An alyze 2. From the Session menu, choose the middleware session you want to start. 3. In the Workspace Pane, click the Scripts tab. 4. On the Scripts tab, select the script you want to transfer. 5. From the Tools menu, choose FTP to open the FTP Transfer dialog box. Note that the file name you selected to transfer appears in the File to Transfer field. 6. Enter the Host Name, User Name, Password, and Destination Directory. 7. Click Transfer to send the file to the system where your QALoad Player is installed. 8. If you want to save the information you have entered for subsequent transfers, click Save Settings. 9. Click Close/Abort to exit the FTP Transfer dialog box. Validat ing Script s in t he Player Before addin g a scri pt to a load test, validate it to en sure th at it run s with out problem s. Th e followin g procedure is on ly valid for W in 32 scripts. To validat e a UNIX scri pt, see Validatin g a UNIX script. Not e: Durin g validation of SAP scripts, do n ot m in im ize th e SAP win dow. If th e win dow is m in im ized, th e validation m ay fail. Th is problem does n ot occur if you select th e H i de Graph i cal User I n t erf ace f or SAP User s option by clickin g Brow se [...] in th e Type colum n of th e Scri pt Assi gn m en t tab in th e Con ductor. Th is SAPGUI option run s SAP on an altern ate desktop th at is n ot visible. To con f i g ur e t h e Pl ayer f or val i d at i on : 1. In the Script Development Workbench, click Options>Workbench and select the Script Validation tab. 2. Select the Automatically Recompile check box if you want QALoad to compile a script before attempting to validate it. QALoad lists any compilation errors in the editor after compiling. 3. (For Java and OFS) select Ask for Automatic Validation of Java and OFS Scripts. 4. Select the Only Display Player Output on Script Failure check box to view only Player messages upon script failure, if applicable. 5. Type a value in the Wait up to field. This is the number of seconds that the QALoad Script Development Workbench should wait for a script to execute before timing out. 6. In the Player Settings area, select the Abort on Error check box for QALoad to stop script execution upon encountering an error. 7. Select the Debug Data check box for the script to display a debug message indicating which command the script is executing. 8. In the Run As area, indicate whether the transaction should be run as thread- or process-based. Not e: Oracle Forms Server, Citrix, and Java scripts are limited to process-based validation only. 9. In the Number of users field, type a number of virtual users to run this script for validation. The default is 1. 10. Enter a value in the Transactions field. For validation, Compuware recommends that you accept the default value of 1 transaction. 11. In the Sleep Factor % field, type the percentage of each DO_SLEEP (pause in the script) to maintain. For validation, you may not need to run every pause in the script at its full length. The value can be a percentage between 0 and 100. The default is 0. 12. Click OK to save your changes. To val i d at e a scr i p t i n t h e Pl ayer : 320 QALoad On lin e Help 1. In th e Com pi l ed Scri pt field, browse for th e com pil ed script DLL you wan t to validate. Com piled scripts are usually located in th e directory \Program Files\Compuware\QALoad\Scripts. 2. Type a value in th e Num ber of Users field. Com puware recom m en ds on e user for script validation . 3. Type a value in th e Tran sact i on s field. Com puware recom m en ds on e tran saction for script validation . 4. Select an y appropri ate option s to th e righ t of th e Com piled Script field. Th ese option s determ in e th e type an d am oun t of data th at will display in th e Player M ain W in dow. For description s of each option s, see th e topi c QALoad Player M ain W in dow. 5. In th e Run As area, select wh eth er th e tran saction sh ould run as t h read- or process-based. 6. Click St art to run th e script. Th e Player M ain W in dow will sh ow th e script's progress. If th e script run s successfully, it is valid to use in a load test. Player M ain Window QALoad Player M ain Window Th e QALoad Player M ain W in dow is divided in to two parts: ! Th e top portion con tain s fields, button s, an d option s th at h elp you con figure th e Player for scri pt validation . W h en an actual load test is in progress, th is area displays th e followin g in form ation : ! Versi on : Th e version of t h e QALoad Player. Pl ayer Nam e: Th e n etwork n am e assign ed to th e Player workstation . Pl ayer Address: Th e n etwork address of th e Player workstation . Pl ayer Port : Th e port n um ber on th is Player workstation bein g m on itored by th e QALoad Con ductor. Pl ayer i s run n i n g… th e t ype of virtual users th is Player is run n in g. Th e n um ber of virtual users an d tran saction s th is Player is run n in g. Th e bottom portion of th e Player M ain W in dow displays Player m essages wh i le a script is run n in g. Th is section describes th e con figuration option s on th e top portion of th e M ain W in dow. Fields and Buttons Com pi l ed Scri pt Navigate to th e com piled script (.dll) to validat e. User s Type th e n um ber of users to em ulate wh en validatin g th e selected script. Com puware recom m en ds on e user for script validation . Tran sact i on s Type th e n um ber of tran saction s to run wh en validatin g th e selected script. Com puware recom m en ds on e tran saction for scri pt vali dation . 321 Usin g th e Player, Script Developm en t W orkben ch , an d An alyze St art Click th e Start button to begin script validation . Player m essages will display below. Abort Click th e Abort button to stop all virtual users im m ediately. Ex i t Click th e Exit button to exit th e load test gracefully, wh en each virtual user is fin ish ed. Debug Dat a Select th is ch eck box to h ave th e Player displ ay a debug m essage in dicatin g wh ich com m an d th e script is executin g an d to gen erate W W W replay log files. RR__Fai l edM sg Select th is ch eck box to vi ew, in th e Player win dow, th e poin t wh ere a m iddleware com m an d with in your script fails. Ch eck Poi n t s Select th is ch eck box if you wan t to display th e Ch eck Poin t com m an d respon se tim es in th e Player win dow. Aut o Cl ear Select th is ch eck box to autom atically clear an y m essages from th e bottom portion of th e win dow before run n in g a n ew script. Abort on Error Select th is ch eck box to abort script execution wh en an error is en coun tered. Creat e Ti m i n g Fi l e Select th is ch eck box to create an d save a Player tim in g file for th is Player to th e default QALoad tim in g file directory (n orm ally \Program Files\Compuware\QALoad\TimingFiles). Run As Select if th is Player sh ould run scripts as th read- or process-based. QALoad Player menus Th e followin g m en us are available from th e QALoad Player: File m en u Edit m en u View m en u Option s m en u Help m en u 322 QALoad On lin e Help Player Configurat ion Use th is dialog box to set startup param eters for Pl ayer. Access th is dialog box from th e Opt i on s m en u by selectin g Pl ayer Con f i gurat i on . Run t i m e t ab Pl ayer Nam e: (Read on ly) Th is is th e n am e th at th e Player will report to th e QALoad Con ductor durin g a request. It m ay be an y strin g of alph an um eric ch aracters, provided th at th e len gth does n ot exceed 10 ch aracters an d th ere are n o em bedded spaces. Com pi l ed Scri pt s: Th is field poin ts to th e direct ory wh ich will h old th e com piled scri pts. W h en a test is started, Player looks for scripts in th is directory. Th e con figuration screen will verify th at th e direct ory exists. Com puware recom m en ds th at you use a directory on a n etworked drive to h old th e com piled scripts. Oth erwise you will n eed t o m an ually copy th e scri pt files to each Player system wh en ever a script ch an ges. Ti m i n g Fi l e: (Read on ly) Th is field poin ts to th e default directory wh ere th e t im in g files are located. Jav a t ab jvm .dl l di rect ory: (option al) Th is is th e directory wh ere th e JVM .DLL file is located. If specified, th is JVM .DLL will be used to run th e Java scri pts from a stan dalon e Player; oth erwise, th e en try specified in th e Java Option s page of th e W orkben ch Option s dialog box will be used. 323 Usin g th e Player, Script Developm en t W orkben ch , an d An alyze An al yze Overview of Analyze QALoad An alyze is th e QALoad com pon en t used t o create sum m ary statistics an d graph s from tim in g data collected durin g a load test. Set criteria for collectin g an d displayin g test dat a in An alyze before or after open in g a test’s tim in g file (.tim ). For exam ple, alter output option s, tim e ran ges, an d graph ics display option s. An alyze stores th e state of a tim in g file wh en it is closed so th at n ext tim e you open it, you see th e sam e reports an d graph s th at were presen t last tim e you viewed it. You also h ave th e ability to easily create tem plates, wh ich en able you to specify th e reports an d graph s th at are autom atically gen erat ed for an y n ew tim in g file you open . In addition , An alyze gen erates a workin g folder wh ere all files an d reports rel ated to th e tim in g file are stored. An alyze provides pre-defin ed reports as well as th e ability to create custom reports usin g XM L file (.xm l), XSL tran slation file (.xsl), an d HTM file (.h t m ) form ats. View th ese reports in An alyze or in a web browser. An alyze displ ays a tim in g file tab in th e W orkspace, with each tab con tain in g groups. Use An alyze’s in teractive view to sort test data, produce detailed ch eckpoin t data, produce a variety of graph s an d reports (with drag an d drop fun ct ion ality), export data to differen t form ats, an d em ai l test results an d pre-defin ed reports. Accessing Analyze Th e followin g procedures describe h ow to st art QALoad An alyze. To access An al yze f r om t h e QALoad Con d uct or : 1. In the QALoad Conductor, click Tools>Options. The Options dialog box appears. 2. Click the General tab. In the General Options area, select the Launch Analyze After Test check box. At th e en d of each test run , QALoad Con ductor autom atically laun ch es QALoad An alyze an d open s th e m ost recen t tim in g file. If you did n ot select th e Laun ch An alyze After Test ch eck box before th e test, follow th e steps below. 1. Click Tools>Analyze. 2. In QALoad Analyze, click File>Open. The Open Timing File dialog box appears. Select a timing file to work with by double-clicking the file name in the list of available timing files. To access An al yze f r om t h e W i n d ow s St ar t m en u: Click St art >Progr am Fi l es>Com puw are> QALoad >An al y ze. Underst anding Durat ions W h en you begin to an alyze your test results, it is im portan t to un derstan d h ow duration s are cal culated by QALoad. 324 QALoad On lin e Help Transact ion Durat ion Tran saction duration is th e tim e th at th e script bein g tested takes to com plete a tran saction , from th e BEGIN_TRANSACTION com m an d to th e END_TRANSACTION com m an d. Th ree factors com prise tran saction duration : ! The script processing time including, but not limited to, added script logic, QALoad processing of server replies, and other QALoad processing. ! Sleep time. ! The response time of the application under test including, but not limited to, the application server, database access, and network. Checkpoint Durat ion Ch eckpoin t duration is th e am oun t of tim e between begin an d en d ch eckpoi n t statem en ts. Th e followin g factors com prise ch eckpoi n t duration an d apply to both autom atic ch eckpoi n ts an d user-defin ed ch eckpoin ts. If you select th e Con duct or's En abl e t i m i n g of aut om at i c m i ddl ew are ch eck poi n t s option or use th e BeginCheckpoint an d EndCheckpoint fun ction s in th e script, th e followin g factors com prise ch eckpoin t duration : ! The response time of the application under test, including, but not limited to, the application server, database access, and network. ! Sleep time, if the Conductor's Include sleep time when calculating checkpoint timings option is selected int he Timing page of the Script Properties dialog box. For more information, see Setting Options for Timing Data ! QALoad processing time is not included within these checkpoints in order to provide a more accurate value of server, database, and network response times. Ch eckpoin t duration s do n ot always sum to th e sam e value as th e tran saction duration . For m ore in form ation , see com pari n g ch eckpoin t duration s t o tran saction duration . QALoad Analyze M enus and Toolbar But t ons Click a m en u or toolbar n am e in th e followin g list for a description . File Edit View Tem plate Tools W in dow Help An alyze Toolbar Button s Graph Toolbar Button s 325 Usin g th e Player, Script Developm en t W orkben ch , an d An alyze Accessing Test Dat a via Groups Th e QALoad An alyze W orkspace displays tim in g file data in groups. Each group displays differen t aspect s of th e data from a tim in g file. Th e data displayed an d th e groups available m ay vary, depen din g on th e type of data collected duri n g th e load test. Click a group n am e below to view th e type of dat a displayed in each group. Reports Top Processes Ch eckpoin ts RIP Files Coun ters Application Van tage Player Perform an ce Coun t ers Expert User 326 QALoad On lin e Help Accessing Test Dat a W h en you open a tim in g file, QALoad’s An alyze program sum m arizes th e ch eckpoin ts recorded in th e file durin g th e load test an d presen ts th e data in a report form at called th e Sum m ary report. You can access QALoad An alyze an d open a tim in g file con tain in g test results from each of th e QALoad com pon en ts. To access a p r evi ousl y-cr eat ed t i m i n g f i l e i n An al yze f r om t h e W i n d ow s St ar t m en u: 1. Click Start>Program Files>Compuware> QALoad >Analyze. 2. Click File>Open. The Open Timing File dialog box appears. Select a timing file to work with by double-clicking the file name in the list of available timing files. 3. Select the template to use for viewing the timing file. To access a p r evi ousl y cr eat ed t i m i n g f i l e i n t h e Scr i p t Devel op m en t W or k b en ch : 1. In the QALoad Script Development Workbench, click Tools>Analyze. 2. In QALoad Analyze, click File>Open. The Open Timing File dialog box appears. Select a timing file to work with by double-clicking the file name in the list of available timing files. 3. Select the template to use for viewing the timing file. Displaying Det ail Dat a Displaying Det ail Dat a Display detailed st atistics from a tim in g file such as ch eckpoin ts, coun ters, in th e QALoad An alyze Data win dow. View statistics for n ot on ly th e active tim in g file, but also for oth er tim in g files an d drag an d drop on to th e active tim in g file detail view. To d i sp l ay d et ai l ed st at i st i cs: 1. In the workspace, with the appropriate Timing File tab selected, click the group for which you want to view statistics. 2. Select the appropriate checkpoints or counters (depending on which group you choose). 3. From the Analyze toolbar, click the Detail button or right-click on a selected checkpoint or counter and choose Detail. Detail in form ation is presen ted in th e Data win dow in both a sum m ary an d data table. Th e in form ation displayed varies based on th e group selected. Not e: If the test aborts, complete data for all the checkpoints and counters may not display. Th e followin g detail views are available: Ch eckpoin ts Detail Data Coun ters Detail Dat a Player Perform an ce Coun t ers Detail Data RIP File Det ail Data 327 Usin g th e Player, Script Developm en t W orkben ch , an d An alyze Expert User Detail Data ServerVan tage Detail Data Det ail Views Th e detail view displays data from a tim in g file. You can view detail dat a by righ t-clickin g a script or group an d selectin g Detail. Th e data displayed an d th e groups available m ay vary, depen din g on th e type of data th at was collect ed durin g th e load test. Detail data i s displayed in two pan es: a sum m ary table an d a data table. You can view details for t h e followin g groups: Ch eckpoin ts Coun ters RIP File Player Perform an ce Coun t ers Expert Users ServerVan tage Detail Data Sort ing Test Dat a A Detail view poten tially con tain s a large n um ber of ch eckpoin ts, coun ters, an d so forth , especially if a load test h ad m an y virtual users. To m ake in form ation m an ageable, specify up to th ree levels of criteria to sort by, in ascen din g or descen din g order. For exam ple, if a test ran usin g five scripts on 100 virtual users, sort th e data by script n am e. Suppose each virtual user ran m ore th an on e tran saction usin g a particular scri pt, th en sort by both script n am e an d by virtual user. Or, to quickly locate an y tim in g bottlenecks, sort by respon se tim e. Use th e Sort Details dialog box to sort a detail view. To access th is dialog box, select Tool s>Sort from th e An al yze m en u or click Sort on th e An alyze toolbar. Graphing QALoad Timing Dat a Startin g in th e W orkspace of th e An alyze split win dow view, you can graph tim in g data in a n um ber of form ats an d styles. Ti p: A tim in g file can pot en tially con tain en ough data th at graph in g all of it at on e tim e results in an un readable graph . Before begin n in g, con sider th in n in g th e am oun t of data to be sh own on a sin gle graph . Details Sel ect t h e g r oup t o g r ap h : In th e W orkspace, with th e appropriate Tim in g File tab selected, cli ck th e group for wh ich to create a graph . 328 QALoad On lin e Help Not e: If the test aborts, complete data may not be available for all checkpoints and counters. Th e followin g groups are available, depen din g on th e tim in g file: Ch eckpoin ts Coun ters Server M on itorin g Player Perform an ce Coun t ers Expert User Not e: For each Group except Checkpoints and Expert User, the graph type is a line graph. For graphing multiple checkpoints or expert users, the graph type is either a line or bar graph. For graphing a single checkpoint only, in addition to line and bar graphs, you can also create Response Time Distribution and Cumulative Response Time Distribution graphs. Displaying ServerVant age Agent Dat a If you set option s to in tegrate ServerVan tage resource utilization data before run n in g a test, th at data is in cluded in th e resultin g tim in g file. It can be sorted an d displayed in QALoad An alyze in m uch th e sam e way as QALoad tim in g data. ServerVan tage dat a provides a sum m ary of all th e Agen ts th at ServerVan tage m on itored durin g th e load test an d details aggregat e statistics for Agen t data poin ts in cludin g m in im um , m axim um , an d m ean dat a values. W h en you open a tim in g file con tain in g ServerVan t age Agen t data, QALoad An alyze displ ays test dat a with QALoad tim in g data two ways: ! ! ServerVantage Agent workstations are listed in the Server Monitoring group in the Workspace tree-view, under the Resource Trends (ServerVantage) branch. From the Workspace, select Agent workstations to create detail or graphical views of the Agent data points. Specifically, you can: ! Display Agen t data poin t details. Graph Agen t data poin t details. Detailed data point information is displayed in the Data window. The ServerVantage detail view includes data such as the name of the machine where you ran the ServerVantage Agent; the Agent name; and the minimum, maximum, and mean data values for the Agent. Not e: ServerVantage resource utilization data is available only if you set the ServerVantage integration options on the QALoad Conductor’s Test Information window before executing a load test. Displaying Vant age Analyzer Agent Dat a and Report s If you set option s to in tegrate Van tage An alyzer perform an ce testin g data before run n in g a test, th at data is in cluded in th e resultin g tim in g file. It can be sorted an d displayed in QALoad An alyze in m uch th e sam e way as QALoad tim in g data. You can access Van t age An alyzer can n ed reports an d m etrics th at correl ate to a specified perform an ce testin g tim e period. Th e m etrics are displ ayed in th e Van tage An alyzer Perform an ce Con sole, wh ich is laun ch ed th rough QALoad An alyze an d th e Van tage An alyzer reports can be viewed in An alyze. Not e: Vantage Analyzer performance testing data is available only if you set the Vantage Analyzer integration options in the QALoad Conductor’s before executing a load test. Th ere are two types of dat a you can retrieve from Van tage An alyzer: tran sacti on data an d reports. 329 Usin g th e Player, Script Developm en t W orkben ch , an d An alyze To d i sp l ay Van t ag e An al yzer t r an sact i on d at a an d r ep or t s: Your in put on th e Retrieve Van tage An alyzer Dat a dialog box is saved an d di splays again wh en you re-open th e dialog box. 1. Start Analyze and open a timing file containing Vantage Analyzer agent data. 2. From the Tools menu select Vantage Analyzer. The Retrieve Vantage Analyzer Data dialog box displays. 3. In the COS server field, type the name of the machine where the Compuware Open Server resides. 4. In the Port field, type the port number where the COS server listens to incoming requests. The default port is 18080. 5. Click Connect. In the Connection table, Vantage Analyzer agents that are available through the COS display. 6. Select the check box next to the Vantage Analyzer agent you want to retrieve data from. You can now edit the Date/Time Range Selection field. The Active data source field displays the data source name associated with the agent name. 7. In the Date/Time Range Selection field select either Use QALoad Testing Time Range or Use Custom Data/Time Range to set your start and end times for Vantage Analyzer data falling within the time range specified. ! Use QALoad Test i n g Ti m e Ran ge: Select to use a slider to set your start an d en d tim es for Van tage An alyzer dat a fallin g with in th e tim e ran ge specified. a. Use the sliders below to set your start and end times: Select and drag the start or end arrow to change the Start time and End time for the duration of the test. b. Reset: Click to restore to the time range previously selected. ! Use Cust om Dat a/ Ti m e Ran ge: Select to specify exact start an d en d tim es. a. Start time: Click the drop-down arrows to display a calendar where you can navigate to specify a date when the transaction started. To change the time, highlight the text in the field and type a new time. b. End time: Click the drop-down arrows to display a calendar where you can navigate to specify a date when the transaction ended. To change the time, highlight the text in the field and type a new time. 8. Select the Transaction data check box to access Vantage Analyzer detailed metrics from the server displayed in the Active data source field. Additionally, selecting the Transaction data check box provides access to Vantage Analyzer data in QALoad Conductor through the Vantage Analyzer PConsole. 9. Select Report data to access the list of Vantage Analyzer reports from the reports listed on the right. Select the check box next to the report type you want to generate. 10. In th e Top N coun t field, type a n um ber or use th e arrows to select th e n um ber to specify th e top N (n um ber) coun t represen ted in th e report(s) sel ect ed. Top N ran ge is 3-15, with a default value of 10. 11. In th e St eps field, type a n um ber or use th e arrows to determ in e h ow m an y sets of th rough put an d respon se data are retrieved between start tim e an d en d tim e. Th e h igh er th e steps, th e m ore accurate th e graph is, but m ore tim e is used for retrievin g th e data an d gen eratin g th e report. Steps ran ge is 5-100, with a default value of 30. 12. Click OK. ! If you selected th e Tran saction data ch eck box, th e Van tage An alyzer Perform an ce Con sole open s. Refer to t h e on lin e docum en tation for Van tage An alyzer for m ore in form ation . ! If you selected th e Report data ch eck box, th e VA Reports dialog box appears an d displays th e data in graph form at. Tabs display each type of report you selected with th e n am e of th e report on th e tab. Not e: After you close a Vantage Analyzer report, you can re-open the report you just generated by selecting Tools>Load VA Report s. 330 QALoad On lin e Help Using Templat es Using Timing File Templates Tim in g file tem plates en able you to save curren t views of an open tim in g file. All open views, such as reports, graph s, an d th resh olds are stored in th e tem plate. W h en you reopen a tim in g file or open a n ew tim in g file an d apply a tem plate, it appears with th e set of views defin ed for t h e tem plate. Every tim e you close a ti m in g file in An alyze, a Last Viewed State tem plate for th e tim in g file is created. Th is file stores th e reports an d graph s th at are open , th eir position s an d sizes, an d an y th resh olds you defin ed. You can use an option in th e Open m en u or in th e Tool s>Opt i on s m en u to ch oose to reopen a tim in g file in th e sam e state its last viewed state. Use th e Tem pl at e m en u to: ! Save the current views of a timing file to create a template. ! Select an existing template and apply it to the open timing file. ! Remove the template from the current timing file or from disk. ! Create system-wide thresholds for counters and checkpoints. You can apply a tem plat e to an y tim in g file you open . If an y part of th e tem pl ate can n ot be applied to t h e tim in g file, for exam ple, if th e tem plate referen ces a script th at doesn 't exist in th e curren t file, a dialog box displays with th e n am e of th e report or graph th at doesn 't apply. Th e default n am e for th e tem plate is t h e Session ID portion of th e file n am e of th e open tim in g file. Not e: On ly on e tim in g file is saved to a tem plate. If m ore th an on e tim in g file is open , th e option to defin e a tem plat e is disabled. Creating a New Template Create a tem pl ate to save th e views of an open tim in g file. Th is saves reports an d graph s th at are open , as well an y th resh olds th at h ave been defin ed. W h en you open oth er tim in g files usin g th e tem plate, th e files display in th e views saved to th e tem plate. To cr eat e a n ew t em p l at e: 1. Click Tem pl at e>Save cur ren t vi ew s. Th e Speci f y Tem pl at e t o Save curren t vi ew s an d t h resh ol ds dialog box appears. Not e: This menu option is available only if a single timing file is open. 2. Select a folder in th e Save i n field. By default, all tem plates are stored in th e Tem pl at es fol der. Th e default tem plate n am e is th e Session ID portion of t h e tim in g file n am e. 3. Do on e of th e followin g: ! Click Creat e to accept th e Session ID as th e tem plat e n am e. W h en you use th is n am e for th e tem plate, all future tim in g files created by th is Con ductor session autom atically open with th e views speci fied in th e tem plate. ! Type a n am e for th e n ew t em plate in th e Fi l e n am e field, an d click Creat e. Not e: You can choose template options that globally set how timing files open using the options in the Analyze Options dialog box . 331 Usin g th e Player, Script Developm en t W orkben ch , an d An alyze Opening a Timing File in a Template W h en you open a tim in g file, you can select h ow it displays by open in g it in a tem plate. Specifyin g a tem plate open s th e report s, graph s, an d th resh olds defin ed in th e tem plate. To op en a t i m i n g f i l e i n a t em p l at e: 1. Click File>Open. The Open Timing File dialog box displays. 2. In the File name field, select the timing file to open. 3. Select one of the following: ! Open l ast vi ew ed st at e i f avai l abl e - (Default) Open s th e tim ing file in th e sam e views th at were displ ayed wh en you last closed it. Th is restores all reports an d graph s th at were open , th eir position s an d sizes, as well as an y defin ed th resh olds for graph s. If th ere is n o last viewed state or if you do n ot select th is option , th e file open s usin g th e option you select in th e Tem pl at e area below. ! In th e Tem pl at e area, click on e of th e followin g opt ion s: o Do NOT use a t em pl at e w h en open i n g t i m i n g f i l e - No tem plate is applied an d on ly th e Sum m ary report for t h e tim in g file displays. o Use t em pl at e associ at ed w i t h Sessi on I D f i l e n am e - (Default) Applies th e tem plate with th e sam e Session ID n am e as th e tim in g file. Use th is option to open all future tim in g files created by th i s Con ductor session with th e views specified in th e tem plate. If n o m atch is foun d, on ly th e Sum m ary report displays. o Use t h i s t em pl at e f or open i n g t h e t i m i n g f i l e - En ables th e Brow se (...) button . Select a saved tem plate t o apply to all tim in g files wh en they are open ed. Not e: By default, both the Open in last view ed st at e if available and Use t emplat e associat ed w it h t he Session ID file name are selected. This way if there is no last viewed state, the template associated with the Session ID file name is applied to the timing file. 4. Click Open. The timing file you selected appears in the views defined for the selected template. Applying a Template to an Open Timing File You can select an existin g tem plate an d apply it to all open tim in g files. Th is closes all reports an d graph s th at are open an d displays th e tim in g file in th e views defin ed in th e tem plat e. To ap p l y a t em p l at e t o an op en t i m i n g f i l e: 1. Click Tem pl at e>Use ex i st i n g. Th e Select Tem plate to Use for Open Tim in g Files dialog box appears. 2. Select a tem plate an d click Appl y. All open reports an d graph s are closed an d th ose specified in th e tem plate are open ed. Not e: If any part of the template cannot be applied to the timing file, for example, if the template references a script that does not exist in the current file, a dialog box appears with the name of the report or graph that cannot be displayed. Applying Templates Globally with the Options Dialog Box Use th e An alyze Option s dialog box to select tem pl ate option s th at globally set h ow tim in g files open . Usin g a tem plate saves th e reports, graph s, an d th resh olds defin ed in th e tem plate. 332 QALoad On lin e Help Not e: Use Templat e>Use Exist ing to apply a template to an individual open timing file. To sp eci f y a t em p l at e: 1. Click Tools>Options. 2. Click the Templates tab and select one of the following: ! ! Open l ast vi ew ed st at e i f avai l abl e - (Default) Open s th e tim ing file in th e sam e views th at were displ ayed wh en you last closed it. Th is restores all reports an d graph s th at were open , th eir position s an d sizes, as well as an y defin ed th resh olds for graph s. If th ere is n o last viewed state or if you do n ot select th is option , th e file open s usin g th e option selected in th e Tem pl at e area below. In th e Tem pl at e area, select on e of th e followin g: o Do NOT use a t em pl at e w h en open i n g t i m i n g f i l es - No tem plat e is applied. Th e Sum m ary report for th e ti m in g file displays. o Use t em pl at e associ at ed w i t h t h e Sessi on I D f i l e n am e - (Default) Applies th e tem plate with th e sam e Session ID n am e as th e tim in g file. Use th is option to open all future tim in g files created by th is Con ductor session with th e views specified in th e tem pl ate. If n o m atch is foun d, on ly th e Sum m ary report displays. o Use t h i s t em pl at e f or open i n g t i m i n g f i l es - En ables th e Browse (...) button . Select a saved tem plate to appl y to all tim in g files wh en th ey are open ed. Not e: By default, both Open in last viewed st at e if available and Use t emplat e associat ed w it h t he Session ID file name are selected. This way if there is no last viewed state, the template associated with the Session ID file name is applied to the timing file. Thresholds Using Thresholds Th resh olds are user-defin ed values th at sh ow th e expected warn in g an d critical lim its for a coun ter or ch eckpoin t. Th resh olds h elp iden tify problem areas in th e test, such as ch eckpoin ts or coun ters th at go above or below a specified n um ber. Th ey actively m on itor respon se tim es by i n dicatin g wh eth er data records are surpassin g user-defin ed expected warn in g an d critical levels. Th resh olds are saved in th e Tem plate file. Th e in form ation displays in graph s an d detail reports in th e detail data view. Graph s Th e selected data is displayed in a lin e graph form at in th e Data win dow. Graph s sh ow th resh olds as h orizon tal lin es with th e n um ber of failed poin ts. 333 Usin g th e Player, Script Developm en t W orkben ch , an d An alyze Det ai l Report s Detail reports displ ay th resh olds in a Sum m ary table an d a Data table. Th e Sum m ary table is a sum m ary of raw dat a collected from a load test. Th e defin ed th resh old lim its, th e percen tage of failures for th e th resh old, an d th e total vi olation s are displayed. In th e Data table, th e failed poin ts are sh own in red. 334 QALoad On lin e Help Creating Thresholds Defin e th resh olds to sh ow th e expected warn in g an d critical lim its for a coun ter or ch eckpoin t. To cr eat e Th r esh ol d s: 1. Select Template>Thresholds. The Thresholds dialog box appears. 2. Click the appropriate group in the Workspace. Data within each group is listed in a tree-view. 3. Highlight a counter or checkpoint and drag it to the Threshold dialog box. Not e: You can drag entire groups or individual items to the Threshold dialog box. 4. Click Edit to name the threshold and set the threshold limits and conditions. 5. Do one of the following: ! Click th e ch eck box in th e Act i ve colum n for th e th resh olds you wan t to use, th en click Appl y. ! Click Act i vat e Al l to use all of th e th resh olds, th en click Appl y. Editing Thresholds On ce you create th e th resh old, set th e th resh old properties usin g th e Edi t fun ction . To ed i t Th r esh ol d s: 1. In the Thresholds dialog box, do one of the following: ! Double-click th e th resh ol d you wan t to edit. ! High ligh t th e appropri ate th resh old an d click Edi t . Th e Th resh ol d Propert i es dialog box appears. 2. In the Threshold Label field, type a name for the threshold. This is optional. 3. In the Limit field, type the number for the threshold. This is used with the Condition you select to calculate violations. 4. In the Limit Condition section, choose how the threshold violations are calculated. You can select: 5. ! Greater th an th e th resh ol d lim it you defin ed (>) ! Equal to th e th resh old lim it you defin ed (=) ! Less th an th e th resh old lim it you defin ed (<) Click OK. The Threshold dialog box appears showing the limit and condition you specified. Viewing Thresholds Th resh old in form ation displays in graph s an d detai l reports in th e detail dat a view . Not e: The data displayed and the groups available may vary, depending on the type of data that is collected during the load test. To vi ew t h r esh ol d s i n g r ap h s: 1. In the Workspace, click the appropriate Timing File tab. Data is listed in a tree-view. 335 Usin g th e Player, Script Developm en t W orkben ch , an d An alyze 2. Click the group to view, and select the appropriate checkpoints or counters to display in the graph. Not e: You can select an entire group or individual data files. 3. Click View> Graph or right-click and choose Graph from the context menu. Th e selected data displays in a lin e graph form at in th e Data win dow. Graph s sh ow th resh olds as h orizon tal lin es with th e n um ber of failed poin ts. To vi ew t h r esh ol d s i n d et ai l r ep or t s: 1. In the Workspace, click the appropriate Timing File tab. Data is listed in a tree-view. 2. Click the group to view, and select the appropriate checkpoints or counters to display in the detail report. Not e: You can select an entire group or individual data files. 3. Click View> Detail or right-click and choose Detail from the context menu. Th e detail report for th e selected data displays. Detail reports displ ay th resh ol ds in a Sum m ary table an d a Data table. Th e Sum m ary table is a sum m ary of raw data collected from a load test. In th e Data table, th e failed poin ts are sh own in red. Creat ing a Chart or Graph Analyze Graph Types Th e followin g basic graph types are available in QALoad An alyze. Li n e Graph A lin e graph plots respon se tim es versus elapsed tim es for th e selected ch eckpoin ts. It provides a good represen t ation of h ow m uch fluctuation th ere is in respon se tim es over th e course of a test. Bar Graph A bar graph sh ows th e m edian , m ean , or percen tile respon se tim es for th e selected ch eckpoin ts. Tran sact i on Th rough put Graph Th is type of graph sh ows th e cum ulative n um ber of tran saction s th at occurred with in th e user-specified tim e ran ge over th e duration of th e test. Respon se Ti m e Di st ri but i on Graph Th is type of graph sh ows th e percen t age of ch eckpoin t tim ings th at fall with in a particular respon se tim e ran ge. A respon se tim e distribution graph sh ows if respon se tim es ten d to fall with in a ran ge or are widely dispersed. A respon se tim e distribution graph on ly sh ows results for a sin gle ch eckpoin t, alth ough it can com pare results from m ultiple tim in g files. Cum ul at i ve Respon se Ti m e Di st ri but i on Gr aph Th is type of graph sh ows th e percen t age of tran saction s for a sin gle ch eckpoin t th at h ave a respon se tim e equal to or less th an a specified value. Vi rt ual User Di st ri but i on Graph Th is type of graph sh ows th e value of ch eckpoin t tim in gs grouped by a user-specified ran ge of virtual users run n in g th e script at th at poin t in th e test. A virtual user distribution graph sh ows if tim in gs degraded 336 QALoad On lin e Help wh en th e n um ber of virtual users ram ped up durin g a load test. Th e virtual user distribution graph on ly sh ows results for a sin gle ch eckpoin t an d is on ly valid for tests wh ere th e n um ber of virtual users run n in g th e script ram ped up durin g th e load test. Adding Text or an Object t o a Graph To create explan at ory text or an object on a graph , use an y of th e text or object button s on th e Graph An n otate toolbar. To ad d a n ot e or ob j ect t o a g r ap h t em p l at e: 1. Display the Annotate toolbar. 2. Add text and/or an object to the graph. Storing a Note or Object in a Template You can add expl an atory text or objects to a graph to be utilized as part of a t em plate wh en th e tem pl ate is applied to future tim in g files. For text, use th e Tex t Box or th e Bal l oon w i t h Tex t button create an object, use th e Rect an gl e or Ci rcl e button . To . Not e: These are the only objects that can be stored in a template. To save t h e i n f or m at i on i n a t em p l at e: 1. Complete the steps above for adding a note or object. 2. Follow the instructions for Creating a New Template. The saved note or object is available when the template is applied to future timing files. Graphing QALoad Timing Dat a Startin g in th e W orkspace of th e An alyze split win dow view, you can graph tim in g data in a n um ber of form ats an d styles. Ti p: A tim in g file can pot en tially con tain en ough data th at graph in g all of it at on e tim e results in an un readable graph . Before begin n in g, con sider th in n in g th e am oun t of data to be sh own on a sin gle graph . Details Sel ect t h e g r oup t o g r ap h : In th e W orkspace, with th e appropriate Tim in g File tab selected, cli ck th e group for wh ich to create a graph . Not e: If the test aborts, complete data may not be available for all checkpoints and counters. Th e followin g groups are available, depen din g on th e tim in g file: Ch eckpoin ts Coun ters Server M on itorin g 337 Usin g th e Player, Script Developm en t W orkben ch , an d An alyze Player Perform an ce Coun t ers Expert User Not e: For each Group except Checkpoints and Expert User, the graph type is a line graph. For graphing multiple checkpoints or expert users, the graph type is either a line or bar graph. For graphing a single checkpoint only, in addition to line and bar graphs, you can also create Response Time Distribution and Cumulative Response Time Distribution graphs. Thinning Dat a Before Graphing Test results m ay con tain m ore data th an can reason ably be graph ed. Th in n in g data before graph in g provi des a cl earer an d m ore m an ageable graph . To t h i n t i m i n g d at a i n Con d uct or : 1. With your test session ID file open, click the Script Assignment tab. 2. For each script for which you would like to thin your test data, click the button in the Timing Options column. 3. On the Timing Options dialog box, click the Enable Timing Data Thinning check box. 4. In the Thin Every... field, type the number of transactions to average. The average is sent to the Conductor for inclusion in the timing file, rather than every value. 5. Click OK. 6. Save your changes to your test session ID file by choosing File>Save from the Conductor menu. For m ore details about th e Tim in g Option s dialog box, see Tim in g Option s. To set up d at a t h i n n i n g i n An al yze: 1. With a timing file open, click Tools>Options. 2. Click the Data Thinning tab. 3. Type the number of data points to plot on each graph and select the method by which to graph the data points. 4. Click OK. For a description of th e option s on th is dialog box, see Option s Dialog Box - Data Th in n in g Tab. Graphing Checkpoint s in Analyze A tim in g file can poten tially con tain en ough data t h at graph in g all of it at on e tim e results in an un readable graph . Before begin n in g, con sider th in nin g th e am oun t of data to be sh own on a sin gle graph . Details Not e: Use the Graphs view of the runtime Conductor to create real-time graphs of checkpoint response times during script execution. To g r ap h ch eck p oi n t s: 1. 338 Open the appropriate .tim file in QALoad Analyze. In the Workspace, click the Checkpoints group. Checkpoint data is listed in a tree-view. QALoad On lin e Help 2. Select the checkpoints to graph. 3. From the View menu, choose Graph. The Graph Type dialog box appears. 4. In the Graph Type drop-down list, select from the following: ! Lin e (respon se tim es versus elapsed tim es for th e sel ected data.) ! Bar (m edian , m ean , or a percen tile respon se tim e of th e selected ch eckpoin ts.) Not e: The BAR graph displays only one data point for each selected counter. The data point represents the mean, median, or percentile response time. When you select a LINE graph after a BAR graph through the BAR graph’s context menu, the LINE graph displays the data of the BAR graph, not the data from the tree control on the left pane. Since there is only one data point per selected counter, the line graph does not display a line. This display is different from the LINE graph that you request from the tree control, which displays all the data points for each selected counter. The following graph types are only available when graphing a single checkpoint: ! Respon se Tim e Distribution (Th e distribution of respon se tim es of a sin gle ch eckpoin t.) ! Cum ulative Respon se Tim e Distribution (Th e percen tage of ch eckpoin t tim in gs th at were equal to or less th an a specified value.) ! Virtual User Distribution (Th e distribution of ch eckpoin t tim in gs based on th e n um ber of virtual users run n in g th e script at th at poin t in th e test.) Data for th e selected ch eckpoin t(s) is graph ed in th e Data win dow in th e form at selected in step 4. Graphing Count ers Not e: A timing file can potentially contain enough data that graphing all of it at one time results in an unreadable graph. Before beginning, consider thinning the amount of data to be shown on a single graph. Details To g r ap h coun t er s: 1. Open the appropriate .tim file in QALoad Analyze. In the Workspace, click the Counters group. Counter data is listed in a tree-view. 2. Select the counter(s) to graph. 3. From the View menu, choose Graph. Data for the selected counter(s) is graphed in a line graph format in the Data window. Graphing Player Performance Count ers Not e: A timing file can potentially contain enough data that graphing all of it at one time results in an unreadable graph. Before beginning, consider thinning the amount of data to be shown on a single graph. Details To g r ap h Pl ayer p er f or m an ce coun t er s: 1. Open the appropriate .tim file in QALoad Analyze. Select the Player Performance Counters group. 2. In the Workspace, select the performance counter(s) to graph. 3. Click the View Graph button or right-click and choose Graph from the context menu. Data for the selected Agent(s) is graphed in a line graph format in the Data window. 339 Usin g th e Player, Script Developm en t W orkben ch , an d An alyze Graphing Server M onit oring Dat a M on itorin g servers is a m eth od of load testin g. QALoad provi des perform an ce coun ter dat a th rough th ree server m on itorin g m eth ods: ! Remote Monitoring - Performs the monitoring of performance counters from a machine under test without the use of agent software on the machine. ! ServerVantage - An Availability Management application complementary to QALoad for service level monitoring of performance counters for applications, servers, and databases during production. ServerVantage also provides notification, event management, and reporting features. Graphing Expert User Dat a Not e: A timing file can potentially contain enough data that graphing all of it at one time results in an unreadable graph. Before beginning, consider thinning the amount of data to be shown on a single graph. Details To g r ap h ex p er t user d at a: 1. Open the appropriate .tim file in QALoad Analyze. 2. Select the Expert User group in the Workspace tree-view. 3. In the Workspace, select the data point(s) to graph. 4. Click the View Graph button or right-click and choose Graph from the context menu. Data for the selected Agent(s) is graphed in a line graph format in the Data window. Creat ing a Scat t er Chart To cr eat e a scat t er ch ar t : 1. Click the View Graph button ( ) or choose Graph from the View menu. The Graph Type dialog box appears. 2. Select the Line graph type. 3. Click OK. Data for the selected checkpoints is presented in a line graph format in QALoad Analyze’s data window. 4. Right-click anywhere in the graph, and select Gallery from the menu. The gallery of graph types displays. 5. Click the Scatter 6. Right-click anywhere in the graph. 7. Select Properties from the menu. The Chart FX Properties dialog box displays. 8. Click the Series tab. 9. In the Show every: field, click the up or down arrow to increase or decrease the number of data points displayed, for example, show every 5th point. type graph. 10. In the Size: field, click the up or down arrow to increase or decrease the size of the scatter points. 11. Click Apply. 12. In the Shape: field, click the arrow and select the shape for the scatter points. 13. Click Apply, then click OK. 340 QALoad On lin e Help Vant age Analyzer Drill Down M enu It ems If Van tage An alyzer param eters such as agen ts, report type, top N, an d steps are set, th e followin g m en u item s are available from th e righ t-click m en u in any graph view. Set St art Ti m e: Ch oose this option to set th e start tim e. A lin e is drawn in th e m ouse click poin t of th e graph . Set En d Ti m e: Ch oose th is option to set th e en d tim e. A lin e is drawn in th e m ouse click poin t of th e graph . Laun ch Report s: Ch oose to gen erate th e Van tage An alyzer report or detailed tran saction dat a with in th e selected tim e ran ge. Cl ear Sel ect i on : Ch oose th is option to clear th e start an d en d lin es from th e graph . Viewing Report s Viewing Report s View reports gen erated by QALoad An alyze on a m ach in e with QALoad in stalled or on an y m ach in e wit h a W eb browser. In order to save th e con ten ts of a tim in g file's workin g folder, wh en viewin g reports, clear th e Rem ove XM L W orkin g Folder option . To properly set th is option , see th e W orkspace tab on th e Option s dialog box. For m ore in form ation , see Opti on s Dialog Box - W orkspace Tab. Viewing reports on a machine with QALoad Analyze To view reports in QALoad An alyze, click th e Sum m ary report button or an y of th e pre-defin ed report button s in th e QALoad Analyze W orkspace. See Load Test Sum m ary for a qui ck in troduction to viewin g reports. Viewing reports on a machine without QALoad Analyze To view reports in a W eb browser, copy th e en tire workin g folder for th e tim in g file on to th e m ach in e. Th e followin g files are required (wh ere <Summary> represen ts th e n am e of th e report): ! <Summary>.htm ! <Summary>.xml ! <Summary>.xsl In addition , th e M icrosoft XM L version 4.0 parser (provi ded with QALoad ) is required to view QALoad reports. View an y of th e pre-defin ed reports by clickin g th e <Summary>.h tm file to laun ch a report with th e assistan ce of th e associated XM L an d XSL support fi les. Other ways to view test data View n ot on ly pre-defin ed reports, but also tim in g file detail views an d graph s by exportin g or sen din g em ail m essages with test data to an oth er m ach in e. Click th e followin g lin ks for m ore in form ation : ! Exporting Test Data ! Sending Email Messages with Test Data 341 Usin g th e Player, Script Developm en t W orkben ch , an d An alyze Aut omat ed Report ing After you com plete a series of perform an ce tests, you can prepare h igh -level an d detailed reports in QALoad An alyze. You can create a base report fram ework, wh ich for exam ple, can assist you in determ in in g wh eth er your tested application s are ready for production . You can in clude key section s in th e report wh ich can be populated with text an d graph ics you determ in e. Th is report can be custom ized furth er after in itial creation to m ore accuratel y reflect th e results of your testin g. Th e gen erated report is a M icrosoft W ord docum en t, created from a series of XM L docum en ts wh ich in clude th e tim in g file data. Your m ach in e m ust h ave a valid versi on of M icrosoft W ord residin g on it for th is feature to work. To vi ew t h e g en er at ed r ep or t : 1. Open a timing file in Analyze. 2. From the Tools menu, choose Generate Report and select a timing file. Microsoft Word opens and a generated report appears, ready for editing. Pre-Defined Report s QALoad An alyze provides pre-defin ed reports for viewin g load test results with out tim e-con sum in g data m an ipul ation . In th e W orkspace, select t h e Report s group an d click th e appropri ate report. Th e reports are in HTM L gen erated by XSL files. View th em in QALoad An alyze, or directly in a W eb browser. Not e: Compuware provides each of the available pre-defined reports as convenience to view the results of a load test without any data manipulation. In addition, create customized versions of these reports by selecting the appropriate group and creating detail reports and graphs. Th e followin g reports are available. Click a report n am e for det ails. Sum m ary Session Con curren t Users Respon se Tim e An alysis Output Clien t Th rough put Tran saction Th rough put Top Ten Lon gest Ch eckpoin t Duration s W orst Perform in g Ch eckpoin ts an d Coun ters Player Perform an ce Application Van tage Expert User 342 QALoad On lin e Help Summary Report Th e Sum m ary report is th e prim ary output from each test run , on e of th e pre-defin ed reports QALoad An alyze m akes available. W h en you open a tim in g file, QALoad An alyze autom atically displ ays th e Load Test Sum m ary in th e Data win dow. It presen ts tim in g in form ation for each tran saction in th e tim in g file an d th e m in im um , m axim um , an d m edian respon se tim es for each ch eckpoin t. Th e output is divided i n to two section s. Th e first section presen ts th e Sum m ary Test In form ation , Test Tim e in form ation , an d Dat a Th in n in g and Tim e Ran ge in form ation . Th e secon d section presen ts th e Script In form ation for each script. It sh ows tim in g Sum m aries an d Ch eckpoin t in form ation for each scri pt. W ith th e Sum m ary Report open in An alyze, click a h eadin g in th e Test In form ation area to display det ailed in form ation on scripts, errors, an d m essages. W h en you en able data th in n in g, th e n um ber of errors an d m essages is th in n ed, accordin gly. Not e: There is a limit of 3000 errors processed for each script and 3000 messages processed for each group within a script. When you click # Errors or #Messages for detailed information, any script or group within the script that exceeds the limit does not display. A script or group can fall within the limit when data is thinned but exceed the limit when data is not thinned. This means that more scripts may appear in the Error section and more groups may appear within scripts in the Script Message section when data is thinned. Sample Summary Report For a brief description of each report section , scroll down an d click a section h eadin g in th e followin g sam ple. 343 Usin g th e Player, Script Developm en t W orkben ch , an d An alyze Session Report Provides sum m ary in form ation about th e test session . Th e in form ation in th is report was obtain ed from th e Con ductor’s con figuration settin gs wh en th e load test was started. To view a sum m ary of test settin gs th at in cludes ch an ges m ade wh ile th e test was run n in g, see th e Sum m ary report. 344 QALoad On lin e Help For 345 Usin g th e Player, Script Developm en t W orkben ch , an d An alyze description s of th e in form ation provided in each section , click th e section s in th e followin g im age. Concurrent Users Report Displays th e tot al n um ber of virtual users for th e test, con curren t users vs. elapsed tim e, as well as graph s for in dividual scri pts th at were part of th e test. Not e: A totals graph will not display if the test contains only one script. 346 QALoad On lin e Help Response Time Analysis Report Provides an in dicator of h ow well a scri pt ran . Th e report displays a graph of each script's tran saction duration (respon se tim e vs. elapsed tim e) as well as th e followin g ch eckpoin t sum m ary data: #Tran s: Num ber of data poin ts used to calculate th e statistics. #Recs: Num ber of dat a records. Th is value, if differen t from th e value of #Tran s, reflects th e n um ber of ch eckpoin t records th at are used for an al ysis after data th in n in g h as been applied. M i n : M in im um recorded respon se tim e. M ax : M axim um recorded respon se tim e. St d. Dev: Stan dard deviation of all respon se tim es. A large stan dard devi ation in dicates a wide vari an ce in respon se tim es. M edi an : M edi an respon se tim e, in secon ds. nt h %: n percen t of th e respon ses h ave a value less th an th e value sh own . Out put Report Provides a cum ulative list of all errors, sorted by scri pt an d occurren ce in tim e, th at occurred durin g th e course of a l oad test. Not e: Failed messages are included in the errors count that appears in the Test Information section of the report, but are detailed in the Script Messages section. 347 Usin g th e Player, Script Developm en t W orkben ch , an d An alyze Client Throughput Report Provides a graph of HTTP Repl y an alysis for key HTTP coun ters, HTTP coun ter vs. elapsed tim e. Transact ion Throughput Report Provides th e cum ulative n um ber of tran saction s over elapsed tim e for each script an d for th e total test. 348 QALoad On lin e Help Top Ten Longest Checkpoint Durat ions Report Provides graph s an d lists details about ch eckpoin ts th at h ad th e lon gest ch eckpoin t duration durin g th e test. Ch eckpoin ts with lon gest duration s are th ose th at con sum ed th e m ost am oun t of tim e durin g th e test. Th is report con tain s th e followin g section s: ! A summary section with overview information about the test. 349 Usin g th e Player, Script Developm en t W orkben ch , an d An alyze ! A bar graph of the ten longest checkpoint durations in the test, followed by details for each checkpoint in the graph. These checkpoints can originate in any script that was included in the test. ! Bar graphs for each script that show up to the ten longest checkpoint durations, followed by details for each checkpoint in the script. Th e report is gen erated by An alyze on ly if each script h as at least on e ch eckpoi n t oth er th an th e duration ch eckpoin t. Th e data provided in th e report can be used as a startin g poin t to iden tify perform an ce problem s. Not e: Transaction duration checkpoints are not included in the report. 350 QALoad On lin e Help 351 Usin g th e Player, Script Developm en t W orkben ch , an d An alyze Player Performance Report Displays tran saction durat ion s in a graph form at by player m ach in e. Th is report h elps iden tify in dividual player m ach in es th at h ave poor test results. In addi tion to th e bar graph th at plots th e average tran saction duration for each player m ach in e, th e report also in cludes sum m ary dat a for th e overall test, an d detai ls for each pl ayer m ach in e. Th is report is gen erated by An alyze on ly if two or m ore player m ach in es were used in th e test. Worst Performing Checkpoint s and Count ers Report Th is report provides graph s an d lists details about ch eckpoin ts an d coun ters t h at h ad th e worst perform an ce durin g th e test. Perform an ce is based on th e th resh olds you defi n e. Ch eckpoin ts with th e worst perform an ce are calcul ated usin g th e average respon se tim e for each ch eckpoin t. Coun ters with th e worst perform an ce are th ose th at con sum e th e m ost am oun t of tim e durin g th e test. Ch eckpoin ts with th e m ost errors an d coun ters with th e h igh est failure rates are listed first. Th e data provi ded is a startin g poin t for iden tifyin g perform an ce problem s. Not es: The report is generated by Analyze only if a threshold is defined and if the threshold is violated by the data. Thresholds that are not violated do not appear in the report. ! Failure numbers may differ between this report and the Summary report and detail reports. QALoad Analyze performs internal data thinning when creating the Worst Performing Checkpoints and Counters report, so that VU data points with the same elapsed time are combined and displayed as one record. ! 352 QALoad On lin e Help Since the Summary report and the detail report for checkpoints and counters display every data record in the timing file, these reports may show a larger number of failures. Th e bar graph s for each script sh ow up to ten of th e lon gest ch eckpoin t duration s an d are followed by details for each ch eckpoin t in th e graph . Th e ch eckpoin ts can origin ate in an y script th at was in cluded in th e test. Th e report con tai n s th e followin g section s: ! A summary section with overview information about the test. ! Bar graphs for checkpoints and bar graphs for counters showing the following: ! Sum m ary by percen t age of vi ol at i on s - Sh ows th e n um ber of poin ts th at exceeded th e th resh old divided by th e total n um ber of data poin t s. For exam ple, in th e report for coun ters below, th e total failure of 8 divided by th e total records of 60, yields a failure rate of 13.3 percen t. ! Sum m ary by severi t y - Sh ows th e percen t of tim e durin g th e test th at th e data is in violation of th e th resh old. Th is calculation uses a weigh ted average to determ in e th e percen tage. For exam ple, in th e report for coun ters below, wh en th e weigh ted average is used to calculate th e severity, th e failure rate is 7.6 percen t an d 6.5 percen t. Sin ce th e first m eth od m easures th e failure rate by percen tage of violation s, an d th e secon d m eth od m easures failures by th e am oun t of tim e th e data is in violation , th e n um bers can differ greatly bet ween th e two m eth ods. It is possible for a data set to h ave a 5 percen t failure rate wh en calculated by percen t age of failures, an d an 80 percen t failure rate wh en cal culated by severity. Th is can in dicate th at an error deviatin g sign ifican tly from th e n orm m ay be a m ore n otable failure th an a greater n um ber of failures. In th e exam ple below, th e coun ter sum m ary by percen t of violation s for Server An alysis sh ows a total of 8 failures out of 60 records, for a failure rate of 13.3 percen t. Th e percen tage of violation s for Rem ote M on itorin g h as a total of 3 failures in 41 records, for a failure rate of 4.2 percen t. W h en m easured by severi ty, h owever, th e failure rate for Rem ote M on itorin g is m ore serious th an for Server An alysis. Here, th e failure rate for Rem ote M on itorin g is 7.6 percen t com pared to th e rate 6.5 percen t for Server An al ysis. Not e: Transaction duration checkpoints are not included in the report. 353 Usin g th e Player, Script Developm en t W orkben ch , an d An alyze 354 QALoad On lin e Help Expert User Report Displays in form ation on th e scripts th at ran on each player m ach in e with th e Expert User option en abled. It provides a tim in g breakdown of th e in dividual com pon en ts, such as HTM L, im ages, an d objects, of th e web pages th at were requested durin g a test. Th e Expert User report sh ows h ow m uch tim e it took to down load a particular com pon en t of a web page from th e server. It also sh ows th e percen tage of n etwork an d server tim e for th e request. Th e Expert User report con tain s a sum m ary section an d a det ail section . Th e Sum m ary section at th e top of th e report displays overview in form ation about th e test for each QALoad Player in stan ce. Th e detail section displ ays th e m ain requests an d each subrequest m ade wh en th e script executes. M ain requests are m ade wh en Navigate_to(), Click_On (), Post_to(), DO_h ttp(), or DO_h ttps() are executed in a W W W script. Th e subrequests, or W eb com pon en ts, th at m ake up th e m ain page can in clude h tm l, css, js pages, an d so forth . Th e percen tage of server an d n etwork tim e displays in th e Average Server an d Average Network fields, with a graph ic represen tation in th e Server/ Network fiel d. Th is in form ation can h elp you determ in e wh eth er web pages with a h igh respon se tim e are h avin g server- or n etwork-rel ated perform an ce problem s. If an exception al am oun t of tim e is bein g spen t on th e server, you can m on itor th e server th at is un der test usin g a server m on itorin g tool such as ServerVan tage or QALoad's Rem ote M on itorin g option s. If too m uch tim e is bein g spen t on th e n etwork, you can m on itor th e n etwork un der test usin g a tool such as Application Van tage. 355 Usin g th e Player, Script Developm en t W orkben ch , an d An alyze Applicat ionVant age Report Displays in form ation on th e scripts th at ran on each player m ach in e. It con t ain s a sum m ary section with overview in form ation about th e test, an d a graph of th e tran saction respon se tim e of th e script in secon ds. Not e: If Expert User data was collected (WWW only), the Network and Server percentage data also is included. A detail section displ ays t h e begin n in g an d en din g tim e for th e trace files produced by th e scripts run n in g on th e Application Van tage player m ach in es. A separate section appears for each Application Van tage Pl ayer m ach in e th at ran durin g th e test period, . Vant age Analyzer Report In QALoad An alyze, Van tage An alyzer reports are displayed in a dialog box with tabbed win dows th at display each type of report you selected to gen erated on th e Retrieve Van tage An alyzer Data dial og box. 356 QALoad On lin e Help Van tage An alyzer reports display perform an ce data collected over a specified collection tim e peri od. Th e followin g reports are available. ! Top N Methods—A graph that shows the throughput and response time for each of the top N methods. ! Top N SQL—A graph and table that shows the throughput and response time for each of the top N SQL statements. ! Top N Servlets—A graph that shows the throughput and response time for each of the top N servlets. ! Top N JSPs—A graph that shows the throughput and response time for each of the top N JSPs. ! Top N Entity EJBs—A graph that shows the throughput and response time for each of the top N entity EJBs. ! Top N Session EJBs—A graph that shows the throughput and response time for each of the top N session EJBs. ! Top N Message Driven EJBs—A graph that shows the throughput and response time for each of the top N message-driven EJBs in a J2EE application. ! Top N .NET ASPs—A graph that shows the throughput and response time for each of the top N ASPs in a .NET application. ! Top N .NET Web Services—A graph that shows the throughput and response time for each of the top N Web services in a .NET application. ! Top N .NET Methods—A graph that shows the throughput and response time for each of the top N methods in a .NET application. ! Top N Stalled Thread—A graph that shows the throughput and response time for each of the top N stalled threads. Refer to th e on lin e docum en tation for Van tage An al yzer for m ore in form ation on Van tage An alyzer reports. Viewing Test Result s in a Web Browser An im portan t part of th e l oad testin g process is viewin g an d studyin g th e results of a test. You can view t h e results of a load test n ot on ly on a m ach in e wh ere QALoad is in stalled, but also on an y m ach in e with a W eb browser. QALoad An alyze provi des pre-defin ed reports as well as .xm l an d .xsl files wh ich can be custom ized to m eet desired specification s. W h en you open a tim in g file, QALoad An alyze gen erates a workin g folder con tain in g all supportin g files, reports, an d im ages gen erated from th at tim in g file. Th is folder is located in th e directory \Program Files\Compuware\QALoad\TimingFiles\xxx.xml.source wh ere <xxx> is th e n am e of th e tim in g file. Th e followin g files are foun d in th e workin g folder: Fi l e Nam e Descri pt i on <timingfile>.xml.source W orkin g folder gen erated in th e Reports folder wh en open in g a tim in g file. Th e workin g folder n am e is always th e <n am e of th e tim in g file> with a .xm l.source exten sion . <timingfile>.xml Origin al tim ing file with just en ough in form ation to creat e th e QALoad An alyze pre-defin ed reports. It is a represen tation of th e tim in g file, <tim ingfile>.tim . <timingfile>.complete.xml Origin al tim ing file con tain in g all data collected durin g a load test. It can be an extrem ely large file. Use th is file if creatin g a report usin g XSL th at required th is data. summary.htm Use th is HTM file to view th e Sum m ary report (or an y oth er available pre-defin ed report) in an y W eb browser. 357 Usin g th e Player, Script Developm en t W orkben ch , an d An alyze summary.xml Gen erated XM L file for th e Sum m ary report (or an y oth er available pre-defin ed report.) summary.xsl Gen erated XSL file for th e Sum m ary report (or an y oth er available pre-defin ed report.) Tran slates th e .xm l file specifyin g HTM L as its output an d gen erates th e HTM L report. Use th is file to custom ize th e reports by writin g in .xsl. default.htm Report wh ich provides a m ain screen to laun ch an y oth er predefin ed reports. Uses n av.h tm for th e n avigation fram e. W h en closin g a tim in g file, eith er keep all of th e reports gen erated from th e tim in g file in th e workin g folder, or delete th em . To set th is option , see th e W orkspace tab on th e Option s dialog box. To view load test results in a W eb browser, click: How to View Reports. Publishing or Sharing Test Result s Export ing Test Dat a Con vert test data in to th ree con ven ien t form ats for viewin g or exportin g: H TM L — Export data in a detail view or graph to HTM L files for con ven ien t viewin g in a default W eb browser or for sen din g as attach m en ts in an em ail m essage. See Exportin g Data to HTM L for in struction s. W ord Docum en t — Export data in a det ail view, graph , an d predefin ed secti on s to M icrosoft W ord for con ven ien t report docum en tation . See Exportin g to W ord for in struction s. RI P — An y tim e a user fai ls durin g load testin g, QALoad An alyze gen erates a RIP File con t ain in g user errors. If a tim in g file h as RIP file data, you can export th e RIP file to th e workin g folder an d view it in QALoad An alyze or th e QALoad Script Developm en t W orkben ch . See Exportin g RIP File Data for in struction s. Appl i cat i on Van t age (AV) t race f i l es - W h en a tim in g file h as Application Van tage data, you can export th e Application Van tage trace files to a workin g directory an d view th em with in Application Van tage. See Exportin g Application Van tage Trace Files for in struction s. Export ing Dat a t o HTM L To ex p or t d at a f r om a d et ai l vi ew t o HTM L: 358 1. Open one or several timing files. 2. From the File menu, choose Export Results Setup>To HTML. The Export Results Setup dialog box appears. 3. Select the reports, views, and timing files to include. 4. Choose File or Email Recipient from the Export To drop down list. 5. Optionally, select Zip to File and type a file name. 6. If exporting to file, type the path or click browse to browse to a location for the exported file and click Export. 7. If sending to an email recipient, Analyze creates a new Outlook email message that contains all of the pre-defined reports, .xml, .xsl, and files associated with the timing file. QALoad On lin e Help Export ing t o Word To ex p or t d at a f r om a d et ai l vi ew t o W or d 1. Open one or several timing files. 2. From the File menu, choose Export Results Setup>To Word. The Export Results Setup dialog box appears. 3. Select the reports, views, timing files, and predefined sections to include. 4. Type the path or click browse to browse to a location for the exported file and click Export. Export ing RIP File Dat a Not e: If a timing file does not contain any RIP data, then a RIP Files group will not exist in the Workspace. To ex p or t t h e RIP f i l e d at a t o t h e w or k i n g f ol d er : 1. Open a timing file. 2. In the Workspace, click the RIP Files group. 3. In the tree view, select the appropriate RIP files check box. 4. Right-click on the selected files and choose Export. The Browse For Folder dialog box appears. 5. Select the folder you wish to export the RIP file data to. The default is the working folder. 6. Click OK. Analyze exports the RIP file to the working folder. Export ing Applicat ionVant age Trace Files You can export Application Van tage trace files to a workin g folder or to Application Van tage. Not e: If a timing file does not contain any ApplicationVantage data, then the ApplicationVantage group does not exist in the Workspace. To ex p or t t h e Ap p l i cat i on Van t ag e d at a t o a w or k i n g f ol d er : 1. Open a timing file. 2. In the Workspace, click the ApplicationVantage group. 3. In the tree view, select the appropriate ApplicationVantage files check box. 4. Right-click on the selected files and choose Export to File. The Browse For Folder dialog box appears. 5. Select the folder you wish to export the ApplicationVantage file data to. The default is the working folder. 6. Click OK. Analyze exports the ApplicationVantage file to the working folder. To ex p or t t h e Ap p l i cat i on Van t ag e d at a t o Ap p l i cat i on Van t ag e: 1. Open a timing file. 2. In the Workspace, click the ApplicationVantage group. 359 Usin g th e Player, Script Developm en t W orkben ch , an d An alyze 3. In the tree view, select the appropriate ApplicationVantage files check boxes. 4. Do one of the following: ! Righ t-click on th e selected files an d ch oose Ex port t o Appl i cat i on Van t age. ! Double-click th e file to export. Th e trace files are loaded in to th e Application Van tage database an d th en open ed in Application Van tage. Export ing Vant age Analyzer Report s t o Word To ex p or t Van at ag e An al yzer r ep or t s t o W or d : 1. Open QALoad Analyze. 2. Generate a Vantage Analyzer report. 3. Choose Tools>Export Results>To Word. The Export Results Setup dialog box appears. 4. Check Vantage Analyzer Reports in the Reports tree. 5. Type the path or click browse to browse to a location for the exported file. 6. Click Export. Sending Email M essages wit h Test Dat a If you are usin g a M icrosoft m ail program , QALoad An alyze can sen d an em ai l m essage with a tim in g file or pre-defin ed report attach ed. Th e recipien t(s) of th e m essage will be able to open th e files in a W eb browser. To em ai l p r e-d ef i n ed r ep or t s: 1. Choose File>Export Results>To HTML or choose File>Export Results>To Word. 2. In the Export Results Setup dialog box, select reports, views, and timing files that you want to send. 3. In the Send To field, choose Email Recipient. 4. (optional) Click the Zip to file check box to send the files in the compressed .zip format. Type a name for the .zip file in the adjacent field. 5. Click Export. If sending HTML, Analyze creates a new Outlook email message that contains all of the pre-defined reports, .xml, .xsl, and files associated with the timing file as attachments, or a single .zip file that contains those files as an attachment. If sending Word, Analyze creates a zip file containing the Word document and places it in a new Outlook email message. Address the email, add message text, and send the message. Creat ing a Zip File of Rest Result s You can create a .zi p file of th e HTM L export to con ven ien tly package all test data in to on e file for sen din g to oth ers or storin g locall y. An alyze creates a file in .zip form at, wh ich you can eith er save to a location on your com puter or sen d as an attach m en t to an em ai l. 360 QALoad On lin e Help To cr eat e a .zi p f i l e: 1. Open one or several timing files. 2. Choose File>Export Results>To HTML. 3. In the Export Results Setup dialog box, select reports, views, and timing files that you want to include in the .zip file. 4. In the Export To field, choose Email Recipient to email the zip file or choose File to save the file on your computer. 5. Click the Zip to file check box to send the files in the compressed .zip format. Type a name for the .zip file in the adjacent field. 6. If you chose File in step 3, type the path of the location for the .zip file or click the browse button [...] to select a location. 7. Click Export. Depending on which option you chose in step 3, Analyze performs one of the following actions: ! If you ch ose Em ai l Reci pi en t , An alyze creates a n ew Outlook em ail m essage th at con tain s all of th e pre-defin ed reports, .xm l, .xsl, and files associated with th e tim in g file as a sin gle, com pressed .zip file attach m en t. ! If you ch ose Fi l e, An alyze creates a sin gle, com pressed .zip file in th e location you specified in step 5 th at con tain s all of th e pre-defin ed reports, .xm l, .xsl, an d files associated with th e tim ing file. 361 In d ex . An alyze ............................................................ 337 .cap file............................................. 125, 305, 331 Application Van tage ................................... 19, 373 .cpp................................................................... 305 Application Van tage trace files........................... 19 .log file ............................................................. 331 Application Van tage/ im port ............................... 19 .NET.................................................. 124, 125, 127 autom ated reportin g........................................ 358 .rfd .................................................................... 305 B .rip file browser cach in g ............................................... 249 Logfile Gen eration ........................................ 331 browser even ts ................................................. 199 .rip file.............................................................. 331 C .trc file .............................................................. 331 cach in g............................................................. 208 .VisHtm l ........................................................... 305 calculated variable ................................... 290, 292 .vistree.............................................................. 305 capture file .VisXm l ............................................................ 305 create ............................................................ 316 .zip file, creatin g in An alyze in sert com m an ds.......................................... 315 Creatin g a zip file of test results................... 379 capture file ....................................................... 315 .zip file, creatin g in An alyze ............................ 379 capture file ....................................................... 316 A cen tral dat apool ............................................... 326 about ................................................................ 199 certDB .............................................................. 135 about cach in g................................................... 208 certificate ................................................. 264, 265 about/ browser even ts....................................... 199 ch eckpoin ts about/ click on even t ........................................ 199 defin in g ........................................................ 320 about/ user even ts............................................. 199 duration ................................................ 338, 366 accessibility .......................................................... 4 graph in g ....................................................... 355 Action item reports................................................... 366, 369 Page sub-item ................................................ 283 verifyin g ....................................................... 332 ActiveData........................................................ 330 worst perform in g.......................................... 369 Addition al SubRequests ................................... 283 Ch in ese ch aracter support ............................... 8, 9 An alyze Citrix graph ..................................................... 342, 353 accessin g......................................................... 23 m en us ........................................................... 339 Citrix script sam ples....................................... 27 open in g......................................................... 338 clearin g even ts from th e i n tern al queue...... 109 sh ortcut keys..................................................... 4 dyn am ic win dows .................................... 30, 53 toolbars......................................................... 339 ICA files.......................................................... 26 363 Usin g th e Player, Script Developm en t W orkben ch , an d An alyze in sertin g screen sh ots in a script ..................... 25 con version option s m odifyin g script SAP................................................................ 150 m ouse action s ............................................. 93 W in sock ........................................................ 181 m ove con n ect an d discon n ect .................... 82 con vert .opx ....................................................... 19 recordin g................................................... 22, 24 cookies server farm ...................................................... 27 in Visual Navigator scri pts ................... 275, 282 troublesh ootin g ...................................... 22, 147 in sertin g in to a script ........................... 254, 306 un expected even ts.......................................... 68 set by server .................................................. 283 wait poin ts...................................................... 22 tran saction clean up ...................................... 273 web in terface .................................................. 23 cookies ............................................................. 246 win dows.................................................... 30, 53 copy ................................................................. 269 Citrix .................................................................. 21 coun ters CJK Support custom .......................................................... 319 Visual Navigator ........................................... 234 graph in g ....................................................... 355 CJK Support .......................................................... 9 worst perform in g.......................................... 369 clean up ............................................................. 273 CtxScreen Even tExists......................................... 68 Click On Button (subm it) ........................ 276, 283 CtxW aitForScreen Update .................................. 96 click on even t ................................................... 199 CtxW in dowEven tExists..................................... 68 Click On Lin k ........................................... 277, 283 custom script m essages.................................... 319 clien t certificate custom er support ................................................. 3 passwords...................................................... 278 cut .................................................................... 269 clien t certificate................................................ 278 D Clien t Th rough put report ................................ 365 datapoin ts Clien tVan tage packagin g a script ........................................... 19 com m an ds graph in g ....................................................... 354 th in n in g ....................................................... 354 datapool editin g........................................................... 318 addin g vari able............................................. 293 in sert in to capture file .................................. 315 cen tral ........................................................... 326 com m en t, Visual Navigat or script item ........... 273 creatin g................................................. 293, 325 con curren t editin g .......................................................... 293 users.............................................................. 363 im portin g ..................................................... 293 Users report ................................................... 363 local .............................................................. 327 Con ductor sh ortcut keys..................................................... 4 con figurin g m odifyin g..................................................... 326 n am in g ......................................................... 288 retrievin g ...................................................... 320 browser ......................................................... 200 substituting a strin g ............................. 286, 330 Con ten t Ch eck ................................................. 283 variables........................................ 288, 291, 295 364 In dex Visual Navigator ........................................... 288 debug log files.......................................................... 331 extract strin g.................................................... 295 F files Visual Scriptin g ............................................ 305 prin t .............................................................. 274 script ............................................................. 331 decrem en t variable, Visual Navigator script item ...................................................................... 274 defin ition s.......................................................... 10 detail data......................................................... 341 detail view ........................................................ 341 developin g scripts ................................................ 1 directory option s................................................ 19 duplicated fram eset page ................................. 282 duration ........................................................... 338 dyn am ic win dows, Citrix............................. 30, 53 E Fill In Form Page sub-item ............................................... 283 fram es....................................................... 248, 282 Fun ction W izard .............................................. 318 G gettin g started ...................................................... 1 glossary .............................................................. 10 graph addin g text or objects................................... 353 ch eckpoin ts .................................................. 355 coun ters........................................................ 355 Creatin g a Scatter Ch art ............................... 357 EasyScript ......................................................... 263 em ail ................................................................. 378 en codin g CJK ....................................................... 9 even ts clearin g ......................................................... 109 M odifyin g th e Citrix Script to Clear Even ts. 109 expert user report ............................................................ 372 expert user data graph in g ....................................................... 357 exportin g data Application Van tage...................................... 377 RIP files......................................................... 377 to h tm l .......................................................... 376 exportin g data.................................................. 376 exportin g reports.............................................. 378 exportin g to word .................................... 377, 378 exportin g Van atage An al yzer reports .............. 378 extract strin g Visual Navigator script item ......................... 284 datapoin ts..................................................... 354 expert user data ............................................ 357 Player Perform an ce Coun t ers....................... 356 Server M on itorin g Dat a................................ 356 th in n in g ....................................................... 354 tim in g data........................................... 342, 353 types ............................................................. 352 group ch eckpoin ts .................................................. 339 Clien tVan tage............................................... 339 coun ters........................................................ 339 player perform an ce coun t ers ....................... 339 rem ote m on itorin g....................................... 339 reports........................................................... 339 RIP files......................................................... 339 server an alysis............................................... 339 server m on itorin g......................................... 339 ServerVan tage............................................... 339 Top Processes................................................ 339 group ................................................................ 339 extract strin g .................................................... 291 365 Usin g th e Player, Script Developm en t W orkben ch , an d An alyze H M ain W in dow .................................................... 15 HTM L m en us page............................................................... 283 An alyze......................................................... 339 reports........................................................... 376 Player ............................................................ 336 static pages.................................................... 249 Script Developm en t W orkben ch .................... 17 HTTP h eaders in sertin g................................................ 255, 307 Visual Navigator ........................................... 266 m en us .............................................................. 125 I N ICA file ............................................................... 26 n ative ch aracter support .................................. 8, 9 in crem en t variable, Visual Navigator script item ...................................................................... 274 NavigateTo ............................................... 270, 283 in stallin g UNIX Players.................................... 333 O ODBC In tegrated W in dows Auth en tication ............... 276 in tegration m em ory error ................................................. 13 option s ServerVan tage ............................................... 343 W orkben ch in term itten t win dows........................................ 53 directory ...................................................... 19 IP address ......................................................... 233 file ............................................................... 19 IP spoof ............................................................ 253 J Japan ese ch aracter support .............................. 8, 9 recordin g................................................... 316 option s............................................................... 19 Oracle Form s Server Java................................................................... 128 application statem en ts................................. 136 Java applet ........................................................ 129 C++ scripts.................................................... 131 JavaDoc ............................................................ 128 certDB........................................................... 135 JavaScript .................................................. 128, 245 con n ection statem en ts................................. 135 K debuggin g..................................................... 139 Korean ch aracter support ................................. 8, 9 discon n ect statem en ts.................................. 139 L m eth od referen ce ......................................... 134 load test processin g.............................................. 1 OFS script sam ples........................................ 141 Load Test Sum m ary.......................................... 360 param eterizin g.............................................. 141 load-balan ced en viron m en t, Citrix ................... 21 recordin g ...................................................... 133 local datapool ................................................... 327 tran saction loop ........................................... 139 local variables........................................... 292, 296 log files............................................................. 331 logfile gen eration ............................................. 331 M M ach in e Assign m en ts, in Session report ......... 361 M ach in es in Use, in Session report .................. 361 366 verifyin g win dow creation ........................... 131 Output report ................................................... 364 P Page item s........................................................ 283 PageCh eck ........................................................ 283 param eterization In dex rules .............................................................. 272 R param eterization .............................................. 284 read datapool, Visual Navi gator script item .... 274 param eters........................................................ 337 recordin g password-protected direct ory........................... 243 Java ............................................................... 128 paste ................................................................. 269 m ultiple m iddleware sessi on s ........................ 21 Player Oracle Form s Server ...................................... 133 con figuration ................................................ 337 recordin g............................................................ 21 errors............................................................. 331 recordin g.......................................................... 316 log files.......................................................... 331 Recordin g m iddleware calls............................. 315 m en us ........................................................... 336 recordin g option s perform an ce ch an gin g....................................................... 316 coun ters..................................................... 356 SAP................................................................ 149 report ......................................................... 369 W in sock ........................................................ 180 scripts............................................................ 334 rem ovin g.......................................................... 330 sh ortcut keys..................................................... 4 rem ovin g used sh ared dat apool records.......... 330 tran sfer UNIX scri pts.................................... 333 rem ovin g/ sh ared dat apool records.................. 330 Player ................................................................ 333 ren am in g datapool variables ........................... 288 PostTo............................................................... 283 reports pre-defin ed reports Application Van tage...................................... 373 Application Van tage...................................... 373 autom ated .................................................... 358 Clien t Th rough put ....................................... 365 Clien t Th rough put ....................................... 365 Con curren t Users report ............................... 363 Con curren t Users report ............................... 363 Expert User ................................................... 372 Expert User ................................................... 372 Output .......................................................... 364 gen eratin g..................................................... 358 Player Perform an ce....................................... 369 Output .......................................................... 364 Respon se Tim e An alysis................................ 364 Player Perform an ce....................................... 369 Sum m ary....................................................... 360 pre-defin ed ................................................... 359 Top Ten Lon gest Ch eckpoin t Duration s...... 366 Respon se Tim e An alysis ............................... 364 Tran saction Th rough put .............................. 365 Session .......................................................... 361 W orst Perform in g Ch eckpoin ts an d Coun ters ................................................................... 369 Sum m ary ...................................................... 360 pre-defin ed reports........................................... 359 Q Top Ten Lon gest Ch eckpoin t Duration ....... 366 Tran saction Th rough put .............................. 365 Van tage An alyzer ......................................... 374 QALoad An alyze ......................................................... 337 viewin g ......................................................... 358 Player ............................................................ 333 W orst Perform in g Ch eckpoin ts an d Coun ters .................................................................. 369 Script Developm en t W orkben ch .................... 13 reports.............................................................. 359 367 Usin g th e Player, Script Developm en t W orkben ch , an d An alyze reset variable, Visual Navi gator script item ..... 274 Citrix ........................................................... 27 respon se tim e distribution OFS............................................................ 141 Respon se Tim e An alysis report ..................... 364 tran sfer ......................................................... 333 RIP File ............................................................. 377 validatin g.............................................. 324, 334 Rule Library ...................................................... 299 Visual Basic................................................... 248 Run n in g Scripts, in Session report ................... 361 Script Developm en t W orkben ch S accessin g......................................................... 18 SAP con figurin g..................................................... 19 con version option s....................................... 150 m en us............................................................. 17 recordin g an SAP session .............................. 149 sh ortcut keys .................................................... 4 recordin g option s ......................................... 149 toolbar button s............................................... 17 troublesh ootin g .............................. 22, 147, 148 Script Developm en t W orkben ch ....................... 13 SAP ................................................................... 147 Section 508 .......................................................... 4 SAP con trol log................................................. 151 server farm ......................................................... 27 scatter ch art ...................................................... 357 server m on itorin g script graph in g ....................................................... 356 addin g m essages for pl ayback ...................... 319 ServerVan tage .................................................. 343 ch eckpoin ts................................................... 332 Session report ................................................... 361 com pilin g...................................................... 324 sh ared datapool ....................................... 328, 330 con vertin g .................................................... 317 sh ared datapool/ in sertin g in script ................. 328 datapool ........................................................ 295 sh ared datapool/ in sertin g script ...................... 328 debuggin g ..................................................... 331 sh ared datapool/ usin g ..................................... 328 editin g tech n iques sh ortcut keys........................................................ 4 gen eral Citrix ........................................................ 27 gen eral ................................................... 320 OFS......................................................... 141 SAP......................................... 157, 158, 160 W in sock ................................. 177, 182, 183 gen eral ....................................................... 320 gen eral ....................................................... 320 editin g tech n iques........................................ 306 editin g tech n iques........................................ 318 Java ............................................................... 128 m odifyin g ....................................................... 93 packagin g........................................................ 20 sam ples 368 Siebel ................................................................ 305 Sleep as a com pon en t of ch eckpoin t duration ..... 283, 338 Visual Navigator item ................................... 283 Sleep ................................................................. 283 socket resources ............................................... 181 startup param eters ........................................... 337 stream in g m edia con figurin g QALoad ..................................... 201 Visual Navigator ................................... 234, 271 stream in g m edia .............................................. 198 SubRequests Addition al ..................................................... 283 In dex SubRequests...................................................... 283 th rough put Sum m ary report ............................................... 360 support log files.......................................................... 331 report ........................................................ 365 tran sm ittin g files to Tech n ical Support ............... 4 troublesh ootin g syn ch , Visual Navigator script item ................. 275 ODBC m em ory error ...................................... 13 T perform an ce issues with SAP or Citrix scripts22, 147 tech n ical support ............................................. 3, 4 SAP script validation fails............................. 148 tem plate W in sock run n in g out of socket resources.... 181 tim in g files............................................ 345, 347 term in ology........................................................ 10 troublesh ootin g ............................................... 148 U test data ....................................................... 340, 376 results displayin g dat a.......................................... 341 un expected even ts,Citrix ................................... 68 Un iversal session ................................................ 21 UNIX in stallin g Players .......................................... 333 em ailin g .................................................... 378 tran sferrin g scripts........................................ 333 sortin g ....................................................... 342 sum m ary ................................................... 360 th in n in g data ............................................ 354 viewin g...................................................... 375 sum m ary in form ation .................................. 361 TestPartn er ............................................... 312, 313 th in n in g test data ............................................ 354 th resh olds................................................. 348, 351 tim in g data graph in g ............................................... 342, 353 tim in g file open in g......................................................... 340 th in n in g........................................................ 354 toolbars An alyze ......................................................... 339 Script Developm en t W orkben ch .................... 17 traffic filters...................................................... 209 tran saction clean up ......................................................... 273 duration un derstan din g duration s .......................... 338 loop ....................................... 139, 254, 270, 320 user even ts ....................................................... 199 usin g sh ared datapools .................................... 328 V validatin g a scri pt ............................................ 312 validatin g scripts.................................................. 1 Van tage An alyzer display agen t data an d reports..................... 343 report ............................................................ 374 variable replacem en t wizard ............................ 297 variables addin g........................................................... 292 addin g to dat apool ....................................... 293 calculated creatin g ..................................................... 292 calculated ..................................................... 290 datapool ........................................................ 291 extract strin gs............................................... 291 local ...................................................... 292, 296 n am in g ......................................................... 288 types ............................................................. 288 Visual Navigator ................................... 286, 288 369 Usin g th e Player, Script Developm en t W orkben ch , an d An alyze Visual Basic scri pt ............................................. 248 win dow Visual Navigator in term itten t .................................................... 53 CJK ................................................................ 234 clien t certificate ............................................ 278 titles................................................................ 30 W in sock datapools ...................................................... 288 ch aracter represen tation ............................... 182 DBCS............................................................. 234 com m an ds.................................................... 181 debug prin t ................................................... 274 con version option s....................................... 181 files................................................................ 305 recordin g option s......................................... 180 Fin d an d Replace .......................................... 269 script ............................................................. 176 fram es ........................................................... 282 socket resources............................................ 181 HTM L Page ................................................... 283 variablization ................................................ 177 in sertin g script item s.................................... 306 wizard m en us ........................................................... 266 Fun ction W izard........................................... 318 recordin g a script .................................. 201, 304 Variable Replacem en t ................................... 297 stream in g m edia support ...................... 234, 271 Zip File.............................................................. 4 tran saction loop ........................................... 270 W ord ................................................................ 377 variables........................................................ 288 W ord/ export .................................................... 377 XM L ...................................................... 238, 310 W orkben ch ........................................................ 13 XM L support ................................. 236, 307, 308 WWW Visual Navigator ............................................... 265 in sertin g script item s m anually ................... 306 visual n avigator tree cut copy paste................. 269 stream in g m edia........................................... 198 visual n avigator tree/ copy................................ 269 XM L support ................................ 236, 307, 308 visual n avigator tree/ cut .................................. 269 X visual n avigator tree/ paste............................... 269 XM L visual scriptin g ................................................. 265 docum en t view ..................................... 238, 310 W form view ............................................. 239, 311 wait poin ts ................................................. 22, 109 requests................................................. 237, 309 W eb browser support ......................................... 236, 307, 308 con figure....................................................... 200 Z viewin g test results ....................................... 375 zip file, creatin g in An alyze ............................. 379 W in 32 script validatin g...................................................... 324 370 ZipFile W izard ...................................................... 4