cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Integration with TruClient

meng_yu
Guide

Hello,

We've been able to integrate Browser Agent with HP QTP and Selenium. We set up custom timers by calling the JavaScript function  _dt_setTimerName(). But this function does not seem to work with HP TruClient, which is a Java Application and works pretty similar to QTP and Selenium. Wondering if there is a plan to integrate with TruClient?

Thanks,

Meng

9 REPLIES 9

andreas_grabner
Dynatrace Leader
Dynatrace Leader

Is there no option in Load Runner to execute JavaScript in the application you are testing via TruClient?

The TruClient is compatible with DT JS. We've tried server-side tagging and it works

Utils.addAutoHeader('x-dynatrace','NA=myURL',false); 

However, for client side tag, _dt_setTimerName("Login") won't work. Tried single quotes, double quotes. 

Not sure whether it is a configuration issue or incompatibility with TruClient?

andreas_grabner
Dynatrace Leader
Dynatrace Leader

Well - I am not an expert in TruClient. Maybe it makes sense to ask this question on the HP Forums to see whether anybody knows how to inject JavaScript calls in your Truclient script. There is nothing we can do to extend the featureset of LoadRunner

sreerag_mooleka
Inactive

Tthe function Utils.addAutoHeader() may not be the dynatrace function. This looks more like a generic function to add fields in header.

_dt_setTimerName() is more specific method for dynatrace.

Having said that I think the compatibility is not an issue because we get the javascipt function details when using browser agent with TrueClient. And DT instruments the .js files using two functions _dt_methodEnter() and _dt_methodExit() these methods are working.

-Sreerag

amardeep_a_sing
Newcomer


yes, Utils.addAutoHeader()  is a TruClient function, with the help of that we are injecting DT tags with every web request.

eric_h_berg
Newcomer
"Is there no option in Load Runner to execute JavaScript in the application you are testing via TruClient?"

Yes, HP LoadRunner TruClient protocol allows evaulation/execution of JavaScript and C code.  Calling the _dt_setTimerName() method within JavaScript results in "failed - exception occurred: ReferenceError: _dt_setTimerName is not defined". 

I've exploded the DynaTrace XPI (dtffagent.xpi) and found it includes a few JS files and redundant DLL's for different versions of FireFox.  At closer look I noticed _dt_setTimerName is referenced within the DLL's; not defined in any JS files.  Going with the asumption that the DLL is a .NET or C++ binary I assume can be accesed using the js-ctypes library to open the DLL and call the _dt_setTimerName method.  I've started to put that together but I'm not familure with js-ctypes. 

https://developer.mozilla.org/en-US/docs/Mozilla/js-ctypes/Using_js-ctypes

JS Code so far:

Components.utils.import("resource://gre/modules/ctypes.jsm");
var dtlib = ctypes.open("dtffagent_31000.dll");   /* Compatible with the headless vesion of mozilla used in TruClient */
setTimerName = dtlib.declare("_dt_setTimerName",   /* function name */
                             ctypes.default_abi,
                             ctypes.char.ptr);
var err = setTimerName('Login');
dtlib.close();

But get an error "couldn't find function symbol in library". 

Let me know if I'm chasing my tail with ctypes. 

eric_h_berg
Newcomer

Ok...so kick me for trying this the hard way (smile)  I'm leaving the above in the event someone wants to load other DLL's in TruClient.  I realize now that the DLL may have been a compiled bunch of JS files.  But I digress. 


I got it working and tested it with Amardeep (above). 


For TruClient to access the method it needs to access it through the Window object:

window._dt_setTimerName('MyTimer2');

Meng, I shared what I did with Conner.  He mentioned writing it up to share with the greater community. 


Note: I tried the window object before but I'm assuming the dT agent may have been off and the method wasn't exposed

Thank you very much, Eric!

eric_h_berg
Newcomer

You're welcome.  I was unaware of the issue till our conference call yesterday.  Next we need to tackle turning the agent on/off and configuring it from TruClient.