Monday, June 8, 2015

HP Truclient: Problem and Solutions

Recently, I was doing some self learning on the HP Truclient protocol. I took few sample applications and did the record- enhance-replay kind of stuff. 

This protocol looks extremely simple and easy to use. It is on the object level and hence no session or such values are captured in the script. Hence, there is no traditional requirement for correlation. However, the pros ends here. The cons are it consumes very high amount of RAM memory. To give you an idea, how much is the value, consider below example: A typical HTTP/HTML Vuser consumes about 2 MB of RAM for each Vuser. However, Truclient Vuser consumes minimum of 20 MB and that can go up to 60-80 MB depending upon the complexity of the application. The next problem is object level recording. 

Since, the records are all in terms of the properties of the objects, slight change in the application hampers the script completely. We have to modify the script to have new properties and then make it work. There is no straight forward option to vary the think time in the script. Having said that, this protocol is extremely useful for java-script and flex based applications.

Below is the learning from the protocol usage:

1. The machine on which I was working, had a unique problem. When we access the URL for the first time, it throws some HTTP 401 (access violation) error. However, on clicking refresh, the application works fine. To have this scenario, I recorded invoking of the same URL twice. The problem is, when the first step is executed, application throws the above error and the script is aborted. Due to the HTTP error, the script does not go to the next step and stops. 
Solution: Drag - drop 'Catch' function from the list in the script. This Catch function is kept directly after the first step. It's setting is - Catch Any Error. This enables the script to move forward irrespective of the script error. Note: since this was machine specific error, I opted for this. Had this been application issue, we would have to report it to the development team.

2. Normally, we divide the script in 3 sections, viz: Init (which contains Login), Action (which contains the business logic which has to be looped) and End (which contains the Logout section). With the as is settings, the script failed after moving from Init to Action section. The script could login into the application in the Init section. However, while moving, it refreshed everything and there was nothing to be done in the Action section.
  • Check the 'Simulate new user on each iteration'
  • Bring all the sections in a single section of Action and run.

If business logic does not permit you to have everything in a single Action, choose the first option. However, the first option would clear cache and other stored information on the browser for each iteration. This is not the real behavior. 

3. Object Identification: This is the pain, I was talking about earlier. Slight change in the application can play havoc with your script. 
Solution: Normally, when you record any application, go to the object properties, in that expand the Object section. There, it is recommended by HP to have Automatic drop down value. However, group discussions and as per the experience of the experts, it is better to keep 'Java-script'. Moreover, you can right click on the object on the Firefox and click on the 'Inspect Element'. This will give you the properties of that object. You can use this information for the object idenfication as well.
Example: The Search box has properties (check through Inspect Element), id=XXXXXXX.
Go to Object properties - Change the drop down value to Javascript. In the next edit box, comment the existing value and add: document.getElementById("XXXXXXX");
Since, we mention that getelementbyid, we should not write 'id=' inside the bracket which lists the arguments of the function.

4. The vertical scroll bar rolling was recorded but was not replayed. 
Solution: For this, go to Firefox address bar and type - about:config. This will open a list of settings. Search with scroll-bar. Change the below highlighted value to true. 

5. Network timeout: For some unusual long transactions, you may get error from the Vugen saying the transaction has exceeded the network timeout value. 
Solution: Go to Run Time Settings - Replay and increase the Network timeout value to say 1000 milliseconds.

6. Correlation: In spite of saying that this protocol does not need correlation, there may be some cases which would need to capture the data from the screen and pass it on to the script. 
SolutionWhile recording, click on that value which you want to capture. Post recording, change the 'Click' to 'Get Visible Text'. This function now will get the dynamic text from that object. Drag drop 'Evaluate Java script' from the list of functions. Write: window.alert(Paramname). This function displays the captured value from the previous step. This requires manual intervention to close the alert pop up and hence this is only for debugging. Make sure you are capturing the correct value. The Paramname has to be entered in the Variable (in the Arguments) of the 'Get Visible Text' function. Again, drag - drop 'Evaluate JS' function. Write java-script code as 'LR.setParam("Paramname", Paramname);' This code, will enable to use the 'Paramname' as a parameter throughout the script.

7. After invoking Vugen, you invoke Internet Explorer (in case of Truclient - IE protocol) by clicking on the 'Develop Script' button. After that you click on the Record button. Here, sometimes, we get error pop up saying - TCS has stopped working.
Solution: The workaround for this problem was suggested by one of my colleague and is: add below 2 lines in the default.cfg file in the Vugen folder: 
  • MeasurementLevel=0
  • ComponentBreakdown=0

The catch with this approach is that during the run time, the hits/sec and throughput will not be measured as we say that measurement level is zero.
The other alternate option is: switch to Truclient - Firefox protocol !!!

8. SSO implementation:
To enable accessing an application with SSO:
Internet Explorer: Go to Internet Options - Advanced - Check the option for 'Enable Integrated Windows Authentication*
Firefox: In about:config - add the desired url in the parameter network.negotiate-auth.trusted-uris

Above changes should enable the SSO for the application.

For recording in firefox:
Go to about:config and change network.negotiate-auth.allow-proxies to false
This will enable the login for the application by which you can simulate the SSO logins

Users, are you aware of any more such tips and tricks for HP Truclient protocol? If yes, could you please share them with all.


  1. Useful post.
    For point 7) HP provided few files for loadrunner, you can just replace it with old files or they asked us to remove few security patches from Microsoft. We are using first option.