using a lot of individual accounts on JMeter

[japanese(日本語)]

Prepare a lot of indivisual accounts and each of them access to the web system.

 

 

 

1.Prepare a text file including ID,Passwod

This file is delimitered by “tab” as follows.

user001 passwd001
user002 passwd002
user003 passwd003

 

2. Set JMeter As follows

 

(1)User Defined Variable

Add uid,passwd.

(2)Add HTTP Cookie Manager.

(3)Add Transaction Controller.

(3.1.)Add BeahShell PreProcessor. Write code as follows.

int threadNum = ${__threadNum}; 
String filename = "users.txt"; // wirte file name as full path.

String data;
BufferedReader br = new BufferedReader(new FileReader(filename));
String uid="";
String passwd="";

int num=0;
while((data = br.readLine())!=null){
  String[] token = data.split("t");
  uid = token[0];
  passwd = token[1];

  num++;
  if(num == threadNum){
    break;
  }
}
br.close();

vars.put("uid",uid);
vars.put("passwd",passwd)

 

(3.2) Add HTTP Request

This example assumed to login with posting uid and passwd .

Access URL:http://localhost/cgi-bin/login.cgi

HTTP Request:POST

Add Parameters  as follows

uid    ${uid}

passwd    ${passwd}

 

(4)Add Loop Controller

(4.1)Add HTTP Request

(4.2)Add HTTP Request

 

You can increse the number of Threads as many as the “user.txt” files line.