jmeter-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Everman, Eric" <eever...@usgs.gov>
Subject Re: Multiple CSV Files with Templates and optional sections
Date Thu, 06 Mar 2014 21:56:05 GMT
Deepak - Yes, that is my situation.  We have about 30 different parameters
in a spreadsheet.  If we had different HTTP Samples for each possible
combination, that would 30! (30 factorial) possible combinations of present
and missing parameters - not really possible.

What is really needed is some type of templating plugin for JMeter, perhaps
something like Velocity (velocity.apache.org) or something with similar
functionality.


Eric Everman
CIDA - Center for Integrated Data Analytics
US Geological Survey
Middleton, WI
651-269-4735
http://cida.usgs.gov/


On Thu, Mar 6, 2014 at 11:23 AM, Deepak Shetty <shettyd@gmail.com> wrote:

> >Use HTTP Request samplers with different contents each one inside an If
> Comtroller
>
> >- If Controller ( '${keyword2}'=='' )
> >    + HTTP Requet WITHOUT keyword2 template
> >- If Controller ( '${keyword2}'!='' )
>     + HTTP Requet WITH keyword2 template
>
> But if you have many such parameters (keyword1, keyword2, keyword3), you
> cant really do it this way - you usually have to add the parameters
> dynamically so id go with beanshell (or equivalent) preprocessor that
> either adds these parameter dynamically (in case of simple http request) or
> generates the JSON string and the sampler uses that (in case of JSON/XML)
> or uses an external template (and interacts with however parameters are
> passed to it.)
>
>
>
> On Thu, Mar 6, 2014 at 3:47 AM, Flavio Cysne <flaviocysne@gmail.com>
> wrote:
>
> > Let me know If I misunderstood any of your questions. Answers were placed
> > between your mailed questions, as follows.
> >
> >
> >
> > > Hello - I think I have a pretty common situation here, but JMeter
> really
> > > seems to come up short for this usage.
> > >
> > > Here is what I'm trying to do:
> > >
> > > I am adding sets of records to a remote system in JSON.  There are
> three
> > > types of records:
> > >
> > > Projects
> > > Publications
> > > Dataset
> > >
> > > The JSON for each type of record is slightly different, so I made JSON
> > > templates for each of those.  These templates have variables to be
> > replaced
> > > from a CSV file, so there are several ${MyUserVariableName} style
> > variables
> > > in each template.  But, the remote system doesn't like empty values,
> so I
> > > really need to take out sections of the template when the value is
> empty.
> > >  Here is an example:
> > >
> > > ====================================
> > > . . .
> > >       {
> > >          "type":"Label",
> > >          "name":"${keyword1}"
> > >       },
> > >       {
> > >          "type":"Label",
> > >          "name":"${keyword2}"  <<== skip this section b/t curly braces
> if
> > > ${keyword2} is empty
> > >       },
> > > . . .
> > > ====================================
> > >
> > > So the issues I'm having are the following:
> > >
> > > 1)  I don't see a good way to remove sections of a template based on a
> > > parameter.  Something like this:
> > > ${if-present:keyword2}
> > > Text and ${keyword2} other variables
> > > ${/if-present}
> > >
> > >
> >
> > Use HTTP Request samplers with different contents each one inside an If
> > Comtroller
> >
> > - If Controller ( '${keyword2}'=='' )
> >     + HTTP Requet WITHOUT keyword2 template
> > - If Controller ( '${keyword2}'!='' )
> >     + HTTP Requet WITH keyword2 template
> >
> >
> >
> > > 2) Templates are not actually supported
> > > My template is actually in the HTTP Sample Post Body, but I really
> don't
> > > want to edit a largish document in that tiny window, so it makes sense
> to
> > > keep the file external.  However, if I specify that a file should be
> > > included instead, user parameter replacement is not done on that file.
> > >
> > >
> > Have a look in HTTP Raw Request (JMeter Plugins component) and
> > *FileToInclude:* marker
> >
> >
> > > 3) HTTP Request Sample File inclusion paths are not relative
> > > Even if the user parameter replacement worked for POSTed files, its not
> > > possible to reference a file because the path is not interpreted as
> > > relative to the .jmx file and the ` tilde character does not work
> there.
> > >  Paths are generally broken throughout JMeter.  In some places the
> tilde
> > > works as a reference to the .jmx file location, in others it doesn't
> and
> > in
> > > other locations the path is assumed to be relative to the .jmx file.
> > >
> > >
> > Using absolute paths are not a big deal. Standardize a root path using a
> > property (and capturing it as a variable in your Test Plan) and put all
> > files inside this folder.
> >
> >
> >
> > > 4) The CSV Dataset Config component seems to be designed to only
> iterate
> > > via the loops of a Thread Group
> > > The more natural (IMHO) construct of putting a CSV Dataset within a
> While
> > > Loop is either not supported or completely undocumented.  This makes it
> > > really hard to have multiple CSV Datasets b/c they each require their
> own
> > > Thread Group.  This is a bit unwieldily and causes issues b/c the
> > behavior
> > > changes if pulled in as a module, if threads are set to run
> concurrently
> > vs
> > > sequentially, or if a login is required.
> > >
> > >
> > >
> > Use the __CSVRead<
> > http://jmeter.apache.org/usermanual/functions.html#__CSVRead>function
> > instead of CSV Dataset Config component.
> >
> >
> >
> > >
> > > I filed a bug related to some of this stuff, but this just seems like a
> > > huge issue in usability for a relatively typical type of usage.
> > > BUG:  https://issues.apache.org/bugzilla/show_bug.cgi?id=56197
> > >
> > >
> > > Any thoughts on this?  Am I just approaching this wrong?
> > >
> > >
> > > Thanks,
> > >
> > > Eric Everman - Applications Developer
> > > CIDA - Center for Integrated Data Analytics
> > > US Geological Survey
> > > Middleton, WI
> > > http://cida.usgs.gov/
> > >
> > >
> >
>

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