You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@jmeter.apache.org by sebb <se...@gmail.com> on 2008/02/21 15:54:04 UTC

Re: BeanShell --> how set test successfull

http://jakarta.apache.org/jmeter/usermanual/component_reference.html#BeanShell_Sampler

Read the para starting:

When the script completes, control is returned to the Sampler, and it
copies the contents of the following script variables into the
corresponding variables in the SampleResult:

On 21/02/2008, Fulvio Guglielmelli <fu...@yahoo.it> wrote:
> How is possible set the successfull (true or false) using beanshell?
>   ctx.????
>
>   thanks
>   Fulvio
>
>
>
>  ---------------------------------
>
>
>  ---------------------------------
>  L'email della prossima generazione? Puoi averla con la nuova Yahoo! Mail

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


Re: Regular Expressin Extractor problem with test

Posted by sebb <se...@gmail.com>.
On 22/02/2008, Fulvio Guglielmelli <fu...@yahoo.it> wrote:
> Hi
>   I'm tring to apply a match regex on this string
>              the field "text" is
>
>   Regular Expressin Extractor
>       reference name = example
>       regular expression = (the field "text" is)
>       template = $1$
>       Match = 1
>       Default = NO
>
>   Running Jmeter always return NO

Odd, because that looks OK.

>   If i change
>   regular expression = (the field)  the match work correctly.
>

This means that the rest of the RE was not quite right.

>   I tryed also to use jakarta Demonstration Applet if i insert
>   "text" or \"text\" the regex match correctly
>

Double-quotes are not meta-characters and don't need to be escaped.

>   Where is the error?

Are you sure the spacing is correct? It's easy to overlook a different
number of spaces.
Or perhaps there are tabs?

You can match arbitrary white space with \s+

>   THANKS
>  Fulvio
>
>
>  ---------------------------------
>
>
>  ---------------------------------
>  L'email della prossima generazione? Puoi averla con la nuova Yahoo! Mail

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


Regular Expressin Extractor problem with test

Posted by Fulvio Guglielmelli <fu...@yahoo.it>.
Hi
  I'm tring to apply a match regex on this string
             the field "text" is
   
  Regular Expressin Extractor 
      reference name = example
      regular expression = (the field "text" is) 
      template = $1$
      Match = 1
      Default = NO
   
  Running Jmeter always return NO
   
  If i change 
  regular expression = (the field)  the match work correctly.
   
  I tryed also to use jakarta Demonstration Applet if i insert
  "text" or \"text\" the regex match correctly
   
  Where is the error?
  THANKS
Fulvio

       
---------------------------------

---------------------------------
L'email della prossima generazione? Puoi averla con la nuova Yahoo! Mail

Re: BeanShell --> how set test successfull

Posted by sebb <se...@gmail.com>.
The BeanShell Listener is not suitable for this.

Use the BeanShell Assertion instead:
http://jakarta.apache.org/jmeter/usermanual/component_reference.html#BeanShell_Assertion

On 21/02/2008, Fulvio Guglielmelli <fu...@yahoo.it> wrote:
> hi,
>   To understand if the HTTP response contains an error message, i apply a regex that extract the error message (if there is)
>
>   I added (as Http request child) a BeanShell Listener with code below
>
>   the scope is set successufull false if credenziali != ret
>
>   the NOOOOOOOOO or SIIIIIIIIIII are printed correctly
>   , this mean the if condition is OK,
>   but the status is always true.
>
>   ************************************************************
>  String credenziali = vars.get("credenziali");
>  String ret = vars.get("return");
>  if (credenziali != ret){
>     print("NOOOOOOOOOOOOO");
>     resultSample.setSuccessful(false); (or SampleResult.setSuccessful(false);)
>  }else{
>   print("SIIIIIIIIIIIIIIIIIIIIIIII");
>
>   }
>   ************************************************************
>   thanks Fulvio
>  sebb <se...@gmail.com> ha scritto:
>
>   http://jakarta.apache.org/jmeter/usermanual/component_reference.html#BeanShell_Sampler
>
>  Read the para starting:
>
>  When the script completes, control is returned to the Sampler, and it
>  copies the contents of the following script variables into the
>  corresponding variables in the SampleResult:
>
>
> On 21/02/2008, Fulvio Guglielmelli wrote:
>  > How is possible set the successfull (true or false) using beanshell?
>  > ctx.????
>  >
>  > thanks
>  > Fulvio
>  >
>  >
>  >
>  > ---------------------------------
>  >
>  >
>  > ---------------------------------
>  > L'email della prossima generazione? Puoi averla con la nuova Yahoo! Mail
>
>
> ---------------------------------------------------------------------
>  To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
>  For additional commands, e-mail: jmeter-user-help@jakarta.apache.org
>
>
>
>
>
>  ---------------------------------
>
>  ---------------------------------
>  L'email della prossima generazione? Puoi averla con la nuova Yahoo! Mail

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


Re: BeanShell --> how set test successfull

Posted by Fulvio Guglielmelli <fu...@yahoo.it>.
hi, 
  To understand if the HTTP response contains an error message, i apply a regex that extract the error message (if there is)
   
  I added (as Http request child) a BeanShell Listener with code below
   
  the scope is set successufull false if credenziali != ret
   
  the NOOOOOOOOO or SIIIIIIIIIII are printed correctly
  , this mean the if condition is OK, 
  but the status is always true.
   
  ************************************************************
String credenziali = vars.get("credenziali");
String ret = vars.get("return");
if (credenziali != ret){
    print("NOOOOOOOOOOOOO");
    resultSample.setSuccessful(false); (or SampleResult.setSuccessful(false);)
}else{
  print("SIIIIIIIIIIIIIIIIIIIIIIII");

  }
  ************************************************************
  thanks Fulvio
sebb <se...@gmail.com> ha scritto:
  http://jakarta.apache.org/jmeter/usermanual/component_reference.html#BeanShell_Sampler

Read the para starting:

When the script completes, control is returned to the Sampler, and it
copies the contents of the following script variables into the
corresponding variables in the SampleResult:

On 21/02/2008, Fulvio Guglielmelli wrote:
> How is possible set the successfull (true or false) using beanshell?
> ctx.????
>
> thanks
> Fulvio
>
>
>
> ---------------------------------
>
>
> ---------------------------------
> L'email della prossima generazione? Puoi averla con la nuova Yahoo! Mail

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



       
---------------------------------

---------------------------------
L'email della prossima generazione? Puoi averla con la nuova Yahoo! Mail