You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@jmeter.apache.org by Jakob van Bethlehem <ja...@jet-stream.nl> on 2013/03/20 14:17:07 UTC

Using HTTP Request parameters in Response Assertion

Dear users,

Is there some non-trivial way to access the parameters that were passed in a request in the corresponding Response Assertion. The main idea is to have a set of different HTTP Requests with slightly different parameters, that all have the same response, expect that these parameters are used to fill in some details. Think for instance about passing a port or a protocol that should be used when responding.

Sincerely,
Jakob van Bethlehem
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@jmeter.apache.org
For additional commands, e-mail: user-help@jmeter.apache.org


Re: Using HTTP Request parameters in Response Assertion

Posted by sebb <se...@gmail.com>.
On 21 March 2013 11:46, Jakob van Bethlehem <ja...@jet-stream.nl> wrote:
> Hej Sergio,
>
> Thanks for responding, but I guess I wasn't clear enough, or maybe I'm the one missing something obvious. Let me try to be extremely specific, by drawing a simple test plan:
> Simple Controller
> +- HTTP Request Defaults
> +- HTTP Request 1
> +- HTTP Request 2
> +- HTTP Request 3
> +- HTTP Request 4
> +- Response Assertion
>
> In the HTTP Request Defaults I set a server name, and port, and a default set of parameters. Then in HTTP Requests 1-4 I set three additional parameters, for instance  port, protocol, and format, for instance:
> HTTP Request 1 sets port=80, protocol=http, format=html
> HTTP Request 2 sets port=554, protocol=mms, format=m3u
> HTTP Request 3 sets port=80, protocol=mms, format=pls
> HTTP Request 4 sets port=80, protocol=rtsp, format=xml
>
> Now, in the Response Assertion I would like to be able to access these values. If these are available through for instance ${port}, ${protocol} and ${format} I'm there. But as far as I can see, this is not a feature of JMeter. If I understand your suggestion correctly, you propose to add a Regular Expression Post Processor for each HTTP Request, which will first extract these values from the response, such that these can be accessed in the Response Assertion. But then I'm comparing output with output instead of input with output which is what we want to achieve.
>
> Hopefully this makes things clearer.

Well, one obvious method is to define the port, protocol etc as
variables, and use those variables when issuing the request.
The variables will still be set (assuming you have not re-used them!)
for use afterwards.

> Sincerely,
> Jakob
>
>
>
> On 21 mrt. 2013, at 12:25, Sergio Boso <se...@bosoconsulting.it> wrote:
>
>> Il 20/03/2013 14:17, Jakob van Bethlehem ha scritto:
>>> Dear users,
>>>
>>> Is there some non-trivial way to access the parameters that were passed in a request in the corresponding Response Assertion. The main idea is to have a set of different HTTP Requests with slightly different parameters, that all have the same response, expect that these parameters are used to fill in some details. Think for instance about passing a port or a protocol that should be used when responding.
>>>
>>> Sincerely,
>>> Jakob van Bethlehem
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: user-unsubscribe@jmeter.apache.org
>>> For additional commands, e-mail: user-help@jmeter.apache.org
>>>
>> Hi maybe I'm missing some point,
>>
>> but I usually  achieve that by inserting proper variable the assertion field.
>> E.g.., if I know that the page must contain the ${username} value, I just  put ${username} in the response assertion.
>> Often some regular expression i required.
>>
>> regards
>>
>>
>> --
>>
>> Ing. Sergio Boso
>>
>>
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@jmeter.apache.org
> For additional commands, e-mail: user-help@jmeter.apache.org
>

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


Re: Using HTTP Request parameters in Response Assertion

Posted by Jakob van Bethlehem <ja...@jet-stream.nl>.
Hej Sergio,

Thanks for responding, but I guess I wasn't clear enough, or maybe I'm the one missing something obvious. Let me try to be extremely specific, by drawing a simple test plan:
Simple Controller
+- HTTP Request Defaults
+- HTTP Request 1
+- HTTP Request 2
+- HTTP Request 3
+- HTTP Request 4
+- Response Assertion

In the HTTP Request Defaults I set a server name, and port, and a default set of parameters. Then in HTTP Requests 1-4 I set three additional parameters, for instance  port, protocol, and format, for instance:
HTTP Request 1 sets port=80, protocol=http, format=html
HTTP Request 2 sets port=554, protocol=mms, format=m3u
HTTP Request 3 sets port=80, protocol=mms, format=pls
HTTP Request 4 sets port=80, protocol=rtsp, format=xml

Now, in the Response Assertion I would like to be able to access these values. If these are available through for instance ${port}, ${protocol} and ${format} I'm there. But as far as I can see, this is not a feature of JMeter. If I understand your suggestion correctly, you propose to add a Regular Expression Post Processor for each HTTP Request, which will first extract these values from the response, such that these can be accessed in the Response Assertion. But then I'm comparing output with output instead of input with output which is what we want to achieve.

Hopefully this makes things clearer.

Sincerely,
Jakob



On 21 mrt. 2013, at 12:25, Sergio Boso <se...@bosoconsulting.it> wrote:

> Il 20/03/2013 14:17, Jakob van Bethlehem ha scritto:
>> Dear users,
>> 
>> Is there some non-trivial way to access the parameters that were passed in a request in the corresponding Response Assertion. The main idea is to have a set of different HTTP Requests with slightly different parameters, that all have the same response, expect that these parameters are used to fill in some details. Think for instance about passing a port or a protocol that should be used when responding.
>> 
>> Sincerely,
>> Jakob van Bethlehem
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@jmeter.apache.org
>> For additional commands, e-mail: user-help@jmeter.apache.org
>> 
> Hi maybe I'm missing some point,
> 
> but I usually  achieve that by inserting proper variable the assertion field.
> E.g.., if I know that the page must contain the ${username} value, I just  put ${username} in the response assertion.
> Often some regular expression i required.
> 
> regards
> 
> 
> -- 
> 
> Ing. Sergio Boso
> 
> 
> 


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


Re: Using HTTP Request parameters in Response Assertion

Posted by Sergio Boso <se...@bosoconsulting.it>.
Il 20/03/2013 14:17, Jakob van Bethlehem ha scritto:
> Dear users,
>
> Is there some non-trivial way to access the parameters that were passed in a request in the corresponding Response Assertion. The main idea is to have a set of different HTTP Requests with slightly different parameters, that all have the same response, expect that these parameters are used to fill in some details. Think for instance about passing a port or a protocol that should be used when responding.
>
> Sincerely,
> Jakob van Bethlehem
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@jmeter.apache.org
> For additional commands, e-mail: user-help@jmeter.apache.org
>
Hi maybe I'm missing some point,

but I usually  achieve that by inserting proper variable the assertion field.
E.g.., if I know that the page must contain the ${username} value, I just  put ${username} in the response assertion.
Often some regular expression i required.

regards


-- 

Ing. Sergio Boso




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