cheers Deepak, the ID variable itself was fine, the problem was the last file separation character in the filepath - ie the '\' - was being interporeted as an escape character which prevented the variable from being recognised and expanded. Once I escaped the '\' everything worked correctly. Took quite a while for the penny to drop though - its a bit of a Gotcha.
Peri On 24 April 2012 17:59, Deepak Shetty <shet...@gmail.com> wrote: > Hi > i think the ${ID} is inside the file collnumsonly.txt (which wont work.). > Is that correct? > > regards > deepak > > > > > On Tue, Apr 24, 2012 at 9:51 AM, sebb <seb...@gmail.com> wrote: > > > On 24 April 2012 17:02, Peri Stracchino <peri.stracch...@york.ac.uk> > > wrote: > > > Hello > > > > > > I hope I'v got the correct address here for the JMeter users discussion > > > list - apologies if not. > > > > Yes, it is the correct list. > > > > > I'm using JMeter 2.5.1 > > > > There is a more recent version (2.6) but that's unlikely to be the issue > > here. > > > > > I want to run a test which requires a different external file to be > sent > > > with each > > > request. I had hoped to do this by passing a variable into the File > Path > > > (the one > > > under 'send files with the request'). this variable is read in from a > > csv > > > file > > > and would allow me to construct the unique part of the file name. > > > > > > the variable is specified like this > > > ID ${_StringFromFile(collnumsonly.txt)} > > > > Where are you defining this? > > > > > But this doesnt seem to work, because when I look at the error > > > message the variable hasnt been expanded - see below: > > > <responseData class="java.lang.String">java.io.FileNotFoundException: > > > C:\Jmeter2.5\jakarta-jmeter-2.5.1\bin\${ID}.txt (The system cannot find > > the > > > file > > > specified) > > > > This means that the variable cannot be resolved. > > > > > Is there any means by which I can do this in JMeter? Have i got my > syntax > > > wrong or > > > am I simply trying to do something which wont work in jmeter? I'v > googled > > > like a > > > very googly thing but cant seem to find an answer to this > > > > Syntax looks OK. > > > > There are two aspects to this: > > 1) is the variable being set up correctly and in time? > > 2) is the sampler set up correctly to use the variable? > > > > I would start by disabling reading from the external file. > > Define the ID variable as a fixed value on the Test Plan, and make > > sure the sampler works with the fixed value. > > Change the value and check it still works. > > > > Then try to read the variable from the file; use the Debug Sampler to > > show what variables are being set up. > > > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: user-unsubscr...@jmeter.apache.org > > For additional commands, e-mail: user-h...@jmeter.apache.org > > > > >