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.