JMeter gets multiple return tokens to a local file and calls across thread groups

Source: Internet
Author: User

1. Open JMeter, create setup Thread Group

For the setup thread group and the teardown thread group, it is literally the installation thread group and the unload thread group, so it can be understood that for the initialization and completion of thread groups, Setup thread The group is all the preparation before we actually start the thread concurrency, which must be done before the threads group starts and has its own independent thread setting.

2, add the HTTP Information Investment Management tool
Place the header information needed by the interface here

3. Add interface information: Setup Thread group-->add-->sampler-->http request

4, because to get multiple login password from the local file to achieve multi-threaded testing, so here to use the CSV data file:

5. Only regular expressions are used to extract the token value returned by the login interface for subsequent interfaces to use:

Regular usage Instructions:
Reference name (Reference name): The name of the JMeter variable that stores the extracted result, which is the value, field, variable name that the next request needs to reference.

Reference method: Reference method: ${reference name}.

Regular Expressions (Regular expression): Use regular expressions to parse the result of a response, "()" means extracting some of the value from a string, and do not use "| |" unless you need to match the character yourself.

Template: Creates a string from a matching result, which is a set of values that are matched by a regular expression, meaning the number of values extracted to use (there may be multiple values that match, so use a template), start with 1 matches, and so on. Parameters can be used in combination with a value template, for example: "1-2" as a template the resulting value is a string that uses the "-" connection to combine the first matching content with the second matching content.

Matched number (match No): The result of a regular expression matching data can be seen as an array of values: 0 for random values, positive n for the nth value (e.g. 1 for the first value), and negative for all eligible values.

Default value: Defaults when matching fails, usually used for subsequent logical judgments, usually in English capitalization combinations of specific meanings, such as: ERROR.

6. Add the Post processor JSR223 Postprocessor to write the token data obtained from the regular to the local file:

7, add a new thread group, the thread group added is required to do the pressure test interface and related configuration:

Getting the token value from the local file still uses the CSV file operation.

8. Precautions
When obtaining tokens, you need to disable other thread groups and only open the interface to get tokens.
When there is token data in the file, then the interface to get token is disabled, and other thread groups that need to call token are opened.

JMeter gets multiple return tokens to a local file and calls across thread groups

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.