jmeter-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Deepak Shetty <shet...@gmail.com>
Subject Re: Regular Expression Extractor and its Variables
Date Fri, 05 Jun 2009 17:29:38 GMT
hi
if you have a simple text match then BeanShell Assertion(or java or bsf)
even if you have regexes you could use the java API's.
However I would still like to see if there was a way to use a test like
HTTPRequest
    Regex Post processor
For Each Controller on the regex returned value
     Once Only Controller
           SOAP Request
     Response Assertion --> Not sure if this will work

regards
deepak



On Fri, Jun 5, 2009 at 10:13 AM, mattlamignat <mateusz_grodecki@o2.pl>wrote:

>
> I changed the code to
> if (vars.get("city_10") == null){
> vars.put( "city_10", "a" );
> print(vars.get("city_10"));
> }
>
> and it's working! thank you Sir!
> I was suprised that this part was wrong because it was printing "a".. :)
>
> anyway do you know that better way by any chance? :)
>
>
>
>
> Deepak Shetty wrote:
> >
> > if (vars.get("${city_10}") == null) is wrong
> > should be
> > vars.get("city_10")
> > Im sure theres a better way to do what you want though :)
> > regards
> > deepak
> >
> > On Fri, Jun 5, 2009 at 9:19 AM, mattlamignat <mateusz_grodecki@o2.pl>
> > wrote:
> >
> >>
> >> This is my test plan:
> >>
> >>  |-User Defined Variable
> >>  |-HTTP Request
> >>    |-Regular Expression Extractor
> >>  |-SOAP Request
> >>    |-Response Assertion
> >>
> >> What I have to do is to capture strings from the HTTP response and check
> >> if
> >> they do exist in the SOAP response. The thing is that I don't know how
> >> many
> >> strings I need to capture (for instance Cities) will be in the HTTP
> >> response. I set regexp to capture all of them:
> >> Match No.(0 for Random)   -1
> >> I set 10 variables in the Response Assertion
> >> ${city_1}
> >> ${city_2}
> >> ....
> >> ${city_10}
> >>
> >> The problem is when I have less than 10 Cities in the HTTP response. In
> >> this
> >> case my assertions fail with the message "Test failed: text expected to
> >> contain /${city_10}/"
> >>
> >> I try to replace null in the  ${city_10} with some string that exist in
> >> the
> >> SOAP response so my test will not fail.
> >>
> >> I added BeanShell PreProcessor as a child of SOAP Request:
> >>
> >> if (vars.get("${city_10}") == null){
> >> vars.put( "${city_10}", "a" );
> >> print(vars.get("${city_10}")); // just to ensure above line changed the
> >> value to "a"
> >> }
> >>
> >> but it's not working - I'm still getting the message "Test failed: text
> >> expected to contain /${city_10}/"
> >>
> >> please help..
> >>
> >>
> >> --
> >> View this message in context:
> >>
> http://www.nabble.com/Regular-Expression-Extractor-and-its-Variables-tp23891274p23891274.html
> >> Sent from the JMeter - User mailing list archive at Nabble.com.
> >>
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
> >> For additional commands, e-mail: jmeter-user-help@jakarta.apache.org
> >>
> >>
> >
> >
>
> --
> View this message in context:
> http://www.nabble.com/Regular-Expression-Extractor-and-its-Variables-tp23891274p23892094.html
> Sent from the JMeter - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: jmeter-user-help@jakarta.apache.org
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message