Thanks a lot Now its working by using esacpe function of javascript.

/search?q=${__javaScript(escape(vars.get("abc"));)}


But incase my parameter value caontain email address then it store @ but
this can not be worked by esacpe function  for this i have to use
encodeURIComponent function.
is any  other method like jmeter table option encoding that i can use so
that no to worry abt java script function change as per parameters value.
means one function will support all type parameters encoding with all
special charactors

q=${__javaScript(
encodeURIComponent(vars.get("abc"));)}


On Thu, Jan 20, 2011 at 8:11 AM, sebb <[email protected]> wrote:

> On 20 January 2011 06:09, Rajiv Nanduani <[email protected]>
> wrote:
> > Hi all,
> >
> > In jmeter i have to pass around 15 to 20 url parameters from csv file . I
> am
> > using the javascript function to encoding the url parameters I am not
> using
> > the Jmeter send parameter with request table option. there is also option
> > aviable to encode the parameters.
> >
> > Here problem is that when ever my parameter value hassingle quote that
> time
> > it is not working means Jmeter doen not run the script
> >
> > like my valriable   abc = 'rajiv'
> >
> > then i am sending abc value in request by using javascript function
> >
> > /search?q=${__javaScript(encodeURIComponent('${abc}');)}
> >
> > it is working fine if my value does not contain single quote
>
> Yes, this is because the variable reference ${abc} is replaced by
> JMeter before it sends the parameter to the function.
> So the parameter ends up with an embedded quote which is invalid
> syntax for a quoted string.
>
> You will need to use vars.get("abc") instead - i.e. try
>
> /search?q=${__javaScript(encodeURIComponent(vars.get("abc"));)}
>
> > I am getting this error  in jmeter log file
> >
> > 2011/01/20 01:07:29 INFO  - jmeter.engine.StandardJMeterEngine: Running
> the
> > test!
> > 2011/01/20 01:07:29 ERROR - jmeter.engine.StandardJMeterEngine: Uncaught
> > exception:  org.mozilla.javascript.EvaluatorException: missing ) after
> > argument list (<cmd>#1)
> >    at
> >
> org.mozilla.javascript.DefaultErrorReporter.runtimeError(DefaultErrorReporter.java:98)
> >    at
> >
> org.mozilla.javascript.DefaultErrorReporter.error(DefaultErrorReporter.java:85)
> >    at org.mozilla.javascript.Parser.addError(Parser.java:126)
> >    at org.mozilla.javascript.Parser.reportError(Parser.java:132)
> >    at org.mozilla.javascript.Parser.mustMatchToken(Parser.java:218)
> >    at org.mozilla.javascript.Parser.argumentList(Parser.java:1599)
> >    at org.mozilla.javascript.Parser.memberExprTail(Parser.java:1729)
> >    at org.mozilla.javascript.Parser.memberExpr(Parser.java:1644)
> >    at org.mozilla.javascript.Parser.unaryExpr(Parser.java:1507)
> >    at org.mozilla.javascript.Parser.mulExpr(Parser.java:1436)
> >    at org.mozilla.javascript.Parser.addExpr(Parser.java:1417)
> >    at org.mozilla.javascript.Parser.shiftExpr(Parser.java:1397)
> >    at org.mozilla.javascript.Parser.relExpr(Parser.java:1371)
> >    at org.mozilla.javascript.Parser.eqExpr(Parser.java:1327)
> >    at org.mozilla.javascript.Parser.bitAndExpr(Parser.java:1316)
> >    at org.mozilla.javascript.Parser.bitXorExpr(Parser.java:1305)
> >    at org.mozilla.javascript.Parser.bitOrExpr(Parser.java:1294)
> >    at org.mozilla.javascript.Parser.andExpr(Parser.java:1282)
> >    at org.mozilla.javascript.Parser.orExpr(Parser.java:1270)
> >    at org.mozilla.javascript.Parser.condExpr(Parser.java:1253)
> >    at org.mozilla.javascript.Parser.assignExpr(Parser.java:1235)
> >    at org.mozilla.javascript.Parser.expr(Parser.java:1224)
> >    at org.mozilla.javascript.Parser.statementHelper(Parser.java:1111)
> >    at org.mozilla.javascript.Parser.statement(Parser.java:623)
> >    at org.mozilla.javascript.Parser.parse(Parser.java:355)
> >    at org.mozilla.javascript.Parser.parse(Parser.java:293)
> >    at org.mozilla.javascript.Context.compileImpl(Context.java:2238)
> >    at org.mozilla.javascript.Context.compileString(Context.java:1284)
> >    at org.mozilla.javascript.Context.compileString(Context.java:1273)
> >    at org.mozilla.javascript.Context.evaluateString(Context.java:1129)
> >    at org.apache.jmeter.functions.JavaScript.execute(JavaScript.java:89)
> >    at
> >
> org.apache.jmeter.engine.util.CompoundVariable.execute(CompoundVariable.java:143)
> >    at
> >
> org.apache.jmeter.engine.util.CompoundVariable.execute(CompoundVariable.java:112)
> >    at
> >
> org.apache.jmeter.testelement.property.FunctionProperty.getStringValue(FunctionProperty.java:80)
> >    at
> >
> org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase.testStarted(HTTPSamplerBase.java:1256)
> >    at
> >
> org.apache.jmeter.engine.StandardJMeterEngine.notifyTestListenersOfStart(StandardJMeterEngine.java:275)
> >    at
> >
> org.apache.jmeter.engine.StandardJMeterEngine.run(StandardJMeterEngine.java:413)
> >    at java.lang.Thread.run(Unknown Source)
> >
> > --
> > RAJIV KUMAR
> >
> > <http://rajivkumarnandvani.wordpress.com/>
> > <http://learnqtphelp.blogspot.com/>
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
>


-- 
RAJIV KUMAR

<http://rajivkumarnandvani.wordpress.com/>
<http://learnqtphelp.blogspot.com/>

Reply via email to