You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@jmeter.apache.org by Lenin Basheer <Le...@ibsplc.com> on 2007/05/30 07:29:37 UTC

_javaScript() function in Jmeter

Hi All,

I ve been tryintg to get the javaScript() to work with jmeter for a 
specfic scenario that i am testing. I havent been succesfull and there 
fore seeking ur help.

This is the java script that i wrote ;

${__javaScript(${flightNumber}==10 ? ${i} += 1; : ${i} ,flightDate )}

I have the javaScript as a user parameter , with
name : date
value : ${__javaScript(${flightNumber}==10 ? ${i} += 1; : ${i} ,flightDate 
)}

However i cant get it value ${i} to increment.

Another option that i tried was to increment the value using a 
_counter(FALSE,flightDate)  with in an if controller that checks if 
flightnumber = 10.
However the variable flight date goes null outside the scope of the if 
controller.

Can any one help ? I am stuck with this and any help is appreciated.

regards,
Lenin Basheer



DISCLAIMER: 

"The information in this e-mail and any attachment is intended only for 
the person to whom it is addressed and may contain confidential and/or 
privileged material. If you have received this e-mail in error, kindly 
contact the sender and destroy all copies of the original communication. 
IBS makes no warranty, express or implied, nor guarantees the accuracy, 
adequacy or completeness of the information contained in this email or any 
attachment and is not liable for any errors, defects, omissions, viruses 
or for resultant loss or damage, if any, direct or indirect."





Re: _javaScript() function in Jmeter

Posted by sebb <se...@gmail.com>.
On 30/05/07, Lenin Basheer <Le...@ibsplc.com> wrote:
>
> Hi Sebb,
>
> My objective in short is this.
> flightdate =1;
> while( flightnumber <10)
> {
>         list flight for (flightnumber, flightdate);
>         if (flghtnumber == 10){

The above can never be true.

>                 flightdate++;
>         }
> // increment filght date  if value is 10 else retain the same value for flight date ..
>
> flightnumber ++;
> }


> This way i want to achive a unique pattern of flights on all dates ... say f1 on Jan 1,  f2 on Jan 1 etc f10 in 1 and then it creates the set f1 on Jan 2 , f2 on jan 2 etc.
>
> i cant have two counters because it creates the pattern  f1 on 1 , f2 on 2 etc.
>
> please help.

Since flightDate remains at 1 according to the pseudo-code, you only
need one counter.

[Please don't use HTML]

---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jmeter-user-help@jakarta.apache.org


Re: _javaScript() function in Jmeter

Posted by Lenin Basheer <Le...@ibsplc.com>.
Hi Sebb,

My objective in short is this.
flightdate =1;
while( flightnumber <10)
{
        list flight for (flightnumber, flightdate);
        if (flghtnumber == 10){
                flightdate++; 
        }
// increment filght date  if value is 10 else retain the same value for 
flight date .. 
 
flightnumber ++;
}

This way i want to achive a unique pattern of flights on all dates ... say 
f1 on Jan 1,  f2 on Jan 1 etc f10 in 1 and then it creates the set f1 on 
Jan 2 , f2 on jan 2 etc.

i cant have two counters because it creates the pattern  f1 on 1 , f2 on 2 
etc.

please help.

regards,
Lenin



sebb <se...@gmail.com> 
05/30/2007 04:45 PM
Please respond to
"JMeter Users List" <jm...@jakarta.apache.org>


To
"JMeter Users List" <jm...@jakarta.apache.org>
cc

Subject
Re: _javaScript() function in Jmeter






On 30/05/07, Lenin Basheer <Le...@ibsplc.com> wrote:
>
> Hi All,
>
> I ve been tryintg to get the javaScript() to work with jmeter for a 
specfic
> scenario that i am testing. I havent been succesfull and there fore 
seeking
> ur help.

What are you trying to achieve?

> This is the java script that i wrote ;
>
> ${__javaScript(${flightNumber}==10 ? ${i} += 1; : ${i}
> ,flightDate )}

Assuming flightNumber = 7 and i = 3 then the script:

   ${flightNumber}==10 ? ${i} += 1; : ${i}

becomes:

  7==10 ? 3 += 1;: 3

which is not valid.

Variable references are replaced by their values.

> I have the javaScript as a user parameter , with
> name : date
> value : ${__javaScript(${flightNumber}==10 ? ${i} += 1; :
> ${i} ,flightDate )}
>
> However i cant get it value ${i} to increment.
>
> Another option that i tried was to increment the value using a
> _counter(FALSE,flightDate)  with in an if controller that checks if
> flightnumber = 10.
> However the variable flight date goes null outside the scope of the if
> controller.

Initialise it outside the If Controller.

---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jmeter-user-help@jakarta.apache.org







DISCLAIMER: 

"The information in this e-mail and any attachment is intended only for 
the person to whom it is addressed and may contain confidential and/or 
privileged material. If you have received this e-mail in error, kindly 
contact the sender and destroy all copies of the original communication. 
IBS makes no warranty, express or implied, nor guarantees the accuracy, 
adequacy or completeness of the information contained in this email or any 
attachment and is not liable for any errors, defects, omissions, viruses 
or for resultant loss or damage, if any, direct or indirect."





Re: _javaScript() function in Jmeter

Posted by sebb <se...@gmail.com>.
On 30/05/07, Lenin Basheer <Le...@ibsplc.com> wrote:
>
> Hi All,
>
> I ve been tryintg to get the javaScript() to work with jmeter for a specfic
> scenario that i am testing. I havent been succesfull and there fore seeking
> ur help.

What are you trying to achieve?

> This is the java script that i wrote ;
>
> ${__javaScript(${flightNumber}==10 ? ${i} += 1; : ${i}
> ,flightDate )}

Assuming flightNumber = 7 and i = 3 then the script:

   ${flightNumber}==10 ? ${i} += 1; : ${i}

becomes:

  7==10 ? 3 += 1;: 3

which is not valid.

Variable references are replaced by their values.

> I have the javaScript as a user parameter , with
> name : date
> value : ${__javaScript(${flightNumber}==10 ? ${i} += 1; :
> ${i} ,flightDate )}
>
> However i cant get it value ${i} to increment.
>
> Another option that i tried was to increment the value using a
> _counter(FALSE,flightDate)  with in an if controller that checks if
> flightnumber = 10.
> However the variable flight date goes null outside the scope of the if
> controller.

Initialise it outside the If Controller.

---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jmeter-user-help@jakarta.apache.org