In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-30 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/02 Report--
The thread group component is the starting point for any test plan. All components in a test plan must be under a thread. All tasks are based on thread groups.
1. Threads (Users) thread users
As you can see in the figure above, jmeter has three options for adding thread groups with different names, but after creation, the interface is exactly the same.
1 、 setup thread group
A special type of ThreadGroup that is used to perform necessary actions before executing a regular thread group. The thread behavior mentioned under "setup thread group" is exactly the same as that of a normal thread group. The difference is the order of execution-it is triggered before the normal thread group executes.
Examples of application scenarios:
A. when testing the database operation function, it is used to perform the operation of opening the database connection.
B, when testing the user's shopping function, it is used to perform user registration, login and other operations.
2 、 teardown thread group
A special type of ThreadGroup used to perform necessary actions after the execution of a regular thread group is complete. The thread behavior mentioned under "teardown thread group" is exactly the same as that of a normal thread group. The difference is the order of execution-it is triggered after the execution of the normal thread group.
Examples of application scenarios:
A. when testing the database operation function, it is used to perform the operation of closing the database connection.
B, when testing the user's shopping function, it is used to perform the user's exit and other operations.
Tips:
By default, the TearDown thread group will not run if the test completes as expected. If you want to run it, you need to select the check box "Run tearDown Thread Groups after shutdown of main threads" from the Test Plan interface.
Maybe you still don't quite understand the difference between them and ordinary thread groups. But if you have ever used junit, you should be familiar with the words setup and teardown.
If you are familiar with loadrunner, you should know that in addition to the core content of the real script in action, there are init scripts for initialization and corresponding end script blocks after testing. So here setup thread group and teardown thread group refer to these two parts respectively.
3. Thread group (thread group)
This is the thread we usually use. Generally speaking, a thread group can be regarded as a virtual user group, and each thread in the thread group can be understood as a virtual user. Multiple users perform the same batch of tasks at the same time. Each thread is isolated and does not affect each other. During the execution of one thread, the variable of the operation will not affect the variable value of other threads.
2. Basic settings of thread group
The following data can be set in the thread group interface to control the thread group:
1. Actions to be performed after sampler error:
Continue: ignore errors and continue execution
Start Next Thread Loop: ignores the error, terminates the thread's current loop, and executes the next loop.
Stop thread: the current thread stops execution, which does not affect the normal execution of other threads.
Stop the test: the entire test will stop after all currently executing threads have finished executing
Stop test now: the entire test will stop immediately, and the currently executing sampler may be interrupted.
These configuration items control whether the execution strategy for testing when an error is encountered continues to be executed.
2. Set the number of threads:
The number of threads is the number of concurrency, and each thread will run the test plan completely independently without interfering with each other. Multiple threads are used to simulate concurrent access to the server.
3. Set ramp-up period:
Ramp-up period is used to set the time required to start all threads. If 10 threads are selected and the ramp-up period is 100 seconds, then JMeter will take 100 seconds to get 10 threads up and running. Each thread will start 10 (100) seconds after the previous thread starts.
When this value is set to a small value and the number of threads is set to a large number, it will put a heavy load on the server at the beginning of execution.
In the thread configuration shown in the following figure, there are 5 threads with a start time of 5 seconds, and each thread executes two loops. Then the startup delay between each thread is 1 second.
4. Set the number of cycles:
This sets the number of cycles per thread before the thread group ends, and if the number is set to 1, JMeter executes the test plan only once before stopping.
5 、 Delay Thread creation until needed:
By default, all threads are created at the start of the test. If this option is checked, the thread will only be created when it is needed appropriately.
Thread group scheduler settings
Scheduler configuration can control the execution time of thread groups more flexibly.
1. Duration (seconds):
Controls the duration of test execution, in seconds.
2. Startup delay (seconds):
Controls how long the test starts execution, in seconds.
3. Startup time:
The control test starts at some point in time. However, this configuration is overridden by the Startup delay configuration.
4. End time:
Controls the end time of test execution. However, this configuration is overwritten by the duration configuration.
If you do not want to execute immediately, you can control the start and end times of test execution through the scheduler.
When the test starts, if the scheduler is set, JMeter will wait until it is time to start. At the end of each cycle, JMeter will check to see if the end time has been reached and, if so, stop running; otherwise, the test will continue to run until the repetition limit is reached.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.