1

Need to load test a Oracle database the requirement is to fire sql queries concurrently to the database reading the varaibles from a CSV file is this feasible ?

Have a CSV file with values like

Name        Email
Justin      [email protected]
George      [email protected]
...
Micheal     [email protected]

And then have 10,20,30 users fire of queries like

select name,phone,city
from address
where name = <<feild1-from-csv>>
and email = <<feild2-from-csv>>
...

1 Answer 1

1

I'd suggest splitting your test logic into 2 separate pieces:

  1. Load information from CSV and store it as JMeter variables
  2. Execute SQL code against Oracle using variables from point 1

In regards to implementation I'd suggest to use 2 separate Thread Groups, the first one will be loading stuff from CSV, the second one will be doing actual testing.

Important: don't forget to check "Run Thread Groups Consecutively" box at TestPlan level to assure that second thread group runs after first one.

Example configuration of 1st thread group:

  1. Counter

    • Start - 1
    • Increment - 1
    • Reference name - counter
  2. CSV Data Set Config

    • Filename - path to your csv file
    • Variable names - name, email
    • Delimiter - if you're using TAB - "\t", if comma - "," without quotes
    • Allow quoted data - False
    • Recycle on EOF - False
    • Stop thread on EOF - True
    • Sharing mode - All Threads
  3. Beanshell Sampler (this one is optional, JMeter 2.10 is smart enough to store variables for you but I prefer to control everything myself)

Code for Beanshell sampler shoud look as follows:

props.put("name" + vars.get("counter"), vars.get("name"));

props.put("email" + vars.get("counter"), vars.get("email"));

It fetches current "name" variable and stores it as name + counter property.

So given 3 lines is CSV file you'll have following properties:

name1=Justin
[email protected]
name2=George 
[email protected]
name3=Micheal
[email protected]

You can use Debug Sampler to see JMeter Variables and Properties values

After that in second thread group you can refer stored properties as:

${__P(name1,)}

or

${__property(name1,,)}

in your JDBC Request Sampler.

Both should work.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.