jmeter-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Deepak Shetty <shet...@gmail.com>
Subject Re: How to Parse Web Service Response to Delimited Text
Date Wed, 17 Mar 2010 21:16:12 GMT
Actually concat does work , so you can get away with just 1 extractor

concat(/CarsQueryResponse/cars/car/name/text(),'~',/CarsQueryResponse/cars/car/year/text(),'~',/CarsQueryResponse/cars/car/model/text(),'~',/CarsQueryResponse/cars/car/price/text())

Tidy = unchecked
Namespaces = unchecked

regards
deepak


On Wed, Mar 17, 2010 at 1:54 PM, Deepak Shetty <shettyd@gmail.com> wrote:

> Hi
> concat function didnt seem to work (if you can get it to work on JMeter
> then great).
> Im assuming you only have 1 car element per response
> Write 4 XPATH extractors , that extract into variables
> /CarsQueryResponse/cars/car/name/text()  -->carName
> /CarsQueryResponse/cars/car/year/text()   -->year
> etc etc..
> And in jmeter.properties use sample_variables to specify carName,year so
> that this will be written into the result file,
> you can then extract them whenever you want with whatever delimiter.
>
> Alternately you can write a BeanShell Listener which can do whatever you
> code it to do(obtain a lock , read variables , append to file , release
> lock)
>
> regards
> deepak
>
>
> On Wed, Mar 17, 2010 at 1:48 PM, Prakash Viswanathan <
> rushtoprakash@gmail.com> wrote:
>
>> Is there a way in Jmeter to parse the web service response and write them
>> into a CSV or some character Delimited File.
>>
>> e.g.
>>
>> Lets say that the following comes as the body in the web service responses
>> in TWO consecutive threads
>>
>> <CarsQueryResponse>
>> <cars>
>> <car>
>> <name>Honda</name>
>> <year>2010</year>
>> <model>Accord</model>
>> <price>23,000</price>
>> </car>
>> </cars>
>> </CarsQueryResponse>
>>
>> <CarsQueryResponse>
>> <cars>
>> <car>
>> <name>Toyota</name>
>> <year>2010</year>
>> <model>Camry</model>
>> <price>22,500</price>
>> </car>
>> </cars>
>> </CarsQueryResponse>
>>
>>
>> I would like to parse this XML and get the following in the output file
>>
>> Honda~2010~Accord~23,000
>> Toyota~2010~Camry~22,500
>>
>> where ~ is the separator character.
>>
>> Any pointers here will be very helpful.
>>
>> Thanks
>> Prakash
>>
>
>

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