You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@jmeter.apache.org by David Bronner <db...@google.com> on 2006/04/20 18:35:04 UTC

Re: Where to declare the java script with the help of function and how to call this function in JMeter

AFAIK, you can use javascript in almost any field with the syntax
${__javaScript()}    However, I have basically the same question...where are
we supposed to do assignments to variables with values generated by
javascript?  I've been inserting dummy regex parsers and assigning the
javascript output there, but it seems like there has to be a better way.  It
would be great if there were a pre-processor that just assigned values to
variables.

-Dave

On 4/19/06, Tapaswini Das <ta...@persistent.co.in> wrote:
>
> Hi All,
>
>
>
>   I'm using JMeter 2.0.3 for Load testing.
>
> My Test case is to create a document through one user and before uploading
> the ppt the ID is created then after in file properties page upload the
> slides. Each user create different Document id which generated by the
> application and showed in the http request of JMeter.
>
>
>
> I've JavaScript can any one tell me how I'll use these java scripts so
> that
> each user can create different document at a time by load script.
>
>
>
> "Where to declare the java script with the help of function and how to
> call
> this function in JMeter "
>
>
>
>
>
> Javascripts
>
>
>
> 1.function getTestForm(paneId, object){
>
>             var frms = document.forms;
>
>             for (var i=0;i<frms.length;i++) {
>
>                         var frm = frms[i];
>
>                         if (frm.name.indexOf(paneId) > - 1) {
>
>                                     if(object == 'folder') return
> getFolderId(frm);
>
>                                     else if(object == 'component') return
> getComponentId(frm);
>
>                                     else if(object == 'document') return
> getDocumentId(frm);
>
>                         }
>
>             }
>
>             return null;
>
> }
>
>
>
> 2.function getFolderId(f){
>
>             if (f.folderId != null && f.folderId != 'undefined')
>
>                         return f.folderId.value;
>
>             else
>
>                         null;
>
> }
>
>
>
> 3.function getDocumentId(f){
>
>             if (f.documentId !=null && f.documentId != 'undefined')
>
>                         return f.documentId.value;
>
>             else
>
>                         null;
>
> }
>
>
>
> 4.function getComponentId(f){
>
>             if (f.componentId !=null && f.componentId != 'undefined')
>
>                         return f.componentId.value;
>
>             else
>
>                         null;
>
> }
>
>
>
>
>

RE: How to extract the parameter returned in Result Tree using JMeter

Posted by Tapaswini Das <ta...@persistent.co.in>.
Thanks Sebb it's working perfectly.

Can you please tell me weather I can use 2 counters for increment of
Document Id and login as different Virtual users if then How???

As I'll Create Load test script for 150 users.

-----Original Message-----
From: sebb [mailto:sebbaz@gmail.com] 
Sent: Thursday, April 27, 2006 11:45 PM
To: JMeter Users List
Subject: Re: How to extract the parameter returned in Result Tree using
JMeter

On 27/04/06, sebb <se...@gmail.com> wrote:
> On 27/04/06, Tapaswini Das <ta...@persistent.co.in> wrote:
> > Hi Sebb/Dave
> >
> >        We have investigated little more in our code with JMeter and
found
> > the code that is showing problems to us for JMeter to read. A code
snippet
> > written below was returned by JMeter in Result Tree.
> >
> >        This code shows the Java Script parameters and values. We want to
> > extract the "documentId" parameter from this code for the next action to
> > work, as the next action to this uses "documentId" as Query String. The
> > "documentId" is marked in Red Font having yellow background.
> >
> >        Can you suggest any alternatives to read the parameter
"documentId"
> > from this Code using JMeter?
> >
> >        We tried using Regular Expression [which extracts the HTML Code]
to
> > extract the value but it didn't work out.
>
> What did you try?
>
> Why did it not work? What happened?

Have you tried:

Regex:    \+ 'documentId=(\d+)' \+
Template: $1$
Match: 1

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


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


Re: How to extract the parameter returned in Result Tree using JMeter

Posted by sebb <se...@gmail.com>.
On 27/04/06, sebb <se...@gmail.com> wrote:
> On 27/04/06, Tapaswini Das <ta...@persistent.co.in> wrote:
> > Hi Sebb/Dave
> >
> >        We have investigated little more in our code with JMeter and found
> > the code that is showing problems to us for JMeter to read. A code snippet
> > written below was returned by JMeter in Result Tree.
> >
> >        This code shows the Java Script parameters and values. We want to
> > extract the "documentId" parameter from this code for the next action to
> > work, as the next action to this uses "documentId" as Query String. The
> > "documentId" is marked in Red Font having yellow background.
> >
> >        Can you suggest any alternatives to read the parameter "documentId"
> > from this Code using JMeter?
> >
> >        We tried using Regular Expression [which extracts the HTML Code] to
> > extract the value but it didn't work out.
>
> What did you try?
>
> Why did it not work? What happened?

Have you tried:

Regex:    \+ 'documentId=(\d+)' \+
Template: $1$
Match: 1

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


Re: How to extract the parameter returned in Result Tree using JMeter

Posted by sebb <se...@gmail.com>.
On 27/04/06, Tapaswini Das <ta...@persistent.co.in> wrote:
> Hi Sebb/Dave
>
>        We have investigated little more in our code with JMeter and found
> the code that is showing problems to us for JMeter to read. A code snippet
> written below was returned by JMeter in Result Tree.
>
>        This code shows the Java Script parameters and values. We want to
> extract the "documentId" parameter from this code for the next action to
> work, as the next action to this uses "documentId" as Query String. The
> "documentId" is marked in Red Font having yellow background.
>
>        Can you suggest any alternatives to read the parameter "documentId"
> from this Code using JMeter?
>
>        We tried using Regular Expression [which extracts the HTML Code] to
> extract the value but it didn't work out.

What did you try?

Why did it not work? What happened?

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


How to extract the parameter returned in Result Tree using JMeter

Posted by Tapaswini Das <ta...@persistent.co.in>.
Hi Sebb/Dave

	We have investigated little more in our code with JMeter and found
