Tuesday, April 14, 2015

VUGen Not Recording Applications Running on Chrome

Problem StatementDuring testing we might encounter situations where some of the web-applications are supported only on Chrome not on IE / Firefox. In these situations we might ask whether LR will support recording of Chrome application(s) if so then what version it supports and whether any tweaks needed to resolve any issues.

Solution


If you are using LR 11.0 then you might face issues where Chrome will be launched but the suddenly chrome behaves very slow and becomes non-responsive. While manually the same application runs fine without any issues, to fix this you can apply the necessary LR patches and re-record the flow.
If the issue persists then you can download the latest bbhook.dll from HP Support and perform the following:


  • Go to [Vugen / LR] Install dir -> Bin folder and take a backup of the bbhook.dll and replace it with the new one.
  • Go to [Vugen / LR] Install dir -> config folder and open the vugen.ini file using notepad (or textpad)
  • At the end of the file add the below 2 lines
    [NoTrap]
    Application1=chrome.exe
  • save the vugen.ini file and then copy it to "C:\Windows" folder
  • Restard Vugen.
If you are using LR 11.5; it has Chrome support till ver 25; if you are using higher version of chrome then you might face issues in recording... to avoid these you can either install chrome version 25 or install latest LR patches. 

Another workaround is to record the Application using LR Proxy available with LR 11.5 where LR will work as a proxy (listening on port 8888); you can change the proxy settings in chrome browser and navigate your flows / scenarios. Events will get recorded and script will be generated in VUGen.

During recording of a HTTPS page with chrome browser you face an recording error which says "Alternate-Protocol: 443:quic"; currently both LR 11.x and 12.x doesn't support QUIC and you have to use other browsers which doesn't support QUIC like IE and Mozilla.

Hope this was helpful in resolving your issues.


VUGen replay errors for HTTPS sites

Problem Statement: Now as most of the sites are migrating to HTTPS; during replay of these application(s) / sites you might see some errors as mentioned below; you can follow the solutions given to resolve the same.

Solution:

Below are a list of Errors encountered and their resolutions for the same:
Error: "--27776: Server "[server_name]" shut connection during attempt to negotiate SSL session"
To resolve this issue, you can reduce the amount of connections simultaneously opened to a Web server by using the following statement in the script:
web_set_sockets_option("MAX_CONNECTIONS_PER_HOST","1");
Also, make sure that Keep-Alive is set to "No." This setting can be found via Run-Time Settings -> Preferences -> Options -> Keep-Alive HTTP Connections.

Error: "Error -27781 Timeout in state STATE_SSL_CONNECT "
Error: -27778 : SSL protocol error when attempting to read with host

There are some possible work-around for the above 2 errors, you need to check which one (or combination) works for you:
1. Add the following statement to the beginning of the script:
        web_set_sockets_option("SSL_VERSION", "3");
You can check the SSL Version in your recording log of the script, it can be TLSv1.1 / 1.2 or SSL3; accordingly you can change the command mentioned above.

2. Add web_set_sockets_option("MAX_CONNECTIONS_PER_HOST","1"); at the very beginning of the script.

This forces a single connection to the server thus eliminating the possibility of the server prematurely shutting down an existing connection and causing errors when LoadRunner sends data using that connection.

3. Disable webpage breakdown if HTTPS protocol (SSL) is being used and there is a proxy server in-between the client (LoadRunner) and the server under test. To disable webpage breakdown from the Controller:

   a. Go to Diagnostics->Configuration.
   b. Select "Disable" tab for "Web Page Diagnostics"
   c. Click "OK" to close the diaglogue to complete the setup

4. If you have generated your script using WinInet options then use the WinInet Replay engine. To do so, go to Run-Time Settings -> Preferences -> Select "WinInet Replay Engine instead of Sockets (Windows Only)."

Error: "SSL State: error in SSLv3 write client certificate B..." while replaying in Socket mode
Error: "SSL protocol error when attempting to connect with host" while replaying a Web protocol script

