On 19 March 2012 15:23, sebb <[email protected]> wrote:
> On 19 March 2012 14:58, Pulkit Singhal <[email protected]> wrote:
>> Using:
>> props.put("nameArray", nameArray.toString());
>> did the trick instead of:
>> *${__setProperty("nameArray", nameArray)};*
>
> That is  resolved by JMeter before the script is passed to the BSF sampler.
>
>>
>> Using:
>> props.put("nameArray", nameArray);
>> also looks promising but it puts an object instead of a comma separated
>> string into properties and I'm not quite sure if that object is actually
>> usable later on, will post back later with that.
>
> It should work the same as
>
> props.put("nameArray", nameArray.toString)

That was wrong - props is of type java.util.properties which as the signature

 public Object put(Object key, Object value)

i.e. the value will not be auto converted to a String.

> because the JMeterVariables method signature is:
>
> public void put(String key,
>                String value)
>
> Use putObject to store an Object.
>
> See:
>
> http://jmeter.apache.org/api/org/apache/jmeter/threads/JMeterVariables.html
>
>> On Mon, Mar 19, 2012 at 8:57 AM, Pulkit Singhal 
>> <[email protected]>wrote:
>>
>>> I'm using the BSF PostProcessor to put together an array of names.
>>>
>>> I can store it in JMeter variables as a comma,separated list just fine -
>>> *vars.put("nameArray", nameArray); // works :)
>>>
>>> *Results in Debug Sampler show -
>>> *JMeterVariables:
>>> nameArray="Let It Go (Japan)","Deskkontrolados","Caillou: Dr. Caillou -
>>> VHS","Where Did You Sleep Last Night: Lead... [LP]","20 More Explosive
>>> Fantastic Rockin' Mega...","The Secret NASA Transmissions: The Raw Footage
>>> - DVD","L'Etang De Kukufah","Arias (CD+DVD) (Limited Edition) (Deluxe
>>> Edition) (Spkg)","Don't You Want to Rock","Talk On Corners: Special Edition"
>>> *
>>>
>>> But for some reason (in the next line) the same value is not being
>>> accepted into the JMeter properties -
>>> *${__setProperty("nameArray", nameArray)}; // does not work :(
>>> *
>>> Results in Debug Sampler show -
>>> *JMeterProperties:
>>> "nameArray"= nameArray*
>>>
>>> Can anyone tell me what I may be doing wrong here?
>>>

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to