Link to home
Start Free TrialLog in
Avatar of priya_soparkar
priya_soparkar

asked on

JMeter Configuration

This is  regarding passing data to JMeter.
I have generated two data files (for parameters that are to be used by JMeter for driving the load test) and want JMeter to read the data from these files before starting any of my test cases.

Is there some way to configure these files for JMeter(I mean can we place these files at some location for Jmeter access(or can we specify the paths of these files in configuration parameters?

(These parameters being intialization parameters , I dont want to pass these parameters from the exernal java request, that is the class that implements the JavaSamplerClient interface)
 
Thanks and Regards
Priya
ASKER CERTIFIED SOLUTION
Avatar of someman4oneman
someman4oneman

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of priya_soparkar
priya_soparkar

ASKER

Hi !
Thanks for the response.
One doubt , as the Apache documentation specifies , the _StringFromFile
function reads one complete line for each request .

In my case i have 3 attributes that constitute one record in the file that is to be read  and I want to read these 3 attributes as 3 parameters.

e.g .in my file i have one record of
Val1  Val2 Val3
and I want to read these 3 values in 3 parameters as one record .
Can we do this using _StringFromFile ?

I came across the "user-defined function" option in the same category but unfortunately documentation doesnt specify how to specify parameters in this user defined function and get them in user parameters.


Thanks and Regards
Priya
priya_soparkar
I did some more sniffing round and it would appear that the
users.xml in the bin folder is more like what you are looking for.

As well as the docs there is
http://www.newsforge.com/software/04/02/19/1452218.shtml

to show you what is happening.


Hi !
In  my scenario, I have the data file for say 100000 records  which i want to use for JMeter to pass data for each thread.
Now my application spawns 100 threads for say 5 iterations and I the requirement is such that intial 100 thread will use first 100 records form the data file in first iteration.
In next iteration the same 100 threads should now records from 101 onwards .
So in each iteration the threads will use different data.

(I understand that when we execute the threads in the loop, chanding the
data for the thread does not sound logical).

So is that the right approach to
1) Add a user defined function class in JMeter's oprn source in
org.apache.jmeter.functions
2)Here, open the file ,read the values for 100 records.
3)Maintain file pointer(say with last record read)
4)For next set of records to be read use this pointer for "next" record
5)Close the file when total number of samples are spawned.
(That means in a file of 1000 records if 100 threads are spawned 5 times , 50 records will be read).

Please correct me if i am misinterpretting something.

And the other option that u have mentioned about users.xml file,
I still not able to map the relation of
<thread>
           <par1>
                 <par1-name></par1-name>
                 <par1-value></par1-value>
          </par1>
          <par2>
                 <par2-name></par1-name>
                 <par2-value></par2-value>
           </par2>
</thread>

JMeter documentation says that each <thread></thread> block corresponds to each user paramaters.

So cant this be used in the sceanio other than HTTP request ? Like here i want to use JavaRequest and get this data from some file ?

Please write comments on both scenarios if possible.
I am trying to find the best way to do this.

Thanks and Regards
Priya

Hi Priya
    I am also facing the same problme. Let me know which solution you have adapted.

Mohsin