Add all of the certificates in the certificate hierarchy for the SSL certificate to a .pem file (e.g. certFile.pem) and include this .pem file by adding the following line at the beginning of the script:
web_set_certificate_ex( "CertFilePath=certFile.pem", "CertFormat=PEM", ...LAST);
web_set_sockets_option("LOAD_VERIFY_FILE", "certFile.pem");

Error -27791 : "server name" has shut down the connection prematurely

To Resolve this, you can try adding the below command:
web_set_sockets_option("MAX_CONNECTIONS_PER_HOST","1"); at the very beginning of the script.
If you still get the same error then you can try the below command (add it after the previous one):
web_set_sockets_option("IGNORE_PREMATURE_SHUTDOWN", "1")

Error: SSL protocol error when attempting to connect with host "xxx"

Try to check the certificate and connection using openssl with this sentence from CMD:
                       openssl s_client -connect :2443
               or
                       openssl s_client -connect :443

This will show the certificate information. If not, application has a certificate problem and need to check with application owners / server admins.

Friday, June 20, 2014

Issues Encountered on Linux / Unix LG

Problem StatementDuring testing we might encounter situations where we have to simulate load from LINUX / UNIX LGs. Post installation of Loadrunner binaries on the server we might face certain issues as mentioned below and their solutions / workaround to solve them.

Issue Tags: $M_LROOT is not set, verify_generator failed, Verify running the product executables...Failed, Failed to load client QTWeb

Solution
The most common error that you can encounter is when you run the verify_generator.sh script; you will get the first error as shown below:
Once this is done, you should be able to run the script fine on your LINUX/UNIX.




This error comes when the verify_generator.sh calls the vuserchk.sh file; you can fix the issues by doing the changes in vuserchk.sh file as mentioned in the below screenshot:


The above changes should fix the issues in verify_generator.sh script.

Sometimes you might get the below shown error:


This issue comes because of missing run-time libraries; you can fix this issue by running the below command:

Install with root privelges - libstdc++.so.5  under /usr/lib/

The LG Operates in 2 modes - rsh mode and daemon mode; if the controller is not able to connect to the LG in rsh mode then you can make it work by running LG in daemon mode.

Do the following changes in your UNIX/LINUX LG to make it work in daemon mode:

Run Install command "./m_daemon_setup -install" from the /bin directory.
Command to start:  “./m_daemon_setup start”

Command to Stop: “./m_daemon_setup –remove”

From Controller UI
1. In the Load Generator Window, go to Details -> Unix Environment -> Shell settings section. 

2. Select the "Don't use RSH" checkbox.

once the daemon is running and you are able to connect the LG from controller machine, you can do a quick check by running a normal web protocol script. If you are getting the below shown screenshot (Failed to load client QTWeb) in controller then this can be due to a 64-bit OS which requires some additional libraries to be installed:



see the below snapshot for the steps to be done to resolve this issue:


Below i have mentioned some basic troubleshooting steps which you can do:

General debugging steps:
   a. Verify ping and rsh are working to and from the remote machine.
   b. The .rhosts file on remote machine with 644 permission minimum and + +.
   c. The following enviroment variables should be set:
      $M_LROOT
      $M_LROOT/bin library path included
      $M_LROOT/bin included in PATH
   d. Check the environment settings via rsh:
      K-shell (ksh): 
         rsh -n "/bin/ksh -c env"
      Bourne Shell (sh):
         rsh -n "/bin/sh -c env"
      C-shell (csh):

         rsh -n "/bin/csh -c env"

Wednesday, January 16, 2013

Running QTP Scripts in Performance Center over Firewall

Problem StatementDuring some of our non functional testing scenarios, there might be a need to get the actual end-user response timings. In that case the usual approach is to create a QTP script for the business flow and then add that in your performance center scenario and Run it. But the problem arises when the load generator (mainly the QTP machine) you want to use is behind a firewall and performance center can't connect to it directly.

Solution: There is a solution to do so:


If you want to run your QTP scripts in LoadRunner context then you need to configure your load injector and MI Listener properly as mentioned in my previous blog and then go to Step 9 for changes related to QTP:


