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.