the code that is showing problems to us for JMeter to read. A code snippet
written below was returned by JMeter in Result Tree. 

 	This code shows the Java Script parameters and values. We want to
extract the "documentId" parameter from this code for the next action to
work, as the next action to this uses "documentId" as Query String. The
"documentId" is marked in Red Font having yellow background.

	Can you suggest any alternatives to read the parameter "documentId"
from this Code using JMeter?

	We tried using Regular Expression [which extracts the HTML Code] to
extract the value but it didn't work out. 

	We have prepared some java script functions also to read this value,
if any way the JMeter uses those functions. 

	We also require more understanding on "BeanShell" to use that
function if it supports reading User Defined Function.

We have already gone ahead with JMeter and relying heavily on this tool. We
need this URGENTLY as our release deadline is approaching and at this point
we just cannot go back. We request you to please help us out ASAP.

Thanks & Regards,
Tapaswini

*************************Code Snippet Begin *******************************
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <script
language="javascript" type="text/JavaScript"
src="/_scripts/adminUtil.js"></script>
<script language="javascript" type="text/JavaScript"
src="/_scripts/commonUtil.js"></script>
<script language="javascript" type="text/JavaScript"
src="/_scripts/userUtil.js"></script>
<table>
	<tr>
		<td>
			<div id='rightDiv' style="display:inline">
			</div>
		</td>
	</tr>
</table>
<script language="javascript">
	var resultDiv;
	var messageDiv;
	resultDiv  = document.getElementById("resultDiv");
	messageDiv = document.getElementById("messageDiv");
	if (resultDiv == null) {
			//alert("Window.opener" + window.opener);
			if (window.opener != null || typeof window.opener !=
'undefined') {
				//alert("window.opener");
			resultDiv =
window.opener.document.getElementById("resultDiv");
			messageDiv =
window.opener.document.getElementById("messageDiv");
		}
			else {	
				//alert("parent.opener" + parent.opener);
				if (parent.opener != null || typeof
parent.opener != 'undefined') {
				//alert("parent.opener");
				resultDiv =
parent.opener.document.getElementById("resultDiv");
				messageDiv =
parent.opener.document.getElementById("messageDiv");
				}	
			}	
	}
	resultDiv.style.display="";
	constructMessageDiv('/img/icon_correct.gif', 'Document created.',
messageDiv);
	var refreshElement;
	var rightDiv;
	if (window.opener != null || typeof window.opener != 'undefined') {

		refreshElement =
window.opener.document.getElementById("refresh_rightDiv");
rightDiv = window.opener.document.getElementById("rightDiv");
	}
	if (refreshElement == null){
		if (parent.opener != null || typeof parent.opener !=
'undefined') {
			refreshElement =
parent.opener.document.getElementById("refresh_rightDiv");
rightDiv = parent.opener.document.getElementById("rightDiv");

		}	
	}		
	if (refreshElement != null && typeof refreshElement != 'undefined')
{	 
	refreshElement.onclick = function(){ 
				var url  = '<URL of Application>' +
'&action=documentComponents&' + 'documentId=660' +
'&mainview=detail&subview=small';
				var x = (window.ActiveXObject) ? new
ActiveXObject("Microsoft.XMLHTTP") : new XMLHttpRequest();
				if (x!=null) {
    		        x.onreadystatechange = function() {
		                if (x.readyState == 4 && x.status == 200) {
		                    rightDiv.innerHTML = x.responseText;
		                }
    		        }
    		url = url + "&split=" + split + "&paneId=rightDiv&siteArea="
+ getSiteArea();       
    		        x.open("GET",url,false);
			x.send(null);  
    		    }
    		 }
		refreshElement.click();
		if (window.opener != null || typeof window.opener !=
'undefined')
			window.close();
		else if (parent.opener != null || typeof parent.opener !=
'undefined')
			parent.close();
	}	
</script>
*************************Code Snippet End *******************************


-----Original Message-----
From: sebb [mailto:sebbaz@gmail.com] 
Sent: Tuesday, April 25, 2006 11:23 PM
To: JMeter Users List
Subject: Re: Where to declare the java script with the help of function and
how to call this function in JMeter

On 25/04/06, Tapaswini Das <ta...@persistent.co.in> wrote:
> Hi Dave/Sebb,
>
>  Thank you for your quick reply.
>
>  I have tried the same JMeter script with Regular Expression. The problem
is
> Regular Expression is unable to read inner HTML code used to implement for
> AJAX technology in my application.
>
>  Please find below the full description of the problem faced with
> JMeter2.0.3:

This is rather old. Upgrade to 2.1.1.

> Solution Tried: Regular Expression
> Problem Faced:  JMeter is unable to read inner HTML which is used in AJAX
> implementation. [e.g. for reading auto-generated Folder Id on
the
> HTML] Page
> Outcome:            Regular Expression is unable to read inner HTML.

Why can't you extract the HTML?
What did you try?

> Solution Tried: Static Values for each virtual user using User Defined
> Variables.
> Problems Faced: 1. requires lot of efforts while working with more than 50
> Users.
>                    2. Dynamic features like Upload, Move can not have
> static             values.
> Outcome: It's hectic to use Static values for Load Testing

You can use the Counter test element for generating variable names.

> Solution Tried: Java Script [Used Defined Functions] for dynamic values.
> Problem Faced: JMeter is unable to read the Java Script as per mentioned
by
> you and Sebb.

True - perhaps create a Buzilla enhancement request to add this - e.g.
use a property to create a javascript initialisation file, as is
already done for BeanShell.

> Can you guide me about what can I do for the above problems for using
> JMeter?
> Will it be useful if I use Pearl Script instead of Java Script?

There is no Perl Script in JMeter.

You can use BeanShell; this supports user-defined methods etc.

However, if you are trying to emulate what a browser does when it
encounters JavaScript on a page, it won't help.

You need to find a way to extract the variable information from the
page without having to run the scripts that require access to the page
objects.

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


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


RE: Where to declare the java script with the help of function and how to call this function in JMeter