http://commonlrissues.blogspot.co.uk/2009/03/working-with-firewalls-in-loadrunner.html


If you want to run the QTP scripts using Performance Center then follow the following steps.


Step-1: Install MI Listener from your HP ALM setup on a host machine which does not have any other ALM components:




















Once the MI listener is installed, it will ask you to configure it. Choose as a Performance Center installation.



Once MI configuration is done, you can see a loadrunner agent service being installed and running.

If you perform a "netstat -ano" on the MI Listener machine it will show that the loadrunner agent service has started listening on ports 443, 50500 and 54345. This confirms that MI_Listener has started working properly.

Step-2: Install the Load Generator component on your QTP machine (where you want to simulate the QTP users)


Step-3: Configure the Load Generator to be configured as a LoadRunner component; this is needed as we want to run the "magentproc" as a process which is needed to run QTP.





Step-4: Login to PC admin site (in PC 11 ALM login to Lab Management) and create new location and MI_Servers as shown below:






For the MI Server, better to mention the host-name in the server name and provide its IP and choose the appropriate action like "Running Vusers"

Step-5:Once the load generator is installed successfully, it will start the agent. But you need to enable it to work over firewall. So you need to change the agent config:




In this configuration (after you click the settings) you need to add the following:






Give the name (hostname) of your MI_ Listener server / machine;
Enter the local machine key as the combination of agent host name and Firewall Group in performance center separated by "_"

PS: Perform a check whether your agent is able to communicate with MI Listener, perform a telnet to the MI_Server on port 443.

Step-6:Once the load generator is configured successfully, it will restart the agent and you can see a red traffic light below in your taskbar:

Step-7: After this you need to add the load generator details in the PC interface. For this you need to login to Lab Management in Performance Center and then add the details as shown below:



In the Name mention the hostname of the load generator;
in installation type, select standalone load generator;
in location choose the location created by you;
in MI_Listener choose the MI Server created by you earlier in step 4;
and click on Submit. If all the details are correct and connections are okay then it will get added without an error.

Step-8: Once all these configuration are done, you have made the LG to work over firewall. But before you start running your GUI / QTP test lets perform a basic check to see if everything works fine.

Create a normal web scenario with a dummy web protocol script, add this LG (over firewall) to the scenario and save it. Run the scenario from PC and see if it is able to connect to LG and running the test.

Once the connection is established between Controller and LG, the traffic light will turn green and  show a cloud saying the LG is serving the VUsers as shown below:
PS: If you are done till this step then you can use this LG to run your normal web protocol scripts. 
There are restriction(s) on other protocols while running via MI listener and some tweaking needs to be done before it can work. The same needs to be done for the QTP scripts, the below step is needed only for the case of QTP script.

Step-9: In order to run your QTP script on the LG over the firewall (once all the above steps are done), you need to make the following changes:

The below changes are needed on the QTP installation:


  • Please browse to the [QTP Install Dir]\dat\mdrv directory on the generator machines. 
  • Open the mdrv_qtp file in notepad
  • Please add 'SecurityMode=On' under the sections [tulip] and [ActiveScript]
  • In the [QTP Install Dir]\dat directory, open the mdrv.dat file and add the following to the very end:

        [tulip]
        SecurityMode=On

        [ActiveScript]
        SecurityMode=On


The below changes are needed on the Load Generator installation:

  1. Open the mdrv.dat file under the [LG Install Dir]\dat folder on Load Generator machine.
  2. Search for the [Tulip] and [ActiveScript] section and add "SecurityMode=On" to the list under it. If not then add the entries manually as shown above for QTP
  3. Repeat step 2 for the mdrv.dat file under the [LG Install Dir]\launch_service\dat folder on the Load Generator machine.
  4. Restart the Agent on the machine.



Step-10: Add the "mmdrv.exe" to your DEP (Data Execution Prevention) exception list; this process is placed at "[QTP Install Dir]\bin" folder. Once this step is done, you have successfully configured your LG to run QTP scripts through performance center to an agent over the firewall.

