Jmeter pass value instance across thread groups

Reprinted: http://www.51testing.com/html/01/n-3725501.html
​​ ​Jmeter
is a tool, a very useful tool. After we use it for stress testing , we can also use it to Do automated testing , but when doing automation we

Need to take into account the flow of the process and sequential layout, so what should we do at this time?

For the division of modules, we may be able to use the controller to divide, but sometimes in order to separate a module, I need to use the thread group to divide, but the thread group and the

The values ​​of some parameters need to be passed between thread groups, what should I do?

PS: Jmeter's thread groups are independent

Take the token value returned by the logged-in interface as an example. Here I use a post-processor in combination with a pre-processor, as shown in the following figure:

1.1. After logging in, first obtain the token value, (use regular expressions to obtain the token value, according to the debugging, it can be seen that the token is successfully obtained)

1.2. Add the post-processor BeanShell PostProcessor after the http request, as shown in the following figure:

1.3. Write a script in BeanShell PostProcessor:

1.4. Add the preprocessor BeanShell PreProcessor in the test plan, as shown in the following figure:

1.5. Write a script in BeanShell PreProcessor, as shown in the following figure:

1.6. Refer to the value of usertoken to see if it is successfully passed across thread groups

ask:

Result: As shown in the figure below, the value of usertoken is successfully obtained:

PS: In order to ensure that each thread group does not perform chaotic execution, please tick the test plan to run each thread group independently

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325198378&siteId=291194637