0
votes
  1. I am performing login test with multiple concurrent users.
    1. I have created a JDBC request to get username and password from patient table. and then Created a Test.CSV file using same data with the help of BeanShell assertion.
    2. Now pass this file name in CSV dataset configTest.csv.
    3. I am able to login with multiple users concurrently but facing an issue: when I am running the test first time. The file is not available at the same location because it is being created after the execution of thread group. If file is not there I am getting this in log: File Test.csv must exist and be readable.

To execute the same process, What I am doing is, keeping the JDBC request is different test plan. Firstly executing that test plan and then proceeding to the login.

I want to execute and keep both requests is the same test plan. one more thing If I am using the different thread group for these requests in the same test plan, Still facing the same issue.

2

2 Answers

0
votes

Jmeter execution order is:-

0-Configuration elements

1-Pre-Processors

2-Timers

3-Sampler

4-Post-Processors (unless SampleResult is null)

5-Assertions (unless SampleResult is null)

6-Listeners (unless SampleResult is null)

Based on above, it is evident that "csv data config" will be executed first before the JDBC sampler.

What I can think of, if you want to get the username/pwd in the same Thread Group then you can set username and password as properties using __setProperty() and fetch it using __property(). For this, use JSR223 Post Process after JDBC. You can also use any of the other know post processor/scripting language, it is just groovy is better for performance test.

Apache Groovy - Why and How You Should Use It

Hope it helps.

0
votes

The reason is that CSV Data Set Config is a Configuration Element and according to test elements Execution Order it is being initialised before anything else.

I would suggest going for __CSVRead() function instead, JMeter functions are evaluated at the time they're being called so the Test.csv file will exist at the time you will be getting credentials from it. See Apache JMeter Functions - An Introduction to get familiarized with JMeter Functions concept.

Also be aware that according to JMeter Best Practices it is recommended to switch to JSR223 Test Elements from Beanshell or other scripting languages.