Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
397 views
in Technique[技术] by (71.8m points)

jmeter - Purpose of Throughput Controller?

I need some help to use JMeter. I want to record two different scenarios like clicking 2 different buttons. If i try to run for 2 users, one user should hit first button, another should hit another button concurrently.

I know this is the basic question. But i am new to this one. Thats why asking here. I have tried like below:


Thread Group
 -Throughput Controller
       --Login
       --Clicking 1st button
 -Throughput controller
       --Login
       --Clicking 2nd button

When i run with 2 users using CSV Data Set Config, both login takes same user.

And also i need to test for concurrency. I am not sure how to execute this one correctly. Could anyone can help me in this?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
  1. Throughput Controller will work correct if you have more than single iteration.
    I.e. you should have N loops (using Loop Controller e.g.) with child Throughput Controller set X percents (X is integer, 0 <= X <= 100) - so than X% from N loops is integer value too.
    You may look into this discussion for better examples and explanations.

  2. For your case you can try to use construction like the following:


Thread Group
Number of Threads = 2
Loop Count = 1
+- While Controller
   Condition = ${__javaScript("${login}"!="<EOF>",)}
   +- CSV Data Set Config
      Filename = users.csv
      Variable Names = login,pwd
      Delimiter = ,
   +- Loop Controller
      Loop Count = 10
      +- Login
      +- Throughput Controller
         Percent Execution
         Throughput = 50.0
         +- Clicking 1st button
      +- Throughput Controller
         Percent Execution
         Throughput = 50.0
         +- Clicking 2nd button
      +- Logout

where
- there are 2 threads (Thread Group: Number of Threads = 2) started simultaneously each with unique credentials extracted from csv-file (While Controller + CSV Data Set Config), used for Login;
- the whole test-flow - login > click button (either first or second) > logout - will be repeated N times using Loop Controller, which one makes Throughput Controller work.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...