PS:If your are running Agent on a machine where UAC is turned high then change the UAC setting to medium and change property of magentproc.exe to run with Admin privileges. 

One more thing to note is that you must validate your QTP script in silent test runner and make sure that it runs fine without any issues.

Tuesday, November 20, 2012

How to Save the downloaded file to local system

Problem Statement: During some of our non functional testing scenarios, there might be a need to download some files. We are also asked to check the transaction time for that download process, but very rarely there is a need to save the downloaded files to your local system for some verification later. If this is the case then how can we do so...

Solution: There is a solution to do so, all you need to do is get the data from the server response and save it to a file using normal file operations. But you need to know beforehand the type of file you are going to download.

In this sample example let's consider that you are trying to download a .pdf file and want to save it to local system. Here is a sample code snippet to do so:
**************************************************

//declare the variables
int fp;
long i;

//create file for writing.
fp = fopen("c://test_file.pdf","wb");

//Start a transaction to measure the download time.
lr_start_transaction("file_download");

//Set the parameter size large enough to save the data.
web_set_max_html_param_len("100000");

//Use web_reg_save_param with the correct boundary to capture the data returned by the server (for the download)
web_reg_save_param("FILEDATA","LB=","RB=","Search=Body",LAST);

//HTTP call to download the .pdf file
web_url("http://serverURL:port/app/resource/getme.pdf");

//Get the download size.
i = web_get_int_property( HTTP_INFO_DOWNLOAD_SIZE );

//Write the data saved to an output file.
fwrite(lr_eval_string("{FILEDATA}"),i,1,fp);

//End the transaction
lr_end_transaction("file_download", LR_AUTO);

//Close the file pointer.
fclose(fp);
**************************************************

Hope this helps in your scenario.

Monday, October 8, 2012

Conversion Functions for Hash (SHA1) and Hex

Problem Statement: During a recent project there was a need to encrypt the data to be sent to target application using SHA1 algorithm. There was a need to develop some kind of function which can achieve this objective.

SolutionDuring this process i used Visual Studio 2010 to develop the required functions using c++ code and then export these functions using dll.

This dll can be called in your VUGen script to encode the string using SHA1 algorithm and send it back to you (this generates the code in base-64).

Also this dll has some more basic utility like converting a string to hex and vice-versa. The usage of the functions can be seen in the screenshot below:


Hope this is helpful to you in your projects; if anyone needs any custom functions then i can probably add them later into this dll.

PS: I can't post the dll here in this post due to option restrictions; you can mail me if you need it then i can send you the dll.

Thursday, September 13, 2012

Minimum Permission Level to Install and Run Loadrunner

Problem Statement: What is the minimum access level a user needs to Install and Run Loadrunner and its components ?

Solution: Ideally the user needs to be part of Administrator group on the machines where he wants to install and run loadrunner.

But actually a user needs to be Administrator for installation and power user for running LoadRunner.


It is recommended to be a member of at least power users to run LoadRunner. 
Sometimes, due to security restrictions, this is not possible. In that case, the user must have at least the following rights; these rights needs to be provided appropriately by an Administrator:
1. Full access (read/write permissions) to registry keys as mentioned below:
HKEY_CURRENT_USER\Software\Mercury Interactive
HKEY_LOCAL_MACHINE\Software\Mercury Interactive 
HKEY_LOCAL_MACHINE\Software\Microsoft\Jet\4.0\engines\text
HKEY_LOCAL_MACHINE\Software\Microsoft\Tracing
HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\WMI
2. Full access (read/write permissions) to the file system (preferably to the local drive where user account is present and other drive if Loadrunner is installed on a secondary drive) to be able to copy files.

If there is any problem either with agent start up or connection from Controller to the agent on a Windows 2K machine with a power user, then ask the system administrator to perform the following:
1. Open the Local Security Settings window through Start -> Programs -> Administrative Tools -> Local Security Policy.
2. Select Security Settings -> Local Policies -> User Rights Assignments.
3. Add the user to the "Create global objects" policy.