Very well put, as usual. One other thing you can do is use the __log() function to show how a string is being interpreted:
i.e. instead of: ${__function(P1,P2)} try (spaces inserted for clarity): ${__function( ${__log(P1)} , ${__log(P2)} )} This will log the value of P1 and P2 to jmeter.log. or indeed ${__log( ${__function(P1,P2)} )} which will log the output of the function. The __logn() function is exactly the same as __log(), except it returns nothing, so it could be used as follows: ${__logn(P1)}${__function(P1,P2)} HTH. S. On Wed, 8 Dec 2004 19:43:47 -0500, Kyle McAbee <[EMAIL PROTECTED]> wrote: > Dear Avian Liao and JMeter Users: > > Here is a list of things I check when a __javaScript function is not working. > Number 3 is probably the solution to Avian's problem. > > 1. The function name of __javaScript must start with two underlines. If > it does not, JMeter will not execute the function. All JMeter function names > start with two underlines, except for _StringFromFile, which starts with one > underline. > Right: ${__javaScript( ... )} > Wrong: ${javaScript( ... )} > 2. If a function parameter contains a comma character, you must put the > escape character (backslash) before the comma. That causes JMeter to use the > comma as data rather than as a delimiter between parameters. > Right: ${__javaScript('str'.length,Comma\,InData)} > Wrong: ${__javaScript('str'.length,Comma,InData)} > 3. To reference a variable in a function parameter, enclose the variable > name in single quotes. > Right: ${__javaScript('${MyString}'.length,MyStringLength)} > Wrong: ${__javaScript(${MyString}.length,MyStringLength)} > 4. You can write an entire small JavaScript program in a __javaScript > function. For example, to get the current date in MM/DD/YYYY format, use the > code below. This example shows that you can declare variables and separate > lines with semicolons in the JavaScript code. > ${__javaScript(var d = new Date(); var date = d.getDate(); $DATE = > (d.getMonth() + 1) + "/" + (date < 10 ? "0"+date : date) + "/" + > d.getFullYear();,DATE)} > > Sincerely yours, > > Kyle > > > > -----Original Message----- > From: Liao, Avian [mailto:[EMAIL PROTECTED] > Sent: Wednesday, December 08, 2004 5:18 PM > To: Jmeter Question (E-mail) > Subject: question of ${_javaScript} function > > Hi, All, > > Anyone has experience passing variable between Jmtere variable and javascript > variable? > In my case, I have variable that was extracted by Regex, and I called it > "findMe", in function, I try to use javascript to see if I can reuse this > variable or not, so I did like > ${__javaScript(${findMe}+123,showJava)} > > After all this, I use Java Request to see how is the variable doing between > Jmeter and javascript, and it turns out nothing. Any ideal? > > Al > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > > --------------------------------------------------------------------- > > > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]