For this case, Jmeter provides a config element as 'CSV Data Set Config' in which user can pass a file containing different login credentials.
Lets take an example of google search, the scenario is we need to load google search by searching different keywords. Now what we do, will pass a file containing different keywords and pass them to HTTP request.
Open Jmeter and add following elements:
1) Thread Group
2) Config Element: CSV Data Set Config
3) Sampler: HTTP Request
4) Listener: View Result Tree
Your test plan will look like this:
Now configure 'CSV Data Set Config', by adding file path (containing keywords) and set a variable name to it.
Like this:
a) Sample TXT file containing keywords (for now we added only two keywords, you can add more to it).
b) CSV Data Set Config look like this
Now configure Sampler 'HTTP Request'
a) Add domain and pass parameter '#q' that can pick value from txt file, for that will get the value from variable 'keyword' as mentioned in the 'CSV Data Set Config'.
Like this:
Now we have two keywords in our text file so we need to set threads count as '2' in thread group.
Script is ready, save it and run the load.
On completion, you can check the requests under listener ''View Result Tree".
No comments:
Post a Comment