Re: Store extracted data in a file
Hi, first of all thanks the hints here provided. I've been struggling several months with similar problems and I ended up coding custom classes called by a JavaSampler to write data into files. I should have taken the time to post here ;) Btw this works too, especially if you split data in different files depending on the number of threads that you specified, e.g data1.csv, data2csv, ...dataN.csv. And you can resolve those names with the threadNum function. Just recently I bumped into something weird. My java sampler was correctly writing N lines with item1,item2,item3, when executed from a windows machine. As soon as I deployed my tests in a debian/linux server the java sampler was writing lines containing only item1. I still cannot figure out what was wrong in the linux environment. Of course I tried different code implementations but nothing worked. I could get a working release only by using a beanshell script instead of the java sampler. Does anybody have a clue on a possible explanation? -- View this message in context: http://jmeter.512774.n5.nabble.com/Store-extracted-data-in-a-file-tp4757868p4940420.html Sent from the JMeter - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: jmeter-user-unsubscr...@jakarta.apache.org For additional commands, e-mail: jmeter-user-h...@jakarta.apache.org
Re: Store extracted data in a file
Ok, step by step: 1. I open JMeter at my ubuntu via ctrl+F2 dialog 2. I add Thread Group 3. I add Dummy Sampler 4. I add Flexible File Writer 5. I add Simple Data Writer and specify testResults.jtl as Filename Everything else is kept by default. Then I run the test. I can see that testResults.jtl and testResults.txt are located in my Documents directory under home directory. I don't know why ubuntu starts jmeter with Documents directory as base, bit there is. Also jmeter.log shows these lines: 2011/10/17 21:34:00 INFO - jmeter.JMeter: user.dir =/home/undera/Документы 2011/10/17 21:34:00 INFO - jmeter.JMeter: PWD =/home/undera/Документы Another test - I go to /tmp directory in Terminal and start JMeter from there, the above test generates both files in /tmp So you can use relative paths, based on your JMeter start directory. - -- Andrey Pohilko JP@GC Maintainer -- View this message in context: http://jmeter.512774.n5.nabble.com/Store-extracted-data-in-a-file-tp4757868p4910762.html Sent from the JMeter - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: jmeter-user-unsubscr...@jakarta.apache.org For additional commands, e-mail: jmeter-user-h...@jakarta.apache.org
Re: Store extracted data in a file
Can you please give me an example, I know that sound stupid but right now I don't have any ideea on this.. Thank you :) -- View this message in context: http://jmeter.512774.n5.nabble.com/Store-extracted-data-in-a-file-tp4757868p4910394.html Sent from the JMeter - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: jmeter-user-unsubscr...@jakarta.apache.org For additional commands, e-mail: jmeter-user-h...@jakarta.apache.org
Re: Store extracted data in a file
Actually path you entered in FFW is relative to JMeter start directory, like every JMeter file path. - -- Andrey Pohilko JP@GC Maintainer -- View this message in context: http://jmeter.512774.n5.nabble.com/Store-extracted-data-in-a-file-tp4757868p4910282.html Sent from the JMeter - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: jmeter-user-unsubscr...@jakarta.apache.org For additional commands, e-mail: jmeter-user-h...@jakarta.apache.org
Re: Store extracted data in a file
Hey, I'm dealing again with those plugins..I have one question: can I use a relative path when creating the testResults.txt? I have tried and it doesn't seem to work..How can I do that? Thank you! -- View this message in context: http://jmeter.512774.n5.nabble.com/Store-extracted-data-in-a-file-tp4757868p4910223.html Sent from the JMeter - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: jmeter-user-unsubscr...@jakarta.apache.org For additional commands, e-mail: jmeter-user-h...@jakarta.apache.org
Re: Store extracted data in a file
On 21 September 2011 16:38, ZK wrote: > Couldn't you have 1 Thread Group? > Like this: > Thread group > +Admin create > +User > +Admin delete > > Then you could change the 'Number of Threads' for that particular thread > group > Or, use the new setUp and tearDown Thread Groups in 2.5 > ZK > > -- > View this message in context: > http://jmeter.512774.n5.nabble.com/Store-extracted-data-in-a-file-tp4757868p4826805.html > Sent from the JMeter - User mailing list archive at Nabble.com. > > - > To unsubscribe, e-mail: jmeter-user-unsubscr...@jakarta.apache.org > For additional commands, e-mail: jmeter-user-h...@jakarta.apache.org > > - To unsubscribe, e-mail: jmeter-user-unsubscr...@jakarta.apache.org For additional commands, e-mail: jmeter-user-h...@jakarta.apache.org
Re: Store extracted data in a file
Couldn't you have 1 Thread Group? Like this: Thread group +Admin create +User +Admin delete Then you could change the 'Number of Threads' for that particular thread group ZK -- View this message in context: http://jmeter.512774.n5.nabble.com/Store-extracted-data-in-a-file-tp4757868p4826805.html Sent from the JMeter - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: jmeter-user-unsubscr...@jakarta.apache.org For additional commands, e-mail: jmeter-user-h...@jakarta.apache.org
Re: Store extracted data in a file
I'll try to manage with the file, I am thinking of deleting it after the test run.. Is there posbile to force the threads to run in a specific order? I have 3 threads, admin, user and the admin again: the first admin creates a user, in the second thread the user performs some actions and the 3rd thead, admin again have to delete the user. But for me, the last admin is executed first so it gives me errors... -- View this message in context: http://jmeter.512774.n5.nabble.com/Store-extracted-data-in-a-file-tp4757868p4826754.html Sent from the JMeter - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: jmeter-user-unsubscr...@jakarta.apache.org For additional commands, e-mail: jmeter-user-h...@jakarta.apache.org
Re: Store extracted data in a file
Sorry, the "overwrite" feature is planned for future verions of plugins. To workaround it I'd suggest you defining a variable at the start of TestPlan and use it as filename in FFW and csv reader. - -- Andrey Pohilko JP@GC Maintainer -- View this message in context: http://jmeter.512774.n5.nabble.com/Store-extracted-data-in-a-file-tp4757868p4825781.html Sent from the JMeter - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: jmeter-user-unsubscr...@jakarta.apache.org For additional commands, e-mail: jmeter-user-h...@jakarta.apache.org
Re: Store extracted data in a file
Thank you very much! It worked like you said, I just didn't saw the file in the jmeter bin. I have another question though: I need the file to be overwritten at each test run...is it posibile to do it like this? I can't have a new file each time because I have to read from that file later in the same test (like a new CSV) , and I don't know his new name.. Thank you -- View this message in context: http://jmeter.512774.n5.nabble.com/Store-extracted-data-in-a-file-tp4757868p4825663.html Sent from the JMeter - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: jmeter-user-unsubscr...@jakarta.apache.org For additional commands, e-mail: jmeter-user-h...@jakarta.apache.org
Re: Store extracted data in a file
Your plugins setup seems ok, it is placed and configured well for your task. The FFW will create the file, if file exists it will be appended with data. Location of the file for your configuration 'testResults.txt' will be in JMeter current dir. It may be your home dir, JMeter bin dir or other dir. I suggest you setting absolute path for file and use something like '/home/mylogin/testResults_${__time}.txt' for separate files of different runs. This should work. Try searching testResults.txt file on your whole hard drive, is it exists? If exists, does it contain required data? If not, is there any errors in jmeter.log? - -- Andrey Pohilko JP@GC Maintainer -- View this message in context: http://jmeter.512774.n5.nabble.com/Store-extracted-data-in-a-file-tp4757868p4822800.html Sent from the JMeter - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: jmeter-user-unsubscr...@jakarta.apache.org For additional commands, e-mail: jmeter-user-h...@jakarta.apache.org
Re: Store extracted data in a file
Hello, I have tried with the Dummy Sampler and Flexible File Writer but it doesn't work I have a few questions... I have a Loop controller and inside of it I have the create_customer request. This request returns me the id (number) of the customer. This is the one that I need to store in the file. So if I have a loop count of 20 let's say, I need to have 20 ids in the file. How should I configure the Dummy Sampler and the Flexible File Writer? It should be inside the Loop or outside? And the file is generated automated at the test run or it should be created manually before? Where is the file created? In the Flexible File Writer I have: /*Filename: testResults.txt Record each sample as: responseData|\n*/ In the Dummy sampler I put /*Response data: ${id}*/ and the rest I let it as it was... http://jmeter.512774.n5.nabble.com/file/n4822761/image.png -- View this message in context: http://jmeter.512774.n5.nabble.com/Store-extracted-data-in-a-file-tp4757868p4822761.html Sent from the JMeter - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: jmeter-user-unsubscr...@jakarta.apache.org For additional commands, e-mail: jmeter-user-h...@jakarta.apache.org
Re: Store extracted data in a file
Well, I tested FFW at tens of thousands of writes per second... It does good. Yep, it depends on physical disk speed, but you'd find bottleneck in JMeter performance earlier... And configuration issues with database is not what peolple like... If that not matter for user, he can use DB of course. - -- Andrey Pohilko JP@GC Maintainer -- View this message in context: http://jmeter.512774.n5.nabble.com/Store-extracted-data-in-a-file-tp4757868p4770038.html Sent from the JMeter - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: jmeter-user-unsubscr...@jakarta.apache.org For additional commands, e-mail: jmeter-user-h...@jakarta.apache.org
Re: Store extracted data in a file
Frankly, using the Database is still better - because of IO considerations and because once the use-case is getting more complex and you have to write more datas on the same line in the file, than it makes no sense to organize the file yourself (CSV style or something) when this is done very simple with SQL. Also, remember that the OS might need to use the disk from time to time - meaning unexpected fluctuations in throughput... and so on. On Fri, Sep 2, 2011 at 9:47 PM, Oliver Lloyd wrote: > I was dubious when I read about this Flexible File Writer but when I tested > it I discovered that it is completely true: It does write correctly from > multiple threads. Up to 500 threads in fact, each running at 1 request > (write) a second. Impressive! > > OK, that makes me utterly wrong then, you do not need to use a database at > all. JMeter + plugin will easily do this sort of thing. It can write and > read from the same file dynamically and over multiple threads. > > - > http://www.http503.com/ > -- > View this message in context: > http://jmeter.512774.n5.nabble.com/Store-extracted-data-in-a-file-tp4757868p4763441.html > Sent from the JMeter - User mailing list archive at Nabble.com. > > - > To unsubscribe, e-mail: jmeter-user-unsubscr...@jakarta.apache.org > For additional commands, e-mail: jmeter-user-h...@jakarta.apache.org > >
Re: Store extracted data in a file
>And the user ID is not specified in the URL or in any variable..I Again. if a user is using your site with a browser, does he ever enter his ID? if not , then the browser does get this information somehow. if you cant figure it out, you can ask any of the developers in your team. >I have to do this for more than one user Variables are scoped to the thread. So if u have one user to a thread then you are done since each thread will get its own value for the variable. if you have multiple users for the thread then you just need to work out some scheme for the key under which your variable is stored (e,g id_${username}). A variable once defined is available till the end of the test. if you need it in some other test then the easiest is to use sample_variables in jmeter.properties , so that Jmeter will write out the variable to its result file and you post process this file to extract out the data you need. regards deepak On Fri, Sep 2, 2011 at 4:20 AM, bisbis wrote: > Hello, > > First, I need to do this without a database. > > And the user ID is not specified in the URL or in any variable..I can only > find the ID when I am creating the user - the ID is returned- or when I > make > a request that send me back some data about the user, including his ID. I > was planning to extract the ID by using a regex, but I also need to store > the ID - I have to do this for more than one user - and use it after > ...That's why I was wondering how can I save the ID's in a file... > > Regards > > -- > View this message in context: > http://jmeter.512774.n5.nabble.com/Store-extracted-data-in-a-file-tp4757868p4761988.html > Sent from the JMeter - User mailing list archive at Nabble.com. > > - > To unsubscribe, e-mail: jmeter-user-unsubscr...@jakarta.apache.org > For additional commands, e-mail: jmeter-user-h...@jakarta.apache.org > >
Re: Store extracted data in a file
I was dubious when I read about this Flexible File Writer but when I tested it I discovered that it is completely true: It does write correctly from multiple threads. Up to 500 threads in fact, each running at 1 request (write) a second. Impressive! OK, that makes me utterly wrong then, you do not need to use a database at all. JMeter + plugin will easily do this sort of thing. It can write and read from the same file dynamically and over multiple threads. - http://www.http503.com/ -- View this message in context: http://jmeter.512774.n5.nabble.com/Store-extracted-data-in-a-file-tp4757868p4763441.html Sent from the JMeter - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: jmeter-user-unsubscr...@jakarta.apache.org For additional commands, e-mail: jmeter-user-h...@jakarta.apache.org
Re: Store extracted data in a file
I always use Dummy Sampler and Flexible File Writer for that task. It writes correctly from multiple threads. The trick is to set up Dummy Sampler and put your ${variable} into its "Response Data" field. Then attach FFW as a child to it, set up file name to write and specify writing format: responseData|\n This will give you file containing all your "variable" values during test. Try it, I can send you example test plan if you'll fail to make it yourself. - -- Andrey Pohilko JP@GC Maintainer -- View this message in context: http://jmeter.512774.n5.nabble.com/Store-extracted-data-in-a-file-tp4757868p4762810.html Sent from the JMeter - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: jmeter-user-unsubscr...@jakarta.apache.org For additional commands, e-mail: jmeter-user-h...@jakarta.apache.org
Re: Store extracted data in a file
If you 'need' to not use a database then you have to remember that you will be limited on how you can access the file - you will not be able to have lots of threads trying to write to the file at the same time, this is only really possible using a database - this is one of the reasons they were invented. If you also 'need' the user ID then the simplest thing would be to go through a simple data prep exercise where you have a script that registers users and writes the userID (+ maybe some other stuff) out to a file and then, after you have generated enough data, you can use it to run the test. If, however, you want this process to be dynamic then you really have to use a database - otherwise you'd have to have separate files for each thread to avoid read write locks...it would be horrible. - http://www.http503.com/ -- View this message in context: http://jmeter.512774.n5.nabble.com/Store-extracted-data-in-a-file-tp4757868p4762746.html Sent from the JMeter - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: jmeter-user-unsubscr...@jakarta.apache.org For additional commands, e-mail: jmeter-user-h...@jakarta.apache.org
Re: Store extracted data in a file
Hello, First, I need to do this without a database. And the user ID is not specified in the URL or in any variable..I can only find the ID when I am creating the user - the ID is returned- or when I make a request that send me back some data about the user, including his ID. I was planning to extract the ID by using a regex, but I also need to store the ID - I have to do this for more than one user - and use it after ...That's why I was wondering how can I save the ID's in a file... Regards -- View this message in context: http://jmeter.512774.n5.nabble.com/Store-extracted-data-in-a-file-tp4757868p4761988.html Sent from the JMeter - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: jmeter-user-unsubscr...@jakarta.apache.org For additional commands, e-mail: jmeter-user-h...@jakarta.apache.org
Re: Store extracted data in a file
> But to do the operation, I need the ID of the customer, which is returned when the customer is created. Forget Jmeter for a moment. When the customer logs in to the site with a browser and performs the operation, does he enter his ID? I doubt thats the case. Assuming it isn't , then usually the ID will be stored as a hidden input variable in the HTML or be specified in the URL of the form or something. In which case the standard way to do this in JMeter is extract out the value from the previous response (in the customers flow of performing the operation) and use it. regards deepak On Thu, Sep 1, 2011 at 3:53 AM, bisbis wrote: > Hello, > > I have to do create a test that basically do this: > - as admin create a number of customers (let's say 20) > - after that, login with each user and do a set of actions. > > The first request I solved it in this way: login as admin, and then read > the > username and password needed to create the customer from a CSV file. > > And because I already know the username and password of each user, I can > login with the users. But to do the operation, I need the ID of the > customer, which is returned when the customer is created. > > I can extract the ID by using the regular expression extractor. But, I need > to store this ID in a file, a CSV file preferable. And with this file > created, when I login with the user, I can take his ID from the file and > pass it to the application... > > Is there any way to do that? How can I store each extracted ID in a file? > > Thanks, > > -- > View this message in context: > http://jmeter.512774.n5.nabble.com/Store-extracted-data-in-a-file-tp4757868p4757868.html > Sent from the JMeter - User mailing list archive at Nabble.com. > > - > To unsubscribe, e-mail: jmeter-user-unsubscr...@jakarta.apache.org > For additional commands, e-mail: jmeter-user-h...@jakarta.apache.org > >
Re: Store extracted data in a file
Consider using a data-base instead, its much more flexible and scalable. Most use-cases where you will need to "write" down for using immediately after or after some time can be easily updated in a MySQL. So do consider the JDBC Sampler first. If you have larger files that you need to keep on disk and then re-use them in tests while writing other to disk, than this will significantly reduce the load you can test with JMeter from every test node. On Thu, Sep 1, 2011 at 1:53 PM, bisbis wrote: > Hello, > > I have to do create a test that basically do this: > - as admin create a number of customers (let's say 20) > - after that, login with each user and do a set of actions. > > The first request I solved it in this way: login as admin, and then read > the > username and password needed to create the customer from a CSV file. > > And because I already know the username and password of each user, I can > login with the users. But to do the operation, I need the ID of the > customer, which is returned when the customer is created. > > I can extract the ID by using the regular expression extractor. But, I need > to store this ID in a file, a CSV file preferable. And with this file > created, when I login with the user, I can take his ID from the file and > pass it to the application... > > Is there any way to do that? How can I store each extracted ID in a file? > > Thanks, > > -- > View this message in context: > http://jmeter.512774.n5.nabble.com/Store-extracted-data-in-a-file-tp4757868p4757868.html > Sent from the JMeter - User mailing list archive at Nabble.com. > > - > To unsubscribe, e-mail: jmeter-user-unsubscr...@jakarta.apache.org > For additional commands, e-mail: jmeter-user-h...@jakarta.apache.org > >