5/31/04 LOADRUNNER CITRIX TIPS & TRICKS Contents COMMON PROBLEMS.................................................................................................. 2 Record ......................................................................................................................... 2 Replay ......................................................................................................................... 6 BITMAP SYNC INFORMATION ................................................................................ 14 CITRIX FUNCTIONS – ADDITIONAL INFORMATION ....................................... 14 COMMON PRACTICE ................................................................................................. 15 REQUIREMENTS FOR THE CITRIX MONITOR .................................................. 16 OTHER FEATURES ......................................................................................................... 16 FAQ............................................................................................................................... 19 1 5/31/04 Common Problems Record Q. R. b. c. When recording against a Citrix Nfuse website using Multi-Protocol, after clicking on the published application icon to create a connection to the Citrix server, an SSL Certificate Error appeared. To get past the errors please do the following: a. In the port-mapping tab, delete the current entry for port 443 and add the following 2 entries as shown: The port-mapping tab should look like the following after both entries are entered. Be sure to UNCHECK the entry for the Citrix server. Record a new script and the error should not occur again. 2 5/31/04 Q. S. Q. R. During recording, there is a window titled “ICA Seamless Host Agent” that pops up. When manually logging into the application there is no such popup. This popup is a result of the mode that VuGen is recording in. The Citrix solution requires that LoadRunner record in this mode. This is an informative window popup and not an error. To work around it, simply click on OK and it will go away. Internet Explorer disappears during a Multi protocol Nfuse recording as soon as the Citrix ICA client is launched. Check to see if the machine has been set up to record against multiple processes. Go to the registry editor to HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Windows\AppInit_DLLs and check to see if it’s pointing to bbhook.dll. If it is then remove the entry and then reboot the machine. Q. R. Internet Explorer disappears or crashes during a Multi protocol Nfuse recording as soon as the browser is launched. Check to see if the machine has any Anti-Virus software running. Try shutting down the Anti-Virus services. If you have McAfee Anti-Virus installed, shut down the following services: AVSyncManager McShield If you have Norton Anti-Virus installed, shut down the Norton Antivirus service from the services menu. Q. R. Q. The Citrix ICA client window is minimized after it is launched during recording. Clicking on the icon on the taskbar does not bring it up. Right click on the Citrix ICA Client icon on the taskbar and select maximize. This will bring the client back to the restored view. Adjust the window size as necessary. Do not minimize the Citrix ICA Client window during replay, as this will cause the same problem to occur again. The Recording Options in VuGen is NOT reflecting the changes being made in it. The user changes the information, clicks on OK, but when going back to the Recording Options the information is still not changed. 3 5/31/04 R. Click on the “Use Defaults” button to clear the information and then re-enter it again. Or, you can go to the <LoadRunner>\dat directory and look for citrix_ro.ini. This file contains information from the Recording Options. Make sure the changes are being reflected here. Q. Recording against a drop down menu does not work. During replay it fails on the ctrx_mouse_click when it is supposed to select an item from the drop down. Use arrow keys instead of mouse click to select an item from the drop down during recording. R. Q. When performing bitmap sync during recording, the following error pops up: R. Make sure that you are not connecting to another Citrix server within the first Citrix session. If this is true, then the hashing mechanism will not work and you will see an error. This is because an ICA session cannot create an OffScreen surface when embedded in another ICA session. It is this OffScreen mechanism that allows the Screen Capture/hashing functionality 4 5/31/04 Q. When recording a Citrix ICA script, only 3 events are recorded. Afterwards, mouse click movements are not being recorded. When logging off, the server gets the following error: R. This can happen when the OS that LoadRunner’s installed on is NT 4.0 SP6. Please connect to the Citrix server without VuGen first and then try recording in VuGen again. Q. Upon login, the user is getting a popup window indicating the user is using an older version of the Citrix client. 1. Log into the Citrix server as a user with administrative privileges. 2. Clicks on Start Programs Citrix MetaFrame XP ICA Client Update Configuration. 3. The ICA Client Update Configuration window should come up showing you a list of Citrix ICA clients installed on the server. 4. Right click on the Citrix ICA Win32 Client icon that the server is giving users popup messages for, and select Properties. 5. In the Description tab, uncheck the box that says, "Enabled" and then click on Apply. Please see screen shot below. R. 5 5/31/04 Q. During recording, user recorded bitmap sync. User then opened the <hash value>.bmp file in the <script directory>\data folder. The bitmap does not look the same as the one taken during recording. R. Sometimes when you use 256-colors setting, the recorded bitmaps in the script's data directory does not have the same color as you saw during recording. This should not matter as long as the bitmap hash value stays the same during replay. For further information, refer to the Bitmap Sync Information section. Replay Q. Replay of a Multiprotocol Citrix Nfuse script is failing on ctrx_nfuse_connect_server with the following error: vuser_init.c(x): Saving Parameter "Param1 = <head><title>Object moved</title></head>\n <body><h1>Object Moved</h1>This object may be found <a HREF="logout.asp?sessionExpired=On">here</a>.</body>\n \r\n <HTML>\r\n <HEAD>\r\n <SCRIPT Language="JavaScript" type="text/javascript">\r\n <!--\r\n top.location = 'login.asp?NFuse_loginErrorId=On';\r\n //-->\r\n </SCRIPT>\r\n </HEAD>\r\n </HTML>\r\n " vuser_init.c(x): t=xxms : Request done "http://xxx.xxx.xxx.xxx/logout.asp?sessionExpired=On" vuser_init.c(x): web_url was successful, xx body bytes, xx header bytes vuser_init.c(xx): Waiting for event ... vuser_init.c(xx): Error Connect can not be established - Last Error=70, Last client error=1030 R. Check that the nfuse_1.ica file is successfully created in the script directory during replay. The contents of the ICA file should look similar to the following (HINT: Open in Notepad or else it will try to connect to the server!): If the file contains something else then you can do the following: 1. Check that the cookie and header information is handled properly in all the web requests prior to the ctrx_nfuse_connect statement. It may be necessary to manually add some web_add_header or web_add_cookie statements. An easier approach is to record a single protocol web script up to the point where the published application is launched. Stop the recording, copy the web requests recorded and paste it above the ctrx_xxx functions in the Multi protocol script. You need to comment or delete the original web requests that are recorded above the ctrx_xxx functions. 2. Check to see if NFuse_UID is recorded inside the ctrx_nfuse_connect statement. If it is then you need to correlate it. Below is an example of the correlation: 6 5/31/04 web_reg_save_param("NFuse_UID", "LB=NFuse_UID=", "RB=&NFuse_App", LAST); web_url("Word", "URL=http://xxx.xxx.xxx.xxx/citrix/nfuse16/launch.asp?NFuse_Application =Word”, "Resource=0", "RecContentType=application/x-ica", "Referer=http://xxx.xxx.xxx.xxx/citrix/nfuse16/applist.asp?NFuse_currentFo lder=", "Mode=HTTP", LAST); ctrx_nfuse_connect("http://xxx.xxx.xxx.xxx/citrix/nfuse16/launch.asp\?NFuse_U ID=<NFuse_UID>&NFuse_Application=Word&NFuse_MIMEExtension=.i ca"); 1. If none of the solutions above apply, then be sure that you are NOT clicking inside the Citrix ICA Client window (shown below) while VuGen is executing the web_url requests (prior to the Citrix steps). This will cause the client to connect to the Citrix server, and by the time VuGen gets to the ctrx_nfuse_connect function it will throw an error. 4. During replay LoadRunner takes the first response from the server and saves the body into the file nfuse_(null).ica located inside the script directory. We then parse thru this file and connect to the server specified. If the first response from the server is a redirect, then it will fail during replay. As a workaround, you need to manually correlate the dynamic .ica file. Below is an example of how to do so. int fp; char * icafile; web_cleanup_cookies(); web_set_max_html_param_len("4096"); 7 5/31/04 web_reg_save_param("icadata", "LB=WFClient", “RB=", LAST); web_url("Default.asp", "URL=https://mercury.com/NFuse_Application=Notepad&NFuse_MIMEExtensi on=.ica")", "TargetFrame=", "Resource=0", "RecContentType=text/html", "Referer=", "Snapshot=t4.inf", "Mode=HTML", LAST); icafile = (char *)malloc(strlen(lr_eval_string("<icadata>")) + 100); sprintf(icafile,"[WFClient%s",lr_eval_string("<icadata>")); fp = fopen("C:\\temp\\icafile.ica", "w"); fprintf(fp, icafile); fclose(fp); ctrx_set_connect_opt(ICAFILE,"C:\\temp\\icafile.ica"); //ctrx_nfuse_connect(…); Q. R. Some of the Citrix Vusers are failing in the Controller/Tuning Console. Is there a way to show the Citrix client during replay? Use the –lr_citrix_vuser_view command line: For Controller, a. Go to the Design view, click on Details More. b. In the field where it says “Command line”, enter –lr_citrix_vuser_view. This will bring up a Citrix client on the load generator box for each running vuser. This is ONLY recommended for debugging purposes, as bringing up a client for each Vuser will consume additional resources on the load generator box. For Tuning Console, a. Right mouse click on the script, and select ‘Script Details…’ , b. Under the Parameters tab, enter lr_citrix_vuser_view as a parameter name, and 1 as the parameter value 8 5/31/04 Q. R. The ctrx_sync_on_bitmap function replays fine on the recording machine but fails during replay on another machine. If you intend to replay the script on another machine, make sure that the following items are consistent between the record and replay machines: Window Size (resolution), Window Colors, System Font and the other Default Options settings on the desktop. These setting affect the hash value of bitmaps and inconsistencies may cause replay to fail. For more information, refer to Bitmap Sync Information section. Q. How to increase the number of Citrix Vusers that can be executed on each Load Generator machine. R. Machines running Citrix Vusers may be limited in the number of Vusers that can run, due to the graphic (GDI) resources available on that machine. To increase the number of Vusers, open multiple Terminal Server sessions to the load generator machine and relate each terminal server session to the load generator. This means a Terminal Server must be running on the load generator. Windows 2000 Server and Advanced Server both come with Terminal Server. If you are not using one of these OS then please contact Microsoft on how to purchase Terminal Server separately. Please follow the instructions below: NOTE: Any ctrx_sync_on_bitmap that is recorded using a non-256 color setting will fail on replay on a terminal session. For further information, refer to Bitmap Sync Information section. 1. Set the ‘CitrixIsActive’ option: a. For LoadRunner7.8 or above: 9 5/31/04 On each load generator box, go to Start Programs LoadRunner Advanced Setting Agent Configuration, and enable the checkbox for ‘Enable Terminal Services’ b. For LoadRunner7.6 or below: On each load generator box, go to Start Programs LoadRunner Advanced Setting Agent Settings, the br_lnch_server.cfg file will come up. Search for the [Citrix] section, and set CitrixIsActive=1. 2. From any computer that has the Terminal Services Client installed, create at least two connections to the load generator. If the load generator has Terminal Services Client installed, then create a connection to itself. Then, startup the LoadRunner Agent Process in each Terminal Server Session. 3. From the Controller/Tuning Console, define your load generators using the following convention: <machine_name or IP>:1 <machine_name or IP>:2 <machine_name or IP>:3 10 5/31/04 You need to define one load generator in the Controller/Tuning Console for each terminal server session that you have created. The above example is for 3 terminal server connections to the load generator. NOTE: Unfortunately, there is no sure way to tell how many Citrix Vusers each terminal session can support. The recommended number of Citrix Vusers to run per session is 40. You may need to experiment with ramping up Vusers on each load generator until the graphic resource is exhausted (i.e. by looking at the terminal session you just created, the screen refresh is not optimal). Another way to check if GDI resource is being exhausted is by looking at the Task Manager. Launch the Task Manager and go to View Select Columns Check GDI Objects. 11 5/31/04 Note: There is a third party utility, TaskInfo 2003 that allows you to monitor the GDI resources. For more information, please refer to TaskInfo 2003 Home Page. 4. Test and make sure you can connect and run 1 Vuser on each load generator before running the full load test. NOTE: If your script contains ctrx_sync_on_bitmap functions that were recorded on a desktop that has a non-256 colors setting (such as 16-bit or 32-bit), the function will fail on replay through the terminal session. For further information, refer to the Bitmap Sync Information section. Below is a schematic diagram of the overall architecture of a Citrix load test. Q. R. ctrx_sync_on_bitmap function failed during replay. Check that the bitmap taken during recording is not dynamic. If it is, then change the function from ctrx_sync_on_bitmap to ctrx_sync_on_bitmap_change. Follow the example and syntax given in the function reference. If the bitmap is NOT dynamic but the ctrx_sync_on_bitmap is still failing on replay, then please do the following: 1. Go to the script’s data directory. There should be a bitmap file with the name of the recorded hash value. For example, ea58db927f9135863b6deccf9e38c81d.bmp 2. The execution log from the replay should indicate the new hash value obtained on the ctrx_sync_on_bitmap if you enabled extended log with “Advanced Trace” checked. EXAMPLE: vuser_init.c(15): Wait for bitmap=ea58db927f9135863b6deccf9e38c81d the current bitmap is 7e7fec50972aba43a19dda56d19c6b4a vuser_init.c(15): Waiting for event ... vuser_init.c(15): Exit on timeout.. 12 5/31/04 3. Look for a bitmap file with the name of this new hash value inside the script folder. For the example above, look for 7e7fec50972aba43a19dda56d19c6b4a.bmp inside the script folder. 4. Compare the recorded bitmap with the new bitmap obtained during replay. There should be a difference, and that is why the ctrx_sync_on_bitmap is failing. Q. R. How to replay Citrix script against a different window size? Go to the script directory in Windows Explorer. Open the default.cfg file located inside the script directory and change the window= value under the [CITRIX] section to a valid value that can be seen in the recording options (640 x 480, 800 x 600, 1024 x 768, and in LR 7.8 FP1 or higher there are additional option for 1280 x 1024 and 1600 x 1200). Please note that if you have any ctrx_sync_on_bitmap functions recorded it will not replay in the new window setting because the hash value will be different. Q. The Citrix ICA client window is minimized during replay. Clicking on the icon on the taskbar does not bring it up. Right click on the Citrix ICA Client icon on the taskbar and select maximize. This will bring the client back to the restored view. Adjust the window size as necessary. Do not minimize the Citrix ICA Client window during replay, as this will cause the same problem to occur again. R. Q. User is able to run one Citrix Vuser from the Controller/Tuning Console without a problem. However, running 2 or more Citrix Vusers gives an error with a “Terminal Services Warning” for Vusers 2-x. R. Check and see if you can manually connect 2 users from the Citrix client to the Citrix server. When booted into Administration mode, only 2 users can connect to the box at the same time. When booted into Application mode, the limit is dependent on the Terminal Server license that you have. Q. User recorded clicking on the OK button inside the “ICA Seamless Host Agent” window. During replay, this window may not come up and causes the replay to fail. How to handle this in the script? 13 5/31/04 R. Put in a condition statement and use the ctrx_win_exist function to check for the window. EXAMPLE: if (ctrx_win_exist("ICA Seamless Host Agent", 9) = = 0) { ctrx_mouse_click(206, 195, LEFT_BUTTON, 0, NULL); } Q. Sometimes, VuGen records an index after the window name. For example, sometimes it records “EMPOWER By Eastern Software Corporation_2”, while other times it just records “EMPOWER By Eastern Software Corporation”. Because of this, replay fails if the window name does not match exactly. Sometimes during recording the server is sending LoadRunner 2 windows with the same name, and therefore LoadRunner will put an index after it. The workaround is to put some logic in the script to handle it. Below is an example. R. if (!ctrx_win_exist("EMPOWER By Eastern Software Corporation_2"); ctrx_mouse_click(15, 32, LEFT_BUTTON, 0, "EMPOWER By Eastern Software Corporation"); else ctrx_mouse_click(15, 32, LEFT_BUTTON, 0, "EMPOWER By Eastern Software Corporation_2"); Bitmap Sync Information The color settings of the desktop where VuGen is installed, affects the Color settings (256 colors, 16-bit, 24-bit, or 32-bit) recorded for bitmap sync. The colors setting in the Citrix Client or Server does not matter. Citrix functions – additional information 1. ctrx_mouse_click() If there is a window name listed for the last argument then the x/y coordinates (first and second arguments) are relative to this window. 2. ctrx_sync_on_bitmap() The encrypted code depends on the position/size/resolution/colors and the contents of the bitmap. The value is supposed to be constant as long as you do not change any of the mentioned factors. 3. ctrx_set_window() Sometimes, LoadRunner will record ctrx_set_window() (e.g. ctrx_set_window("0_37_348_265"); ) for opening of menu list, e.g. File -> Exit where the menu list box is interpreted as a window. This happens because 14 5/31/04 LoadRunner always make sure that the menu is already open and ready before selecting an item. The name in this case depends on the menu position. 4. ctrx_key() A list of usable keys: SHIFT_KEY CTRL_KEY ALT_KEY BACKSPACE_KEY TAB_KEY ENTER_KEY PAUSE_KE ESC_KEY CAPS_LOCK_KEY PAGE_UP_KEY PAGE_DOWN_KEY END_KEY HOME_KEY LEFT_ARROW_KEY UP_ARROW_KEY RIGHT_ARROW_KEY DOWN_ARROW_KEY NUM_LOCK_KEY PRINT_SCREEN_KEY INSERT_KEY DELETE_KEY SCROLL_LOCK_KEY F1_KEY F2_KEY F3_KEY F4_KEY F5_KEY F6_KEY F7_KEY F8_KEY F9_KEY F10_KEY F11_KEY F12_KEY MULTIPLY_KEY ADD_KEY SUBTRACT_KEY DIVIDE_KEY Common Practice 1. Reset the connection if a user disconnects from the Citrix session without logging off. If the server is not configured this way, then there will be a lot of remaining idle sessions on the server during load test. Below are instructions on how to configure the server to reset the session (this is taken from the latest Citrix document): a. Open the "Citrix Connection Configuration" dialog box by going to Start Programs Citrix MetaFrame XP Citrix Connection Configuration. b. Double-click on the “ica-tcp” connection name. The “Edit Connection” dialog box appears. c. Click on the “Advanced” button. The “Advanced Connection Settings” dialog box appears. 15 5/31/04 d. Uncheck the “inherit user config” checkbox and change the list box entry for “On a broken or timed-out connection” to “reset”. 2. See the “Tips for Working with Citrix Vuser Scripts” section in the Citrix documentation for recording, replay, and debugging tips. 3. Replay your script with ‘Replay think time as recorded’. This will help to ensure that the script replay will wait for x amount of time for the windows to come up before executing the next step. Requirements for the Citrix Monitor 1. The Citrix monitor will use the same username/password as the Controller/Tuning Console box to login to the Citrix server. Therefore, make sure you have the same set of username/password on the Citrix box with administrative privileges on both machines. 2. When monitoring a counter under the ICA Session object, please be sure that at least one session is currently connected to the server. Otherwise, you will not be able to add any counters. 3. If you are unable to monitor the ICA Session object, try mapping a drive from the Controller/Tuning Console to the Citrix box through Windows explorer first. Other Features 1. New Recording Dialog – there is no longer a need to browse to rundlg.exe in the “Program to Record” field. VuGen will automatically do that in the background from now on. 2. Recording Options – a new login dialog will replace the old dialog. You are now able to see a list of Published Applications available on the Citrix server. 16 5/31/04 3. Support for high client resolutions - 1280x1024 & 1600 x 1200. 4. Snapshot View - Displays a snapshot of the client area in tree view mode. The snapshot will be available for the following functions: Ctrx_sync_on_window. Ctrx_sync_on_bitmap. Ctrx_mouse_click. The window/bitmap/mouse location will be highlighted in the snapshot. 5. The ability to add a bitmap sync point (ctrx_sync_on_bitmap) offline, after the end of the recording. Simply right click on the snapshot (in tree view mode) and insert the function, then highlight the area desired. 6. Snapshot On Error – VuGen – Special view will display the snapshot of the Citrix client when an error occurs. This view will be available from the VuGen UI. Controller – a camera icon will be shown inside the output window in the event of an error. Double click on it and it will display the snapshot (the same way as it currently exists for web Vusers). 7. Citrix Agent: 17 5/31/04 Installing Mercury’s Citrix agent (can be downloaded by going to Start Programs LoadRunner UpdateService) on the Citrix server will enjoy the new object sensitive support. These objects will be identified by their location. The following new functions are supported if the Citrix agent is installed on the server: a. Recording of ctrx_obj_mouse_click instead of ctrx_mouse_click. This function will include a description of the object that the user is clicking on. The description will include object text and its class. Example: ctrx_obj_mouse_click("<text=OK class=Button>", 194, 163, LEFT_BUTTON, ... b. Recording and replay of ctrx_get_text in order to retrieve text at a certain location inside the Citrix client. To perform a text check during recording, simply click on the icon highlighted below on the recording toolbar. After clicking on the icon the cursor will turn into a crosshair. Highlight the text that you wish to check during replay. This will insert the ctrx_get_text function into the script. c. Replay of ctrx_obj_get_info. The following attributes are supported: ENABLED VISIBLE FOCUSED CHECKED - for radio buttons & check boxes. LINES – number of items at list/combo box. TEXT ITEM – select item at list/combo box. d. Replay of ctrx_sync_on_obj_info – This function will wait for an object to get an attribute before proceeding to the next step. The attributes that are supported are the same as ctrx_obj_get_info. e. Replay of ctrx_list_select_item. f. Replay of ctrx_menu_select_item. 18 5/31/04 FAQ Q. R. How does VuGen know which server to connect to if user adds the name of a Citrix server that is load balanced? The Citrix client has its own algorithm and knows which server is under the least load. It will connect to a server under the least load. Q. R. What is the overhead associated with the Citrix Agent? The memory consumption of the Citrix Agent process is about 4.5 MB per Virtual User. Virtual users making use of the Agent also consume an extra 5% CPU resources.Note that the Agent is only active when Virtual Users are connected to the server. Real Users do not make use of it in any way.. Q. Does the Citrix Agent need to be installed prior to recording in order for us to record the new functions? Yes. During recording VuGen detects whether or not the Citrix Agent is installed on the server. If it is not then the recorder will record the normal functions. If it is installed then the recorder will record the new functions. R. Q. R. Does the Citrix Agent need to be installed on the Citrix server for replay support? Yes. If the Citrix Agent is uninstalled on the server, when the script executes the new functions it will fail. Q. R. How to monitor the GDI resources used There is a third party utility, TaskInfo 2003 that allows you to monitor the GDI resources. For more information, please refer to TaskInfo 2003 Home Page. Q. How can I tell if my script was recorded with the Citrix Agent installed on the server? You will see ctrx_obj_mouse_click recorded instead of ctrx_mouse_click. In addition, there is a flag in the default.cfg file (located inside the script directory) under the [AGENT] section. If AgentIsUp=1 then the Citrix Agent was up and running during the recording session. R. 19