Hello Philippe -

To answer your questions under each section:

1)  I don't see a good way to remove sections of a template based on a
 parameter...
>Can you clarify wether you want to remove the full block  ? what does b/t
>mean ?

b/t == between.
I need to remove the entire section if the ${keyword2} value is empty.  If
keyword2 is missing, I need to skip a section of the document because the
system I’m posting cannot handle empty values.  Thus, it would be nice to
have functionality like this:

 ====================================
 . . .
${if-present:keyword1}
       {
          "type":"Label",
          "name":"${keyword1}"
       },
${/if-present}
${if-present:keyword2}
       {
          "type":"Label",
          "name":"${keyword2}"
       },
${/if-present}
. . . etc.
 ====================================

I don’t really see how this would be possible with an If Controller.  What
I’m posting is a large JSON document with many user parameters, all of
which need their sections removed if they are not present.

2) Templates are not actually supported…
I’m still stuck on this issue:  I basically need to do this:
a) Read in a file (the path must be relative to the .jmx file - nothing
else makes sense)
b) Replace variables in that file with values from a CSV file
c) Take out the sections of the file that apply to empty variables
d) Do an HTTP Post with the result

At the moment a & c seem impossible.

> 3) HTTP Request Sample File inclusion paths are not relative...
> It does not work and I don't think it will be implemented. There was a
> bug open for it, is was closed as WONTFIX.
> Regarding path, please submit a detailed bug of whenever it works or not.

I don’t understand - the issue is that the Http Request file path is not
relative.  That effectively means it cannot be used unless you put your
file next to the JMeter jar file.  Should the ability to include a file as
the body of the post just be removed as a feature?

4) The CSV Dataset Config component seems to be designed to only iterate via
the loops of a Thread Group
> You can insert it  in a Loop Controller it works.

OK, I can experiment with this - some documentation on how to do this would
help.  Web searches always steer people toward just putting the CSV file in
a ThreadGroup and using the ‘stop thread on EOF’ option.


Thanks for the help,

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


On Tue, Mar 4, 2014 at 2:56 PM, Philippe Mouawad <[email protected]
> wrote:

> On Tue, Mar 4, 2014 at 9:42 PM, Eric Everman <[email protected]> wrote:
>
> > 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
> >       },
> >
>
> Can you clarify wether you want to remove the full block  ? what does b/t
> mean ?
>
> > . . .
> > ====================================
> >
> > 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}
> >
> > You could use IfController and have an  Http Sampler as a child with
> different body
>
>
> > 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.
> >
> > This should be fixed by previous answer.
>
> > 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.
> >
>
> It does not work and I don't think it will be implemented. There was a bug
> open for it, is was closed as WONTFIX.
> Regarding path, please submit a detailed bug of whenever it works or not.
>
>
> > 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.
>
>
> You can insert it  in a Loop Controller it works.
>
>  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.
> >
> >
> >
> > 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
> >
> > Have seen it, but didn't not have time to work on it yet.
>
> >
> > 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/
> >
> >
>
>
> --
> Cordialement.
> Philippe Mouawad.
>

Reply via email to