Executing specific groups of JMeter threads in a test plan

I have read similar posts with the same question as mine, but I lacked the details to figure it out. So I was wondering if someone could fix what I am doing wrong. And as stated, I want to start a separate thread group from a test plan using the CLI.

So, my test plan contains 4 groups of topics. Each thread group is exactly the same, except that the Cookie Manager in each thread group contains a different value for a specific Cookie. So when I run from the command line, I only want to tell JMeter to run topic 1 or 2 or 3 topics, etc. What I've read so far is that you can use a While controller and a variable to accomplish this, but I can seem to work.

My test plan looks like this:

 
+ Test Plan - Logging-In
   + Thread Group - Server 1 Login
       - While Controller (* with variable "server1ThreadActive")
       - HTTP Request Defaults
       - Cookie Manager
       + HTTP Request - Load Homepage
       + HTTP Request - Load Login Page
       + HTTP Request - Login Form
       + HTTP Request - Do something
       + HTTP Request - Do something else
       + HTTP Request - Logout
   + Thread Group - Server 2 Login
       - While Controller (* with variable "server2ThreadActive")
       - HTTP Request Defaults
       - Cookie Manager
       + HTTP Request - Load Homepage
       + HTTP Request - Load Login Page
       + HTTP Request - Login Form
       + HTTP Request - Do something
       + HTTP Request - Do something else
       + HTTP Request - Logout

So the test plan above has two more identical threadgroups for servers 3 and 4, as you might imagine ... I have While loops configured in the correct places?

- FIRST TRY -

While controllers: . I had the following conditions for each respective thread:

   Condition (function or variable) = "$ {__ P (server1ThreadActive)}" == "false"

Command line: Then, to try and execute only Thread for Server 2, I would use this in the CLI:

   jmeter -n -t Server_Login.jmx -Jserver1ThreadActive = true

RESULT: This caused all 4 threads to run when I was just trying to start Server 2 Thread.

- SECOND TRY -

While controllers: 2nd I had the following conditions for each respective thread:

   Condition (function or variable) = $ {__ P (server1ThreadActive)}

Command line: Then, to try and execute only Thread for Server 2, I would use this in the CLI, assuming that without assigning a value in the controller to default to true, so I set all vars to false except the one I want to run:

   jmeter -n -t Server_Login.jmx -Jserver1ThreadActive = false -Jserver3ThreadActive = false -Jserver4ThreadActive = false

RESULT: This caused all 4 threads to run when I was just trying to start Server 2 Thread.

There were a few more things I tried, but I assume they were wrong since I had the same result. I also tried to add a User Defined Variables section and create 4 vars but couldn't figure it out ... I even tried to create a file called "Server_Login.properties" and inserted these variable names, one per line, using the value set to false for each of them and enabled it on the command line with the -S option , but no such luck ...

Can anyone tell me where I am going wrong? Any thoughts or suggestions would be greatly appreciated!

Thanks, Advance,
Matt

+3


source to share


1 answer


See here for details.

http://www.testautomationguru.com/jmeter-manage-test-plan/


If the number of thread users is 0, JMeter will not execute the thread group at all.

So, you can select the thread group you want to start using the variables for the Thread group - User count.

Using properties:

Has a properties file with properties and value below (to execute only thread group 2)

threadgroup1.users=0
threadgroup2.users=10
threadgroup3.users=0
threadgroup4.users=0

      



The field Thread Group

is the number of threads, use $ {__ P (threadgroup1.users)}

command line parameter to pass the properties file,

 jmeter -n -t /path/to/test.jmx -l /path/to/log.jtl -p /path/to/file.properties

      


Using custom variables:

Just create a custom variable and corresponding values.

Please use it directly in your test using ${threadgroup1.users}

+2


source







All Articles