Posted by Tapaswini Das <ta...@persistent.co.in>.
Hi Dave/Sebb

 Thanks for your quick and easy to understand reply. We upgrade our JMeter
to 2.1

 In my application, our developers are using HTML DOM for parsing the HTML
Code. They use Java Script to fill in the AJAX code within the HTML [Outer
or External HTML]. So in a way the Server script [turned as Inner HTML] is
feed into the Client script [termed as Outer HTML]. 
 When we observed the HTML Code, returned by JMeter while recording, it
doesn't show any inner HTML variables like Document ID etc. 
 Due to this Regular Expressions are getting failed.

 Running counter as generating values had solved one of our few problematic
scripts. Thanks a bunch for that.

 We tried to look at BeanShell but the code is becoming little difficult for
us. Can we have few samples to generate the code or use the BeanShell?
 We already have JavaScripts ready for reading Inner HTML code. Can we put
the file in the bin directory of JMeter to parse them by BeanShell method?

 Awaiting your fruitful reply.

 Thanks and Regards,
 Tapaswini

-----Original Message-----
From: sebb [mailto:sebbaz@gmail.com] 
Sent: Tuesday, April 25, 2006 11:23 PM
To: JMeter Users List
Subject: Re: Where to declare the java script with the help of function and
how to call this function in JMeter

On 25/04/06, Tapaswini Das <ta...@persistent.co.in> wrote:
> Hi Dave/Sebb,
>
>  Thank you for your quick reply.
>
>  I have tried the same JMeter script with Regular Expression. The problem
is
> Regular Expression is unable to read inner HTML code used to implement for
> AJAX technology in my application.
>
>  Please find below the full description of the problem faced with
> JMeter2.0.3:

This is rather old. Upgrade to 2.1.1.

> Solution Tried: Regular Expression
> Problem Faced:  JMeter is unable to read inner HTML which is used in AJAX
> implementation. [e.g. for reading auto-generated Folder Id on
the
> HTML] Page
> Outcome:            Regular Expression is unable to read inner HTML.

Why can't you extract the HTML?
What did you try?

> Solution Tried: Static Values for each virtual user using User Defined
> Variables.
> Problems Faced: 1. requires lot of efforts while working with more than 50
> Users.
>                    2. Dynamic features like Upload, Move can not have
> static             values.
> Outcome: It's hectic to use Static values for Load Testing

You can use the Counter test element for generating variable names.

> Solution Tried: Java Script [Used Defined Functions] for dynamic values.
> Problem Faced: JMeter is unable to read the Java Script as per mentioned
by
> you and Sebb.

True - perhaps create a Buzilla enhancement request to add this - e.g.
use a property to create a javascript initialisation file, as is
already done for BeanShell.

> Can you guide me about what can I do for the above problems for using
> JMeter?
> Will it be useful if I use Pearl Script instead of Java Script?

There is no Perl Script in JMeter.

You can use BeanShell; this supports user-defined methods etc.

However, if you are trying to emulate what a browser does when it
encounters JavaScript on a page, it won't help.

You need to find a way to extract the variable information from the
page without having to run the scripts that require access to the page
objects.

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


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


Re: Where to declare the java script with the help of function and how to call this function in JMeter

Posted by sebb <se...@gmail.com>.
On 25/04/06, Tapaswini Das <ta...@persistent.co.in> wrote:
> Hi Dave/Sebb,
>
>  Thank you for your quick reply.
>
>  I have tried the same JMeter script with Regular Expression. The problem is
> Regular Expression is unable to read inner HTML code used to implement for
> AJAX technology in my application.
>
>  Please find below the full description of the problem faced with
> JMeter2.0.3:

This is rather old. Upgrade to 2.1.1.

> Solution Tried: Regular Expression
> Problem Faced:  JMeter is unable to read inner HTML which is used in AJAX
> implementation. [e.g. for reading auto-generated Folder Id on           the
> HTML] Page
> Outcome:            Regular Expression is unable to read inner HTML.

Why can't you extract the HTML?
What did you try?

> Solution Tried: Static Values for each virtual user using User Defined
> Variables.
> Problems Faced: 1. requires lot of efforts while working with more than 50
> Users.
>                    2. Dynamic features like Upload, Move can not have
> static             values.
> Outcome: It's hectic to use Static values for Load Testing

You can use the Counter test element for generating variable names.

> Solution Tried: Java Script [Used Defined Functions] for dynamic values.
> Problem Faced: JMeter is unable to read the Java Script as per mentioned by
> you and Sebb.

True - perhaps create a Buzilla enhancement request to add this - e.g.
use a property to create a javascript initialisation file, as is
already done for BeanShell.

> Can you guide me about what can I do for the above problems for using
> JMeter?
> Will it be useful if I use Pearl Script instead of Java Script?

There is no Perl Script in JMeter.

You can use BeanShell; this supports user-defined methods etc.

However, if you are trying to emulate what a browser does when it
encounters JavaScript on a page, it won't help.

You need to find a way to extract the variable information from the
page without having to run the scripts that require access to the page
objects.

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


Re: Where to declare the java script with the help of function and how to call this function in JMeter

Posted by sebb <se...@gmail.com>.
On 21/04/06, David Bronner <db...@google.com> wrote:
> Sebb - those are all options for defining variables with a fixed value, but
> I want to keep assigning new values to them.  For example, in one of my
> scripts, I want to assign the unix epoch (seconds since 1970) into a
> variable once per loop.  Right now I'm doing it by sticking the javascript
> into the template field of a regex parser.  Can I do this using any of the
> options you listed?  I tried this using the User Defined Variables config
> element, but it doesn't seem that the javascript is getting evaluated on
> each loop if I put it in the Value column.

It will get re-evaluated if you use the User Parameters pre-processor.

