AMfromNBS
AMfromNBS

Reputation: 63

Alternatives to using CSV in JMeter (for generating usernames)

I have a JMeter Test Plan with following structure

Test Plan

**ThreadGroup1**
--CSV Data Config-001
----SimpleController
--------------LoginRequest
--------------Action-abc-Request

**ThreadGroup2**
--CSV Data Config-002
----SimpleController
--------------LoginRequest
--------------Action-xyz-Request

I have two CSV files which contain list of users like this..

**CSV-001**
Username1
Username2
.. ..
Username50

**CSV-002**
Username51
Username52
.. ..
Username100

In my scenario, I need to run a load test with say 100 users. 50 users login from ThreadGroup1 and other 50 users login from ThreadGroup2. Users from both threadgroups login simultaneously.

Currently, I have to go through process of manually creating/editing these CSV files whenever I change the number of total users.

Please suggest if there are any alternative time-saving & performance-efficient approaches through I which can fulfill my scenario requirements (without using CSV files).

I will appreciate, if you can explain the alternative solution with some details as I am quite new to JMeter stuff. Thanks.

Upvotes: 0

Views: 361

Answers (2)

JusMe
JusMe

Reputation: 288

Another idea is to use

Username${__threadNum}

for the first thread group and

Username${__BeanShell(ctx.getThreadNum()+Z+1)}

for the second, where Z equals the total number of threads in thread group 1. You also need to add 1 since ctx.getThreadNum() returns a thread number using a 0 based index, whereas the __threadNum function is 1 based.

Upvotes: 0

JusMe
JusMe

Reputation: 288

You can use a counter in each thread. The start value for the counter in the first thread would be 1, in the second 51. Be sure the 'Track counter independently for each user' check box is unchecked.

If you set the reference names to thread1Count and thread2Count respectively, you can use

Username${thread1Count} 

for the first thread and

Username${thread2Count}

for the second.

Upvotes: 0

Related Questions