The more I work on TruClient protocol, the more challenges I face (to implement more and more functionalities in scripts / config changes) and the more I explore on TruClient. This exploration sometimes take me very long to resolve issues and help me learn many new things on the way. Through this article I would like to share with you some challenges that I faced while scripting and the different tips that I developed while resolving issues. I have also mentioned some config changes for day-to-day issues here. I hope the article helps you.
1) Calculating number of text occurances –
2. In the arguments section add the following code –
var splitBySearchWord = (document.body.textContent).split(‘Text to search for);
3. Then display the total number of occurance of the text using Alert() method.
2) Inserting random thinktime –
1) From ‘Toolbox’, copy a wait function and paste it before the web request.
2) In the argument section, replace the interval value ‘3’ by ‘Math.floor(11*Math.random()+5);‘
The above function will return a random number between 5 and 15.
Math.floor() method rounds a number DOWNWARDS to its nearest integer. (Eg. The output of code ‘Math.floor(1.8);‘ is 1). Hence 11 is used as a multiplication factor so that an integer in the upper decimals of 10 will be rounded to 10.
Math.random() method returns a random number between 0 and 1.
3) Handling browser cache –
You may wish to manage the cache handling features of the browser to replicate different types of test scenarios. This can be achieved by following these steps –
1. Open the Script under Interactive mode.
2. Go to Vuser > Run-Time Settings > General > Load mode Browser Settings.
3. Inside the Settings frame women extenze display the option Advanced.
4. Select the option “Compare the page in cache to the page on the network”; select one of the four values above according to your test requirements.
0 = Once per session
1 = Every time the page is accessed
2 = Never
3 = When the page is out of date(this is the default value)
4) NTLM authentication –
Some applications when accessed on Mozilla, demand NTLM authentication. If these steps appear while recording, they don’t get recorded. Hence while replaying, due to the absence of these steps, the application fails to perform the intended transactions.
To avoid a situation in which an application asks for NTLM authentication while recording and replaying, one has to specify the application as a trusted NTLM resource. To make that, follow these steps.
1) Open the file “user.js” located in “%lr_path%\dat\LrWeb2MasterProfile”
2) Locate the preference setting “network.automatic-ntlm-auth.trusted.uris”
3) Specify the URL of the trusted resource as the value of this setting
4) Save the file “user.js”
These changes are done only where the VuGen is used to develop the script. These changes get saved with the script and apply on different machines during load tests.
5) Memory Footprint of a TruClient Vuser –
HP team’s benchmarks for various applications under test suggest that a single AJAX TruClient Vuser utilizes around 60-120 MB of memory footprint and consumes about 3 – 30% of Single CPU core (3GB Ram).
6) AJAX TruClient with Internet Explorer –
The latest version (11th Version, 4th Patch) of Ajax TruClient is integrated only with Mozilla Firefox. However, HP is planning to release another patch with internet explorer compatibility. This patch will support the latest version of Internet Explorer (ie. IE 9). The patch is expected to be released by June 2012.
The object identification, certificate handling, Xpath creation and source coding capabilities can only be judged once the patch is released. As of now, what I can say is that it will act as another feather in HP’s cap and it will solve more industry problems.
You may also want to read –
AJAX TruClient Protocol – Tips and tricks Part I
AJAX TruClient – The next Revolution in Performance Testing domain
AJAX TruClient – Parameterization, Text Verification and Object Identification
And Jason’s review on TruClient –
HP TruClient – A Review