Return-Path: X-Original-To: apmail-jmeter-user-archive@www.apache.org Delivered-To: apmail-jmeter-user-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id CC82010A12 for ; Thu, 6 Mar 2014 21:56:35 +0000 (UTC) Received: (qmail 76343 invoked by uid 500); 6 Mar 2014 21:56:34 -0000 Delivered-To: apmail-jmeter-user-archive@jmeter.apache.org Received: (qmail 76262 invoked by uid 500); 6 Mar 2014 21:56:34 -0000 Mailing-List: contact user-help@jmeter.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "JMeter Users List" Delivered-To: mailing list user@jmeter.apache.org Received: (qmail 76253 invoked by uid 99); 6 Mar 2014 21:56:34 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 06 Mar 2014 21:56:34 +0000 X-ASF-Spam-Status: No, hits=-0.1 required=5.0 tests=HTML_MESSAGE,RCVD_IN_DNSWL_MED,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of eeverman@usgs.gov designates 137.227.82.13 as permitted sender) Received: from [137.227.82.13] (HELO smtp3.doi.gov) (137.227.82.13) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 06 Mar 2014 21:56:29 +0000 Received: from smtp1.smgd.doi.gov (10.10.82.11) by smtp3.doi.gov (10.10.82.23) with Microsoft SMTP Server (TLS) id 14.2.347.0; Thu, 6 Mar 2014 14:56:03 -0700 X-AuditID: 0a0a520b-b7fa26d000001a9c-d6-5318eef6d9c4 Received: from gsmtp2.doi.gov ( [10.10.82.16]) (using TLS with cipher AES128-SHA (128/128 bits)) (Client did not present a certificate) by smtp1.smgd.doi.gov (Hello) with SMTP id 6A.04.06812.6FEE8135; Thu, 6 Mar 2014 14:56:07 -0700 (MST) Received: from mail-qg0-f42.google.com (209.85.192.42) by gsmtp2.doi.gov (137.227.82.16) with Microsoft SMTP Server (TLS) id 14.2.318.4; Thu, 6 Mar 2014 14:56:05 -0700 Received: by mail-qg0-f42.google.com with SMTP id q107so9002782qgd.1 for ; Thu, 06 Mar 2014 13:56:06 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:content-type; bh=vcS/ueBl/gVB0CvnYOvkM5BRO6iyB3dptyY0avgMHbE=; b=cXNuz68gR5LPkZNWWWzrw3b67Nn/hMBOZnB0h5fLntr2ocGf7w7Xp6Sg63VXYspmiN QPMRyZXBRz6GkAohBl5Ympzg4n4mrC4D4MwqlHuOfBsVphl3gUMva2iAXqsWygl3GGRS 5jgL7GldGtEzkcw3LQ63Sbie1T3enaSX4Z+ox+WEh02ar5Omb4BPQMB3EJ2MtRvkS5al zNUn0tq/kNU0MWNzLAJOlwYKQlcW0BUADSsKbW2gUxZI/o73QEGSS6CmOh+g3CMltjp9 U+cBdJeuhSvyBBDHRy19FpnpNgycgMfpRqFipNQWjTO0aMODvoZYGcZTn0yYBLiPTLKp 0vkQ== X-Gm-Message-State: ALoCoQmoyAVj/S4bxS++lVEHMN7fIR+I2gKr4GjgWOk407Ktkwfx1WrEhM5Of0Xd91Y3b4GkkasWeUNLkWowr4AMmBvd0RWIp08xWV3vYQ61v5XhmrLbyqPspBHN4kn7JaopLh/Wot83gmE6EkFD+Wdv9+v5a+oKXg== X-Received: by 10.224.69.199 with SMTP id a7mr17490416qaj.18.1394142966407; Thu, 06 Mar 2014 13:56:06 -0800 (PST) MIME-Version: 1.0 X-Received: by 10.224.69.199 with SMTP id a7mr17490384qaj.18.1394142966082; Thu, 06 Mar 2014 13:56:06 -0800 (PST) Received: by 10.224.133.130 with HTTP; Thu, 6 Mar 2014 13:56:05 -0800 (PST) In-Reply-To: References: <77FE395A-6E81-4BFB-91DE-46AA425B181C@usgs.gov> Date: Thu, 6 Mar 2014 15:56:05 -0600 Message-ID: Subject: Re: Multiple CSV Files with Templates and optional sections From: "Everman, Eric" To: JMeter Users List Content-Type: multipart/alternative; boundary="001a11c2b39042e31904f3f7343a" X-Gm-Spam: 0 X-Gm-Phishy: 0 Received-SPF: Pass (gSMTP2.doi.gov: domain of eeverman@usgs.gov designates 209.85.192.42 as permitted sender) receiver=gSMTP2.doi.gov; client-ip=209.85.192.42; helo=mail-qg0-f42.google.com; X-CFilter-Loop: Reflected X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrKIsWRmVeSWpSXmKPExsXCxfTrle73dxLBBgeXCln0Tetld2D0mP31 AHsAYxSXTUpqTmZZapG+XQJXxsWF25gKnhVXNFw5xtjAeCu2i5GTQ0LARKL38h0mCFtM4sK9 9WxdjFwcQgJfGCUmvFnBDOGsZpR49PIAE4QzkVFi8ac9LCCOhMAGVonulmZmCGcHo0Tf8VYW iGFVEs9efWUGsXkFBCVOznwCFS+WWHrwBiuILSTgLbH3432wGk6BQImjD/6xQqw4ySjRsHEN I0iCRUBFYvHEE1CDAiServzODmILC7hIzG1tALucTUBTYs7Lf2ALRAT0JHrbpoPVMwv4SJzb 18sGsZhHYsrci+wQNp/EmitbWCCOkJOYumAFO8Tig4wSC85eYYYokpQ4uOIGywRGiVlInpiF ZC6ErSnRuv03O4StIbHgzj5GCFtbYtnC18wLGFlXMQoV55YUGOoV56an6KXkZ+ql55dtYgRF HlcQ9w7GEzctDjEKcDAq8fB2LJIIFmJNLCuuzD3EKMHBrCTCa/oSKMSbklhZlVqUH19UmpNa fIhRmoNFSZz3kv/sQCGB9MSS1OzU1ILUIpgsEwenVANj+uktjKcVuMp6n1/wV/Y0Ou2553PX 68Rz16ZURIue2jzllkoEf6FTwPxD127KuW80VJQ9p3U3/qz8qwUzWK8wlbm5neSc6MUUdnvu /WOblqh6Zhw/zn5rxvuQF2rpTlGeW4O+xU6ruM7+3P6R+Z6+7Q3yW5736mnfuRZ/2quS/+ec Kctv/X7xV4mlOCPRUIu5qDgRAIlTBTW4AgAA X-Virus-Checked: Checked by ClamAV on apache.org --001a11c2b39042e31904f3f7343a Content-Type: text/plain; charset="UTF-8" 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 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 > 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/ > > > > > > > > > --001a11c2b39042e31904f3f7343a--