> -Dave
>
> On 4/21/06, Tapaswini Das <ta...@persistent.co.in> wrote:
> >
> >
> > Hi,
> >
> > Could somebody explain how to use the new JavaScript function?
> > I'm writing my own Java Script functions to read inner HTML of the
> > application. I need to map these functions with JMeter so that JMeter can
> > call them while running. Or
> >
> > I can put all my functions into a single file and call them by any other
> > way? And if it is possible then in which way I'll call the functions?
> > In a way what's the mechanism JMeter uses to call the User Defined
> > Functions.
> >
> > Thanks & Regards,
> > Tapaswini
> >
> > -----Original Message-----
> > From: sebb [mailto:sebbaz@gmail.com]
> > Sent: Friday, April 21, 2006 2:07 PM
> > To: JMeter Users List
> > Subject: Re: Where to declare the java script with the help of function
> > and
> > how to call this function in JMeter
> >
> > It's not possible to define new javascript functions presently.
> >
> > Please explain WHAT you are trying to do, and then someone can help
> > with the HOW.
> >
> > S.
> > On 21/04/06, Tapaswini Das <ta...@persistent.co.in> wrote:
> > >
> > > Hi Dave,
> > >
> > >     Can you please tell me how to use this java script through inserting
> > > dummy regex parsers and assigning the JavaScript output where? Can you
> > > please tell me the flow "where n how to declare java script function and
> > > where write java script?"
> > > Please reply me its urgent.
> > >
> > > Thanks in Advanced
> > > Tapaswini
> > >
> > >
> > > -----Original Message-----
> > > From: David Bronner [mailto:dbronner@google.com]
> > > Sent: Thursday, April 20, 2006 10:05 PM
> > > To: JMeter Users List
> > > Subject: Re: Where to declare the java script with the help of function
> > and
> > > how to call this function in JMeter
> > >
> > > AFAIK, you can use javascript in almost any field with the syntax
> > > ${__javaScript()}    However, I have basically the same question...where
> > are
> > > we supposed to do assignments to variables with values generated by
> > > javascript?  I've been inserting dummy regex parsers and assigning the
> > > javascript output there, but it seems like there has to be a better way.
> > It
> > > would be great if there were a pre-processor that just assigned values
> > to
> > > variables.
> > >
> > > -Dave
> > >
> > > On 4/19/06, Tapaswini Das <ta...@persistent.co.in> wrote:
> > > >
> > > > Hi All,
> > > >
> > > >
> > > >
> > > >   I'm using JMeter 2.0.3 for Load testing.
> > > >
> > > > My Test case is to create a document through one user and before
> > uploading
> > > > the ppt the ID is created then after in file properties page upload
> > the
> > > > slides. Each user create different Document id which generated by the
> > > > application and showed in the http request of JMeter.
> > > >
> > > >
> > > >
> > > > I've JavaScript can any one tell me how I'll use these java scripts so
> > > > that
> > > > each user can create different document at a time by load script.
> > > >
> > > >
> > > >
> > > > "Where to declare the java script with the help of function and how to
> > > > call
> > > > this function in JMeter "
> > > >
> > > >
> > > >
> > > >
> > > >
> > > > Javascripts
> > > >
> > > >
> > > >
> > > > 1.function getTestForm(paneId, object){
> > > >
> > > >             var frms = document.forms;
> > > >
> > > >             for (var i=0;i<frms.length;i++) {
> > > >
> > > >                         var frm = frms[i];
> > > >
> > > >                         if (frm.name.indexOf(paneId) > - 1) {
> > > >
> > > >                                     if(object == 'folder') return
> > > > getFolderId(frm);
> > > >
> > > >                                     else if(object == 'component')
> > return
> > > > getComponentId(frm);
> > > >
> > > >                                     else if(object == 'document')
> > return
> > > > getDocumentId(frm);
> > > >
> > > >                         }
> > > >
> > > >             }
> > > >
> > > >             return null;
> > > >
> > > > }
> > > >
> > > >
> > > >
> > > > 2.function getFolderId(f){
> > > >
> > > >             if (f.folderId != null && f.folderId != 'undefined')
> > > >
> > > >                         return f.folderId.value;
> > > >
> > > >             else
> > > >
> > > >                         null;
> > > >
> > > > }
> > > >
> > > >
> > > >
> > > > 3.function getDocumentId(f){
> > > >
> > > >             if (f.documentId !=null && f.documentId != 'undefined')
> > > >
> > > >                         return f.documentId.value;
> > > >
> > > >             else
> > > >
> > > >                         null;
> > > >
> > > > }
> > > >
> > > >
> > > >
> > > > 4.function getComponentId(f){
> > > >
> > > >             if (f.componentId !=null && f.componentId != 'undefined')
> > > >
> > > >                         return f.componentId.value;
> > > >
> > > >             else
> > > >
> > > >                         null;
> > > >
> > > > }
> > > >
> > > >
> > > >
> > > >
> > > >
> > >
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
> > > For additional commands, e-mail: jmeter-user-help@jakarta.apache.org
> > >
> > >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: jmeter-user-help@jakarta.apache.org
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: jmeter-user-help@jakarta.apache.org
> >
> >
>
>

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


RE: Where to declare the java script with the help of function and how to call this function in JMeter

Posted by Tapaswini Das <ta...@persistent.co.in>.
Hi Dave/Sebb,

 Thank you for your quick reply.

 I have tried the same JMeter script with Regular Expression. The problem is
Regular Expression is unable to read inner HTML code used to implement for
AJAX technology in my application.

 Please find below the full description of the problem faced with
JMeter2.0.3:

Solution Tried: Regular Expression	
Problem Faced:  JMeter is unable to read inner HTML which is used in AJAX
implementation. [e.g. for reading auto-generated Folder Id on 		the
HTML] Page
Outcome:	    Regular Expression is unable to read inner HTML.

Solution Tried: Static Values for each virtual user using User Defined
Variables.
Problems Faced: 1. requires lot of efforts while working with more than 50
Users.
		    2. Dynamic features like Upload, Move can not have
static 		   values.	
Outcome: It's hectic to use Static values for Load Testing

Solution Tried: Java Script [Used Defined Functions] for dynamic values.
Problem Faced: JMeter is unable to read the Java Script as per mentioned by
you and Sebb. 

Can you guide me about what can I do for the above problems for using
JMeter?
Will it be useful if I use Pearl Script instead of Java Script?

