You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@jmeter.apache.org by Jörg Godau <J....@schuetze-berlin.de> on 2010/07/26 14:08:15 UTC
If Controller after Regular Expression
Hello All,
we have a Regular Expression Extractor hat is supposed to find an ID out of the loaded page. This works (unless there is no ID on the page) which is the correct behaviour.
We then want to open the record pointed to by the ID we found iff we actually found a record.
So in the regular expression extractor we put
Reference Name:aktenzeichen
Regular expression:familie\.do\?id=(\d+)
Template:$1$
Match No.:0
Default value:NoAzFound
And in the If Controller we have the condition
${aktenzeichen} != 'NoAzFound'
I've tried with double quotes, single quotes, no quotes and always get errors like this in the log:
2010/07/26 12:16:55 ERROR - jmeter.control.IfController: ReferenceError: "NoAzFound" is not defined. (<cmd>#1) org.mozilla.javascript.EcmaError: ReferenceError: "NoAzFound" is not defined. (<cmd>#1)
at org.mozilla.javascript.ScriptRuntime.constructError(ScriptRuntime.java:3229)
at org.mozilla.javascript.ScriptRuntime.constructError(ScriptRuntime.java:3219)
at org.mozilla.javascript.ScriptRuntime.notFoundError(ScriptRuntime.java:3292)
at org.mozilla.javascript.ScriptRuntime.name(ScriptRuntime.java:1570)
at org.mozilla.javascript.gen.c2._c0(<cmd>:1)
at org.mozilla.javascript.gen.c2.call(<cmd>)
at org.mozilla.javascript.ContextFactory.doTopCall(ContextFactory.java:340)
at org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:2758)
at org.mozilla.javascript.gen.c2.call(<cmd>)
at org.mozilla.javascript.gen.c2.exec(<cmd>)
at org.mozilla.javascript.Context.evaluateString(Context.java:1132)
at org.apache.jmeter.control.IfController.evaluateCondition(IfController.java:105)
at org.apache.jmeter.control.IfController.next(IfController.java:162)
at org.apache.jmeter.control.GenericController.nextIsAController(GenericController.java:184)
at org.apache.jmeter.control.GenericController.next(GenericController.java:148)
at org.apache.jmeter.control.GenericController.nextIsAController(GenericController.java:184)
at org.apache.jmeter.control.GenericController.next(GenericController.java:148)
at org.apache.jmeter.control.LoopController.next(LoopController.java:108)
at org.apache.jmeter.threads.AbstractThreadGroup.next(AbstractThreadGroup.java:72)
at org.apache.jmeter.threads.JMeterThread.run(JMeterThread.java:242)
at java.lang.Thread.run(Thread.java:619)
What am I doing wrong?
Mit freundlichen Grüßen
Jörg Godau
SCHÜTZE Consulting Informationssysteme GmbH Argentinische Allee 22b
14163 Berlin
Tel.: 030/ 802 49 44
Fax: 030/ 8090 39 95
www.schuetze-berlin.de
Geschäftsführer: Klaus-Dieter Schütze
Registergericht: Amtsgericht Charlottenburg
Registernummer: HRB 73618
Umsatzsteuer-Identifikationsnummer gemäß § 27a Umsatzsteuergesetz: DE 813181239
---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jmeter-user-help@jakarta.apache.org
Re: If Controller after Regular Expression
Posted by sebb <se...@gmail.com>.
The quotes are necessary because JMeter variable references are
replaced with their values.
i.e.
${aktenzeichen} != 'NoAzFound'
becomes
NoAzFound != 'NoAzFound'
which is not valid Javascript
On 27 July 2010 08:33, Jörg Godau <J....@schuetze-berlin.de> wrote:
> Thanks Karsten, that statement works!
>
> !("${aktenzeichen}".equals("NoAzFound"))
>
> Mit freundlichen Grüßen
> Jörg Godau
>
> SCHÜTZE Consulting Informationssysteme GmbH Argentinische Allee 22b
> 14163 Berlin
> Tel.: 030/ 802 49 44
> Fax: 030/ 8090 39 95
> www.schuetze-berlin.de
>
> Geschäftsführer: Klaus-Dieter Schütze
> Registergericht: Amtsgericht Charlottenburg
> Registernummer: HRB 73618
> Umsatzsteuer-Identifikationsnummer gemäß § 27a Umsatzsteuergesetz: DE 813181239
>
>
>> -----Ursprüngliche Nachricht-----
>> Von: Karsten Gaul [mailto:karsten.gaul@exedio.com]
>> Gesendet: Montag, 26. Juli 2010 14:20
>> An: JMeter Users List
>> Betreff: Re: If Controller after Regular Expression
>>
>> Hi Jörg,
>>
>> you may want to try the following:
>>
>> !("${aktenzeichen}".equals("NoAzFound"))
>>
>> This works fine in my test plan. You need to put the variable in double
>> quotes.
>>
>> rgds
>> Karsten
>>
>> Am 26.07.2010 14:08, schrieb Jörg Godau:
>> > Hello All,
>> >
>> > we have a Regular Expression Extractor hat is supposed to find an ID
>> out of the loaded page. This works (unless there is no ID on the page)
>> which is the correct behaviour.
>> >
>> > We then want to open the record pointed to by the ID we found iff we
>> actually found a record.
>> >
>> > So in the regular expression extractor we put
>> > Reference Name:aktenzeichen
>> > Regular expression:familie\.do\?id=(\d+)
>> > Template:$1$
>> > Match No.:0
>> > Default value:NoAzFound
>> >
>> > And in the If Controller we have the condition
>> > ${aktenzeichen} != 'NoAzFound'
>> >
>> > I've tried with double quotes, single quotes, no quotes and always
>> get errors like this in the log:
>> >
>> > 2010/07/26 12:16:55 ERROR - jmeter.control.IfController:
>> ReferenceError: "NoAzFound" is not defined. (<cmd>#1)
>> org.mozilla.javascript.EcmaError: ReferenceError: "NoAzFound" is not
>> defined. (<cmd>#1)
>> > at
>> org.mozilla.javascript.ScriptRuntime.constructError(ScriptRuntime.java:
>> 3229)
>> > at
>> org.mozilla.javascript.ScriptRuntime.constructError(ScriptRuntime.java:
>> 3219)
>> > at
>> org.mozilla.javascript.ScriptRuntime.notFoundError(ScriptRuntime.java:3
>> 292)
>> > at
>> org.mozilla.javascript.ScriptRuntime.name(ScriptRuntime.java:1570)
>> > at org.mozilla.javascript.gen.c2._c0(<cmd>:1)
>> > at org.mozilla.javascript.gen.c2.call(<cmd>)
>> > at
>> org.mozilla.javascript.ContextFactory.doTopCall(ContextFactory.java:340
>> )
>> > at
>> org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:2758)
>> > at org.mozilla.javascript.gen.c2.call(<cmd>)
>> > at org.mozilla.javascript.gen.c2.exec(<cmd>)
>> > at
>> org.mozilla.javascript.Context.evaluateString(Context.java:1132)
>> > at
>> org.apache.jmeter.control.IfController.evaluateCondition(IfController.j
>> ava:105)
>> > at
>> org.apache.jmeter.control.IfController.next(IfController.java:162)
>> > at
>> org.apache.jmeter.control.GenericController.nextIsAController(GenericCo
>> ntroller.java:184)
>> > at
>> org.apache.jmeter.control.GenericController.next(GenericController.java
>> :148)
>> > at
>> org.apache.jmeter.control.GenericController.nextIsAController(GenericCo
>> ntroller.java:184)
>> > at
>> org.apache.jmeter.control.GenericController.next(GenericController.java
>> :148)
>> > at
>> org.apache.jmeter.control.LoopController.next(LoopController.java:108)
>> > at
>> org.apache.jmeter.threads.AbstractThreadGroup.next(AbstractThreadGroup.
>> java:72)
>> > at
>> org.apache.jmeter.threads.JMeterThread.run(JMeterThread.java:242)
>> > at java.lang.Thread.run(Thread.java:619)
>> >
>> > What am I doing wrong?
>> >
>> >
>> >
>> >
>> > Mit freundlichen Grüßen
>> > Jörg Godau
>> >
>> > SCHÜTZE Consulting Informationssysteme GmbH Argentinische Allee 22b
>> > 14163 Berlin
>> > Tel.: 030/ 802 49 44
>> > Fax: 030/ 8090 39 95
>> > www.schuetze-berlin.de
>> >
>> > Geschäftsführer: Klaus-Dieter Schütze
>> > Registergericht: Amtsgericht Charlottenburg
>> > Registernummer: HRB 73618
>> > Umsatzsteuer-Identifikationsnummer gemäß § 27a Umsatzsteuergesetz: DE
>> 813181239
>> >
>> >
>> >
>> > ---------------------------------------------------------------------
>> > 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
AW: If Controller after Regular Expression
Posted by Jörg Godau <J....@schuetze-berlin.de>.
Thanks Karsten, that statement works!
!("${aktenzeichen}".equals("NoAzFound"))
Mit freundlichen Grüßen
Jörg Godau
SCHÜTZE Consulting Informationssysteme GmbH Argentinische Allee 22b
14163 Berlin
Tel.: 030/ 802 49 44
Fax: 030/ 8090 39 95
www.schuetze-berlin.de
Geschäftsführer: Klaus-Dieter Schütze
Registergericht: Amtsgericht Charlottenburg
Registernummer: HRB 73618
Umsatzsteuer-Identifikationsnummer gemäß § 27a Umsatzsteuergesetz: DE 813181239
> -----Ursprüngliche Nachricht-----
> Von: Karsten Gaul [mailto:karsten.gaul@exedio.com]
> Gesendet: Montag, 26. Juli 2010 14:20
> An: JMeter Users List
> Betreff: Re: If Controller after Regular Expression
>
> Hi Jörg,
>
> you may want to try the following:
>
> !("${aktenzeichen}".equals("NoAzFound"))
>
> This works fine in my test plan. You need to put the variable in double
> quotes.
>
> rgds
> Karsten
>
> Am 26.07.2010 14:08, schrieb Jörg Godau:
> > Hello All,
> >
> > we have a Regular Expression Extractor hat is supposed to find an ID
> out of the loaded page. This works (unless there is no ID on the page)
> which is the correct behaviour.
> >
> > We then want to open the record pointed to by the ID we found iff we
> actually found a record.
> >
> > So in the regular expression extractor we put
> > Reference Name:aktenzeichen
> > Regular expression:familie\.do\?id=(\d+)
> > Template:$1$
> > Match No.:0
> > Default value:NoAzFound
> >
> > And in the If Controller we have the condition
> > ${aktenzeichen} != 'NoAzFound'
> >
> > I've tried with double quotes, single quotes, no quotes and always
> get errors like this in the log:
> >
> > 2010/07/26 12:16:55 ERROR - jmeter.control.IfController:
> ReferenceError: "NoAzFound" is not defined. (<cmd>#1)
> org.mozilla.javascript.EcmaError: ReferenceError: "NoAzFound" is not
> defined. (<cmd>#1)
> > at
> org.mozilla.javascript.ScriptRuntime.constructError(ScriptRuntime.java:
> 3229)
> > at
> org.mozilla.javascript.ScriptRuntime.constructError(ScriptRuntime.java:
> 3219)
> > at
> org.mozilla.javascript.ScriptRuntime.notFoundError(ScriptRuntime.java:3
> 292)
> > at
> org.mozilla.javascript.ScriptRuntime.name(ScriptRuntime.java:1570)
> > at org.mozilla.javascript.gen.c2._c0(<cmd>:1)
> > at org.mozilla.javascript.gen.c2.call(<cmd>)
> > at
> org.mozilla.javascript.ContextFactory.doTopCall(ContextFactory.java:340
> )
> > at
> org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:2758)
> > at org.mozilla.javascript.gen.c2.call(<cmd>)
> > at org.mozilla.javascript.gen.c2.exec(<cmd>)
> > at
> org.mozilla.javascript.Context.evaluateString(Context.java:1132)
> > at
> org.apache.jmeter.control.IfController.evaluateCondition(IfController.j
> ava:105)
> > at
> org.apache.jmeter.control.IfController.next(IfController.java:162)
> > at
> org.apache.jmeter.control.GenericController.nextIsAController(GenericCo
> ntroller.java:184)
> > at
> org.apache.jmeter.control.GenericController.next(GenericController.java
> :148)
> > at
> org.apache.jmeter.control.GenericController.nextIsAController(GenericCo
> ntroller.java:184)
> > at
> org.apache.jmeter.control.GenericController.next(GenericController.java
> :148)
> > at
> org.apache.jmeter.control.LoopController.next(LoopController.java:108)
> > at
> org.apache.jmeter.threads.AbstractThreadGroup.next(AbstractThreadGroup.
> java:72)
> > at
> org.apache.jmeter.threads.JMeterThread.run(JMeterThread.java:242)
> > at java.lang.Thread.run(Thread.java:619)
> >
> > What am I doing wrong?
> >
> >
> >
> >
> > Mit freundlichen Grüßen
> > Jörg Godau
> >
> > SCHÜTZE Consulting Informationssysteme GmbH Argentinische Allee 22b
> > 14163 Berlin
> > Tel.: 030/ 802 49 44
> > Fax: 030/ 8090 39 95
> > www.schuetze-berlin.de
> >
> > Geschäftsführer: Klaus-Dieter Schütze
> > Registergericht: Amtsgericht Charlottenburg
> > Registernummer: HRB 73618
> > Umsatzsteuer-Identifikationsnummer gemäß § 27a Umsatzsteuergesetz: DE
> 813181239
> >
> >
> >
> > ---------------------------------------------------------------------
> > 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: If Controller after Regular Expression
Posted by Felix Frank <ff...@mpexnet.de>.
I remember having problems with that syntax as well, in the same context
no less.
I resorted to ${var}.indexOf("other"), which is crude, but would suffice
for this use case, too.
Cheers,
Felix
On 07/26/2010 03:22 PM, Noel O'Brien wrote:
> This should also work, as I use it in my test plans:
>
> "${aktenzeichen}" != "NoAzFound"
---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jmeter-user-help@jakarta.apache.org
Re: If Controller after Regular Expression
Posted by Noel O'Brien <no...@newbay.com>.
This should also work, as I use it in my test plans:
"${aktenzeichen}" != "NoAzFound"
Regards,
Noel
----- "Karsten Gaul" <ka...@exedio.com> wrote:
> Hi Jörg,
>
> you may want to try the following:
>
> !("${aktenzeichen}".equals("NoAzFound"))
>
> This works fine in my test plan. You need to put the variable in double
> quotes.
>
> rgds
> Karsten
>
> Am 26.07.2010 14:08, schrieb Jörg Godau:
> > Hello All,
> >
> > we have a Regular Expression Extractor hat is supposed to find an ID out of the loaded page. This works (unless there is no ID on the page) which is the correct behaviour.
> >
> > We then want to open the record pointed to by the ID we found iff we actually found a record.
> >
> > So in the regular expression extractor we put
> > Reference Name:aktenzeichen
> > Regular expression:familie\.do\?id=(\d+)
> > Template:$1$
> > Match No.:0
> > Default value:NoAzFound
> >
> > And in the If Controller we have the condition
> > ${aktenzeichen} != 'NoAzFound'
> >
> > I've tried with double quotes, single quotes, no quotes and always get errors like this in the log:
> >
> > 2010/07/26 12:16:55 ERROR - jmeter.control.IfController: ReferenceError: "NoAzFound" is not defined. (<cmd>#1) org.mozilla.javascript.EcmaError: ReferenceError: "NoAzFound" is not defined. (<cmd>#1)
> > at org.mozilla.javascript.ScriptRuntime.constructError(ScriptRuntime.java:3229)
> > at org.mozilla.javascript.ScriptRuntime.constructError(ScriptRuntime.java:3219)
> > at org.mozilla.javascript.ScriptRuntime.notFoundError(ScriptRuntime.java:3292)
> > at org.mozilla.javascript.ScriptRuntime.name(ScriptRuntime.java:1570)
> > at org.mozilla.javascript.gen.c2._c0(<cmd>:1)
> > at org.mozilla.javascript.gen.c2.call(<cmd>)
> > at org.mozilla.javascript.ContextFactory.doTopCall(ContextFactory.java:340)
> > at org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:2758)
> > at org.mozilla.javascript.gen.c2.call(<cmd>)
> > at org.mozilla.javascript.gen.c2.exec(<cmd>)
> > at org.mozilla.javascript.Context.evaluateString(Context.java:1132)
> > at org.apache.jmeter.control.IfController.evaluateCondition(IfController.java:105)
> > at org.apache.jmeter.control.IfController.next(IfController.java:162)
> > at org.apache.jmeter.control.GenericController.nextIsAController(GenericController.java:184)
> > at org.apache.jmeter.control.GenericController.next(GenericController.java:148)
> > at org.apache.jmeter.control.GenericController.nextIsAController(GenericController.java:184)
> > at org.apache.jmeter.control.GenericController.next(GenericController.java:148)
> > at org.apache.jmeter.control.LoopController.next(LoopController.java:108)
> > at org.apache.jmeter.threads.AbstractThreadGroup.next(AbstractThreadGroup.java:72)
> > at org.apache.jmeter.threads.JMeterThread.run(JMeterThread.java:242)
> > at java.lang.Thread.run(Thread.java:619)
> >
> > What am I doing wrong?
> >
> >
> >
> >
> > Mit freundlichen Grüßen
> > Jörg Godau
> >
> > SCHÜTZE Consulting Informationssysteme GmbH Argentinische Allee 22b
> > 14163 Berlin
> > Tel.: 030/ 802 49 44
> > Fax: 030/ 8090 39 95
> > www.schuetze-berlin.de
> >
> > Geschäftsführer: Klaus-Dieter Schütze
> > Registergericht: Amtsgericht Charlottenburg
> > Registernummer: HRB 73618
> > Umsatzsteuer-Identifikationsnummer gemäß § 27a Umsatzsteuergesetz: DE 813181239
> >
> >
> >
> > ---------------------------------------------------------------------
> > 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: If Controller after Regular Expression
Posted by Karsten Gaul <ka...@exedio.com>.
Hi Jörg,
you may want to try the following:
!("${aktenzeichen}".equals("NoAzFound"))
This works fine in my test plan. You need to put the variable in double
quotes.
rgds
Karsten
Am 26.07.2010 14:08, schrieb Jörg Godau:
> Hello All,
>
> we have a Regular Expression Extractor hat is supposed to find an ID out of the loaded page. This works (unless there is no ID on the page) which is the correct behaviour.
>
> We then want to open the record pointed to by the ID we found iff we actually found a record.
>
> So in the regular expression extractor we put
> Reference Name:aktenzeichen
> Regular expression:familie\.do\?id=(\d+)
> Template:$1$
> Match No.:0
> Default value:NoAzFound
>
> And in the If Controller we have the condition
> ${aktenzeichen} != 'NoAzFound'
>
> I've tried with double quotes, single quotes, no quotes and always get errors like this in the log:
>
> 2010/07/26 12:16:55 ERROR - jmeter.control.IfController: ReferenceError: "NoAzFound" is not defined. (<cmd>#1) org.mozilla.javascript.EcmaError: ReferenceError: "NoAzFound" is not defined. (<cmd>#1)
> at org.mozilla.javascript.ScriptRuntime.constructError(ScriptRuntime.java:3229)
> at org.mozilla.javascript.ScriptRuntime.constructError(ScriptRuntime.java:3219)
> at org.mozilla.javascript.ScriptRuntime.notFoundError(ScriptRuntime.java:3292)
> at org.mozilla.javascript.ScriptRuntime.name(ScriptRuntime.java:1570)
> at org.mozilla.javascript.gen.c2._c0(<cmd>:1)
> at org.mozilla.javascript.gen.c2.call(<cmd>)
> at org.mozilla.javascript.ContextFactory.doTopCall(ContextFactory.java:340)
> at org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:2758)
> at org.mozilla.javascript.gen.c2.call(<cmd>)
> at org.mozilla.javascript.gen.c2.exec(<cmd>)
> at org.mozilla.javascript.Context.evaluateString(Context.java:1132)
> at org.apache.jmeter.control.IfController.evaluateCondition(IfController.java:105)
> at org.apache.jmeter.control.IfController.next(IfController.java:162)
> at org.apache.jmeter.control.GenericController.nextIsAController(GenericController.java:184)
> at org.apache.jmeter.control.GenericController.next(GenericController.java:148)
> at org.apache.jmeter.control.GenericController.nextIsAController(GenericController.java:184)
> at org.apache.jmeter.control.GenericController.next(GenericController.java:148)
> at org.apache.jmeter.control.LoopController.next(LoopController.java:108)
> at org.apache.jmeter.threads.AbstractThreadGroup.next(AbstractThreadGroup.java:72)
> at org.apache.jmeter.threads.JMeterThread.run(JMeterThread.java:242)
> at java.lang.Thread.run(Thread.java:619)
>
> What am I doing wrong?
>
>
>
>
> Mit freundlichen Grüßen
> Jörg Godau
>
> SCHÜTZE Consulting Informationssysteme GmbH Argentinische Allee 22b
> 14163 Berlin
> Tel.: 030/ 802 49 44
> Fax: 030/ 8090 39 95
> www.schuetze-berlin.de
>
> Geschäftsführer: Klaus-Dieter Schütze
> Registergericht: Amtsgericht Charlottenburg
> Registernummer: HRB 73618
> Umsatzsteuer-Identifikationsnummer gemäß § 27a Umsatzsteuergesetz: DE 813181239
>
>
>
> ---------------------------------------------------------------------
> 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