jmeter-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jakob van Bethlehem <ja...@jet-stream.nl>
Subject Re: Inserting a user-defined variable in a Response Assertion pattern
Date Tue, 05 Mar 2013 16:47:38 GMT
Hello Flavio,

Thanks a lot for the detailed explanation. You helped me get a bit further, but not quite
to the point I was hoping to get. Let my try to clarify a bit more on what I'm trying to achieve:
- our software accepts an 'about' parameter, and when passed and equal to 1, it will display
a nice 'about'-page, with company logo, etc, -and- the hostname of the server
- in a typical installation of the software, there is a whole bunch of servers that run that
accept that parameter, displaying the 'about'-page
- I created the following simple Test Plan:
Test Plan
+ Thread Group
++ HTTP Request Defaults
++ HTTP Request
+++ Response Assertion
+++ View Results Tree

I have now idea whether I'm trying to achieve something really useful, but the idea is to
be able to repeat the same Test Plan for different hosts. Using Test Plan variables using
the techniques you described works beautifully for achieving this, except that I would like
to include the selected hostname in the Test Pattern configured in the Response Assertion.
In the Response Assertion I basically put the 'about'-page that should be send by the server,
but that server is variable, hence the pattern should change when the host is different. I
tried simply writing ${myHost1} inside the pattern, with and without the '$' escaped, but
that didn't do the trick.

Is there a trick to achieve this? Or is it nonsense anyway (a viable possibility, me being
a complete newby when it comes to this kind of testing)

Sincerely,
Jakob van Bethlehem

On 5 mrt. 2013, at 13:15, Flavio Cysne <flaviocysne@gmail.com> wrote:

> Welcome, Jakob.
> 
> As a starting point I suggest you reading the Best Practices advice (
> http://jmeter.apache.org/usermanual/best-practices.html ).
> 
> At first, before capturing the script, add an HTTP Request Defaults
> configuration component and fill in the fields host, port, HTTP
> implementation, protocol and content encoding.
> Before capturing, add as many Test Plan variables as the hosts you are
> testing against (I suppose you are already doing this).
> 
> The first will ensure that any HTTP request captured by JMeter proxy, that
> have the same parameters, will follow the defaults (fields inside HTTP
> Request sampler will be left blank).
> The second will help you to parameterize some of the Request Headers
> parameters. Ex.: Host and Referer parameters.
> 
> After capturing you could change Host field in HTTP Request defaults with a
> Test Plan variable.
> 
> Test Plan variables that are subject to change should have their values
> defined like this: ${__P(myHost1,my.host1.com)}
> myHost1 = parameter passed on command line: jmeter -n -t myTestPlan.jmx
> -JmyHost1=my.alternative.host
> my.host1.com = default variable value if myHost1 parameter is not passed


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


Mime
View raw message