It would be of great help to me and my project mates.

Thanks in advance,
Tapaswini

-----Original Message-----
From: David Bronner [mailto:dbronner@google.com] 
Sent: Friday, April 21, 2006 10:18 PM
To: JMeter Users List
Subject: Re: Where to declare the java script with the help of function and
how to call this function in JMeter

Hi Tapaswini,

I don't think you can evaluate the javascript that you're trying to run.
JMeter doesn't provide access to the HTML DOM.  However, you can probably
achieve the same result by using regular expression post processors to
search for string matches instead of parsing the HTML tags.

Sebb - those are all options for defining variables with a fixed value, but
I want to keep assigning new values to them.  For example, in one of my
scripts, I want to assign the unix epoch (seconds since 1970) into a
variable once per loop.  Right now I'm doing it by sticking the javascript
into the template field of a regex parser.  Can I do this using any of the
options you listed?  I tried this using the User Defined Variables config
element, but it doesn't seem that the javascript is getting evaluated on
each loop if I put it in the Value column.

-Dave

On 4/21/06, Tapaswini Das <ta...@persistent.co.in> wrote:
>
>
> Hi,
>
> Could somebody explain how to use the new JavaScript function?
> I'm writing my own Java Script functions to read inner HTML of the
> application. I need to map these functions with JMeter so that JMeter can
> call them while running. Or
>
> I can put all my functions into a single file and call them by any other
> way? And if it is possible then in which way I'll call the functions?
> In a way what's the mechanism JMeter uses to call the User Defined
> Functions.
>
> Thanks & Regards,
> Tapaswini
>
> -----Original Message-----
> From: sebb [mailto:sebbaz@gmail.com]
> Sent: Friday, April 21, 2006 2:07 PM
> To: JMeter Users List
> Subject: Re: Where to declare the java script with the help of function
> and
> how to call this function in JMeter
>
> It's not possible to define new javascript functions presently.
>
> Please explain WHAT you are trying to do, and then someone can help
> with the HOW.
>
> S.
> On 21/04/06, Tapaswini Das <ta...@persistent.co.in> wrote:
> >
> > Hi Dave,
> >
> >     Can you please tell me how to use this java script through inserting
> > dummy regex parsers and assigning the JavaScript output where? Can you
> > please tell me the flow "where n how to declare java script function and
> > where write java script?"
> > Please reply me its urgent.
> >
> > Thanks in Advanced
> > Tapaswini
> >
> >
> > -----Original Message-----
> > From: David Bronner [mailto:dbronner@google.com]
> > Sent: Thursday, April 20, 2006 10:05 PM
> > To: JMeter Users List
> > Subject: Re: Where to declare the java script with the help of function
> and
> > how to call this function in JMeter
> >
> > AFAIK, you can use javascript in almost any field with the syntax
> > ${__javaScript()}    However, I have basically the same question...where
> are
> > we supposed to do assignments to variables with values generated by
> > javascript?  I've been inserting dummy regex parsers and assigning the
> > javascript output there, but it seems like there has to be a better way.
> It
> > would be great if there were a pre-processor that just assigned values
> to
> > variables.
> >
> > -Dave
> >
> > On 4/19/06, Tapaswini Das <ta...@persistent.co.in> wrote:
> > >
> > > Hi All,
> > >
> > >
> > >
> > >   I'm using JMeter 2.0.3 for Load testing.
> > >
> > > My Test case is to create a document through one user and before
> uploading
> > > the ppt the ID is created then after in file properties page upload
> the
> > > slides. Each user create different Document id which generated by the
> > > application and showed in the http request of JMeter.
> > >
> > >
> > >
> > > I've JavaScript can any one tell me how I'll use these java scripts so
> > > that
> > > each user can create different document at a time by load script.
> > >
> > >
> > >
> > > "Where to declare the java script with the help of function and how to
> > > call
> > > this function in JMeter "
> > >
> > >
> > >
> > >
> > >
> > > Javascripts
> > >
> > >
> > >
> > > 1.function getTestForm(paneId, object){
> > >
> > >             var frms = document.forms;
> > >
> > >             for (var i=0;i<frms.length;i++) {
> > >
> > >                         var frm = frms[i];
> > >
> > >                         if (frm.name.indexOf(paneId) > - 1) {
> > >
> > >                                     if(object == 'folder') return
> > > getFolderId(frm);
> > >
> > >                                     else if(object == 'component')
> return
> > > getComponentId(frm);
> > >
> > >                                     else if(object == 'document')
> return
> > > getDocumentId(frm);
> > >
> > >                         }
> > >
> > >             }
> > >
> > >             return null;
> > >
> > > }
> > >
> > >
> > >
> > > 2.function getFolderId(f){
> > >
> > >             if (f.folderId != null && f.folderId != 'undefined')
> > >
> > >                         return f.folderId.value;
> > >
> > >             else
> > >
> > >                         null;
> > >
> > > }
> > >
> > >
> > >
> > > 3.function getDocumentId(f){
> > >
> > >             if (f.documentId !=null && f.documentId != 'undefined')
> > >
> > >                         return f.documentId.value;
> > >
> > >             else
> > >
> > >                         null;
> > >
> > > }
> > >
> > >
> > >
> > > 4.function getComponentId(f){
> > >
> > >             if (f.componentId !=null && f.componentId != 'undefined')
> > >
> > >                         return f.componentId.value;
> > >
> > >             else
> > >
> > >                         null;
> > >
> > > }
> > >
> > >
> > >
> > >
> > >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: jmeter-user-help@jakarta.apache.org
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: jmeter-user-help@jakarta.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: jmeter-user-help@jakarta.apache.org
>
>


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


Re: Where to declare the java script with the help of function and how to call this function in JMeter

Posted by David Bronner <db...@google.com>.
Hi Tapaswini,

I don't think you can evaluate the javascript that you're trying to run.
JMeter doesn't provide access to the HTML DOM.  However, you can probably
achieve the same result by using regular expression post processors to
search for string matches instead of parsing the HTML tags.

Sebb - those are all options for defining variables with a fixed value, but
I want to keep assigning new values to them.  For example, in one of my
scripts, I want to assign the unix epoch (seconds since 1970) into a
variable once per loop.  Right now I'm doing it by sticking the javascript
into the template field of a regex parser.  Can I do this using any of the
options you listed?  I tried this using the User Defined Variables config
element, but it doesn't seem that the javascript is getting evaluated on
each loop if I put it in the Value column.

-Dave

On 4/21/06, Tapaswini Das <ta...@persistent.co.in> wrote:
>
>
> Hi,
>
> Could somebody explain how to use the new JavaScript function?
> I'm writing my own Java Script functions to read inner HTML of the
> application. I need to map these functions with JMeter so that JMeter can
> call them while running. Or
>
> I can put all my functions into a single file and call them by any other
> way? And if it is possible then in which way I'll call the functions?
> In a way what's the mechanism JMeter uses to call the User Defined
> Functions.
>
> Thanks & Regards,
> Tapaswini
>
> -----Original Message-----
> From: sebb [mailto:sebbaz@gmail.com]
> Sent: Friday, April 21, 2006 2:07 PM
> To: JMeter Users List
> Subject: Re: Where to declare the java script with the help of function
> and
> how to call this function in JMeter
>
> It's not possible to define new javascript functions presently.
>
> Please explain WHAT you are trying to do, and then someone can help
> with the HOW.
>
> S.
> On 21/04/06, Tapaswini Das <ta...@persistent.co.in> wrote:
> >
> > Hi Dave,
> >
> >     Can you please tell me how to use this java script through inserting
> > dummy regex parsers and assigning the JavaScript output where? Can you
> > please tell me the flow "where n how to declare java script function and
> > where write java script?"
> > Please reply me its urgent.
> >
> > Thanks in Advanced
> > Tapaswini
> >
> >
> > -----Original Message-----
> > From: David Bronner [mailto:dbronner@google.com]
> > Sent: Thursday, April 20, 2006 10:05 PM
> > To: JMeter Users List
> > Subject: Re: Where to declare the java script with the help of function
> and
> > how to call this function in JMeter
> >
> > AFAIK, you can use javascript in almost any field with the syntax
> > ${__javaScript()}    However, I have basically the same question...where
> are
> > we supposed to do assignments to variables with values generated by
> > javascript?  I've been inserting dummy regex parsers and assigning the
> > javascript output there, but it seems like there has to be a better way.
> It
> > would be great if there were a pre-processor that just assigned values
> to
> > variables.
> >
> > -Dave
> >
> > On 4/19/06, Tapaswini Das <ta...@persistent.co.in> wrote:
> > >
> > > Hi All,
> > >
> > >
> > >
> > >   I'm using JMeter 2.0.3 for Load testing.
> > >
> > > My Test case is to create a document through one user and before
> uploading
> > > the ppt the ID is created then after in file properties page upload
> the
> > > slides. Each user create different Document id which generated by the
> > > application and showed in the http request of JMeter.
> > >
> > >
> > >
> > > I've JavaScript can any one tell me how I'll use these java scripts so
> > > that
> > > each user can create different document at a time by load script.
> > >
> > >
> > >
> > > "Where to declare the java script with the help of function and how to
> > > call
> > > this function in JMeter "
> > >
> > >
> > >
> > >
> > >
> > > Javascripts
> > >
> > >
> > >
> > > 1.function getTestForm(paneId, object){
> > >
> > >             var frms = document.forms;
> > >
> > >             for (var i=0;i<frms.length;i++) {
> > >
> > >                         var frm = frms[i];
> > >
> > >                         if (frm.name.indexOf(paneId) > - 1) {
> > >
> > >                                     if(object == 'folder') return
> > > getFolderId(frm);
> > >
> > >                                     else if(object == 'component')
> return
> > > getComponentId(frm);
> > >
> > >                                     else if(object == 'document')
> return
> > > getDocumentId(frm);
> > >
> > >                         }
> > >
> > >             }
> > >
> > >             return null;
> > >
> > > }
> > >
> > >
> > >
> > > 2.function getFolderId(f){
> > >
> > >             if (f.folderId != null && f.folderId != 'undefined')
> > >
> > >                         return f.folderId.value;
> > >
> > >             else
> > >
> > >                         null;
> > >
> > > }
> > >
> > >
> > >
> > > 3.function getDocumentId(f){
> > >
> > >             if (f.documentId !=null && f.documentId != 'undefined')
> > >
> > >                         return f.documentId.value;
> > >
> > >             else
> > >
> > >                         null;
> > >
> > > }
> > >
> > >
> > >
> > > 4.function getComponentId(f){
> > >
> > >             if (f.componentId !=null && f.componentId != 'undefined')
> > >
> > >                         return f.componentId.value;
> > >
> > >             else
> > >
> > >                         null;
> > >
> > > }
> > >
> > >
> > >
> > >
> > >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: jmeter-user-help@jakarta.apache.org
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: jmeter-user-help@jakarta.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: jmeter-user-help@jakarta.apache.org
>
>

RE: Where to declare the java script with the help of function and how to call this function in JMeter

Posted by Tapaswini Das <ta...@persistent.co.in>.
Hi,

 Could somebody explain how to use the new JavaScript function?
 I'm writing my own Java Script functions to read inner HTML of the
application. I need to map these functions with JMeter so that JMeter can
call them while running. Or

I can put all my functions into a single file and call them by any other
way? And if it is possible then in which way I'll call the functions?
 In a way what's the mechanism JMeter uses to call the User Defined
Functions.
 
 Thanks & Regards,
Tapaswini

-----Original Message-----
From: sebb [mailto:sebbaz@gmail.com] 
Sent: Friday, April 21, 2006 2:07 PM
To: JMeter Users List
Subject: Re: Where to declare the java script with the help of function and
how to call this function in JMeter

It's not possible to define new javascript functions presently.

Please explain WHAT you are trying to do, and then someone can help
with the HOW.

S.
On 21/04/06, Tapaswini Das <ta...@persistent.co.in> wrote:
>
> Hi Dave,
>
>     Can you please tell me how to use this java script through inserting
> dummy regex parsers and assigning the JavaScript output where? Can you
> please tell me the flow "where n how to declare java script function and
> where write java script?"
> Please reply me its urgent.
>
> Thanks in Advanced
> Tapaswini
>
>
> -----Original Message-----
> From: David Bronner [mailto:dbronner@google.com]
> Sent: Thursday, April 20, 2006 10:05 PM
> To: JMeter Users List
> Subject: Re: Where to declare the java script with the help of function
and
> how to call this function in JMeter
>
> AFAIK, you can use javascript in almost any field with the syntax
> ${__javaScript()}    However, I have basically the same question...where
are
> we supposed to do assignments to variables with values generated by
> javascript?  I've been inserting dummy regex parsers and assigning the
> javascript output there, but it seems like there has to be a better way.
It
> would be great if there were a pre-processor that just assigned values to
> variables.
>
> -Dave
>
> On 4/19/06, Tapaswini Das <ta...@persistent.co.in> wrote:
> >
> > Hi All,
> >
> >
> >
> >   I'm using JMeter 2.0.3 for Load testing.
> >
> > My Test case is to create a document through one user and before
uploading
> > the ppt the ID is created then after in file properties page upload the
> > slides. Each user create different Document id which generated by the
> > application and showed in the http request of JMeter.
> >
> >
> >
> > I've JavaScript can any one tell me how I'll use these java scripts so
> > that
> > each user can create different document at a time by load script.
> >
> >
> >
> > "Where to declare the java script with the help of function and how to
> > call
> > this function in JMeter "
> >
> >
> >
> >
> >
> > Javascripts
> >
> >
> >
> > 1.function getTestForm(paneId, object){
> >
> >             var frms = document.forms;
> >
> >             for (var i=0;i<frms.length;i++) {
> >
> >                         var frm = frms[i];
> >
> >                         if (frm.name.indexOf(paneId) > - 1) {
> >
> >                                     if(object == 'folder') return
> > getFolderId(frm);
> >
> >                                     else if(object == 'component')
return
> > getComponentId(frm);
> >
> >                                     else if(object == 'document') return
> > getDocumentId(frm);
> >
> >                         }
> >
> >             }
> >
> >             return null;
> >
> > }
> >
> >
> >
> > 2.function getFolderId(f){
> >
> >             if (f.folderId != null && f.folderId != 'undefined')
> >
> >                         return f.folderId.value;
> >
> >             else
> >
> >                         null;
> >
> > }
> >
> >
> >
> > 3.function getDocumentId(f){
> >
> >             if (f.documentId !=null && f.documentId != 'undefined')
> >
> >                         return f.documentId.value;
> >
> >             else
> >
> >                         null;
> >
> > }
> >
> >
> >
> > 4.function getComponentId(f){
> >
> >             if (f.componentId !=null && f.componentId != 'undefined')
> >
> >                         return f.componentId.value;
> >
> >             else
> >
> >                         null;
> >
> > }
> >
> >
> >
> >
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: jmeter-user-help@jakarta.apache.org
>
>

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


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


Re: Where to declare the java script with the help of function and how to call this function in JMeter

Posted by sebb <se...@gmail.com>.
It's not possible to define new javascript functions presently.

Please explain WHAT you are trying to do, and then someone can help
with the HOW.

S.
On 21/04/06, Tapaswini Das <ta...@persistent.co.in> wrote:
>
> Hi Dave,
>
>     Can you please tell me how to use this java script through inserting
> dummy regex parsers and assigning the JavaScript output where? Can you
> please tell me the flow "where n how to declare java script function and
> where write java script?"
> Please reply me its urgent.
>
> Thanks in Advanced
> Tapaswini
>
>
> -----Original Message-----
> From: David Bronner [mailto:dbronner@google.com]
> Sent: Thursday, April 20, 2006 10:05 PM
> To: JMeter Users List
> Subject: Re: Where to declare the java script with the help of function and
> how to call this function in JMeter
>
> AFAIK, you can use javascript in almost any field with the syntax
> ${__javaScript()}    However, I have basically the same question...where are
> we supposed to do assignments to variables with values generated by
> javascript?  I've been inserting dummy regex parsers and assigning the
> javascript output there, but it seems like there has to be a better way.  It
> would be great if there were a pre-processor that just assigned values to
> variables.
>
> -Dave
>
> On 4/19/06, Tapaswini Das <ta...@persistent.co.in> wrote:
> >
> > Hi All,
> >
> >
> >
> >   I'm using JMeter 2.0.3 for Load testing.
> >
> > My Test case is to create a document through one user and before uploading
> > the ppt the ID is created then after in file properties page upload the
> > slides. Each user create different Document id which generated by the
> > application and showed in the http request of JMeter.
> >
> >
> >
> > I've JavaScript can any one tell me how I'll use these java scripts so
> > that
> > each user can create different document at a time by load script.
> >
> >
> >
> > "Where to declare the java script with the help of function and how to
> > call
> > this function in JMeter "
> >
> >
> >
> >
> >
> > Javascripts
> >
> >
> >
> > 1.function getTestForm(paneId, object){
> >
> >             var frms = document.forms;
> >
> >             for (var i=0;i<frms.length;i++) {
> >
> >                         var frm = frms[i];
> >
> >                         if (frm.name.indexOf(paneId) > - 1) {
> >
> >                                     if(object == 'folder') return
> > getFolderId(frm);
> >
> >                                     else if(object == 'component') return
> > getComponentId(frm);
> >
> >                                     else if(object == 'document') return
> > getDocumentId(frm);
> >
> >                         }
> >
> >             }
> >
> >             return null;
> >
> > }
> >
> >
> >
> > 2.function getFolderId(f){
> >
> >             if (f.folderId != null && f.folderId != 'undefined')
> >
> >                         return f.folderId.value;
> >
> >             else
> >
> >                         null;
> >
> > }
> >
> >
> >
> > 3.function getDocumentId(f){
> >
> >             if (f.documentId !=null && f.documentId != 'undefined')
> >
> >                         return f.documentId.value;
> >
> >             else
> >
> >                         null;
> >
> > }
> >
> >
> >
> > 4.function getComponentId(f){
> >
> >             if (f.componentId !=null && f.componentId != 'undefined')
> >
> >                         return f.componentId.value;
> >
> >             else
> >
> >                         null;
> >
> > }
> >
> >
> >
> >
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: jmeter-user-help@jakarta.apache.org
>
>

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


Re: Where to declare the java script with the help of function and how to call this function in JMeter

Posted by sebb <se...@gmail.com>.
You can define variables using:

* The Test Plan
* User Defined Variables Config item
* CSV Data Set Config Item
* User Parameters Pre-Processor

S.
On 20/04/06, David Bronner <db...@google.com> wrote:
> AFAIK, you can use javascript in almost any field with the syntax
> ${__javaScript()}    However, I have basically the same question...where are
> we supposed to do assignments to variables with values generated by
> javascript?  I've been inserting dummy regex parsers and assigning the
> javascript output there, but it seems like there has to be a better way.  It
> would be great if there were a pre-processor that just assigned values to
> variables.
>
> -Dave
>
> On 4/19/06, Tapaswini Das <ta...@persistent.co.in> wrote:
> >
> > Hi All,
> >
> >
> >
> >   I'm using JMeter 2.0.3 for Load testing.
> >
> > My Test case is to create a document through one user and before uploading
> > the ppt the ID is created then after in file properties page upload the
> > slides. Each user create different Document id which generated by the
> > application and showed in the http request of JMeter.
> >
> >
> >
> > I've JavaScript can any one tell me how I'll use these java scripts so
> > that
> > each user can create different document at a time by load script.
> >
> >
> >
> > "Where to declare the java script with the help of function and how to
> > call
> > this function in JMeter "
> >
> >
> >
> >
> >
> > Javascripts
> >
> >
> >
> > 1.function getTestForm(paneId, object){
> >
> >             var frms = document.forms;
> >
> >             for (var i=0;i<frms.length;i++) {
> >
> >                         var frm = frms[i];
> >
> >                         if (frm.name.indexOf(paneId) > - 1) {
> >
> >                                     if(object == 'folder') return
> > getFolderId(frm);
> >
> >                                     else if(object == 'component') return
> > getComponentId(frm);
> >
> >                                     else if(object == 'document') return
> > getDocumentId(frm);
> >
> >                         }
> >
> >             }
> >
> >             return null;
> >
> > }
> >
> >
> >
> > 2.function getFolderId(f){
> >
> >             if (f.folderId != null && f.folderId != 'undefined')
> >
> >                         return f.folderId.value;
> >
> >             else
> >
> >                         null;
> >
> > }
> >
> >
> >
> > 3.function getDocumentId(f){
> >
> >             if (f.documentId !=null && f.documentId != 'undefined')
> >
> >                         return f.documentId.value;
> >
> >             else
> >
> >                         null;
> >
> > }
> >
> >
> >
> > 4.function getComponentId(f){
> >
> >             if (f.componentId !=null && f.componentId != 'undefined')
> >
> >                         return f.componentId.value;
> >
> >             else
> >
> >                         null;
> >
> > }
> >
> >
> >
> >
> >
>
>

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


RE: Where to declare the java script with the help of function and how to call this function in JMeter

Posted by Tapaswini Das <ta...@persistent.co.in>.
Hi Dave,

    Can you please tell me how to use this java script through inserting
dummy regex parsers and assigning the JavaScript output where? Can you
please tell me the flow "where n how to declare java script function and
where write java script?"
Please reply me its urgent.

Thanks in Advanced
Tapaswini 


-----Original Message-----
From: David Bronner [mailto:dbronner@google.com] 
Sent: Thursday, April 20, 2006 10:05 PM
To: JMeter Users List
Subject: Re: Where to declare the java script with the help of function and
how to call this function in JMeter

AFAIK, you can use javascript in almost any field with the syntax
${__javaScript()}    However, I have basically the same question...where are
we supposed to do assignments to variables with values generated by
javascript?  I've been inserting dummy regex parsers and assigning the
javascript output there, but it seems like there has to be a better way.  It
would be great if there were a pre-processor that just assigned values to
variables.

-Dave

On 4/19/06, Tapaswini Das <ta...@persistent.co.in> wrote:
>
> Hi All,
>
>
>
>   I'm using JMeter 2.0.3 for Load testing.
>
> My Test case is to create a document through one user and before uploading
> the ppt the ID is created then after in file properties page upload the
> slides. Each user create different Document id which generated by the
> application and showed in the http request of JMeter.
>
>
>
> I've JavaScript can any one tell me how I'll use these java scripts so
> that
> each user can create different document at a time by load script.
>
>
>
> "Where to declare the java script with the help of function and how to
> call
> this function in JMeter "
>
>
>
>
>
> Javascripts
>
>
>
> 1.function getTestForm(paneId, object){
>
>             var frms = document.forms;
>
>             for (var i=0;i<frms.length;i++) {
>
>                         var frm = frms[i];
>
>                         if (frm.name.indexOf(paneId) > - 1) {
>
>                                     if(object == 'folder') return
> getFolderId(frm);
>
>                                     else if(object == 'component') return
> getComponentId(frm);
>
>                                     else if(object == 'document') return
> getDocumentId(frm);
>
>                         }
>
>             }
>
>             return null;
>
> }
>
>
>
> 2.function getFolderId(f){
>
>             if (f.folderId != null && f.folderId != 'undefined')
>
>                         return f.folderId.value;
>
>             else
>
>                         null;
>
> }
>
>
>
> 3.function getDocumentId(f){
>
>             if (f.documentId !=null && f.documentId != 'undefined')
>
>                         return f.documentId.value;
>
>             else
>
>                         null;
>
> }
>
>
>
> 4.function getComponentId(f){
>
>             if (f.componentId !=null && f.componentId != 'undefined')
>
>                         return f.componentId.value;
>
>             else
>
>                         null;
>
> }
>
>
>
>
>


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