10 Dynamic association of jmeter

The association in jmeter is implemented by the previously requested post-processor. There are two ways: XPath Extractor (generally used in xml) and regular expression extractor.

Take webtours login as an example to demonstrate login.jmx

1. Open the Web Tours association and register the account.
Find and click Start HP Web Tours Server in the Start menu (or find \HP\LoadRunner\WebToursStartServer.bat in the path where loadRunner is installed on the machine, and double-click to run).
Find and click on the HP Web Tours Application in the start menu (or open a browser, enter the address http://127.0.0.1:1080/WebTours/, and press Enter to enter) the home page.
On the Web Tours home page, click administration, enter the Administration Page, check the third item, click update, and return to the home page.
You can log in with your own account (sign up now), or log in with the default account password (jojo/bean).

2.badboy recording webtours login

3. Import jmeter

4. Find the request that needs to be associated (nav.pl)
Right click on request 1-->Add-->Post-processor-->Regular expression extractor-->Configure as shown below

Regular expression section configuration description:
- Reference name: The parameter name to be referenced by the next request. If you fill in session, you can refer to it with ${session}.
- Regular expression: The part enclosed in () is what is to be extracted, . matches any character, + matches one or more times, ? stops after the first match is found.
-Template: Quoted with $$, if more than one parameter (enclosed by multiple brackets) is taken in the regular expression, then the parameter group needs to be specified here, if the parameter is $1$, it means to get the first one value, $2$ means get the second value.
- Matching numbers: 0 means take a random value, -1 means take all values ​​and store them in an array.
- Default value: If the parameter does not get a value, it will be given a value by default. Normally empty.

Right click on Request 1-->Add-->Assertion-->Response Assertion-->Add "Mode to Test" as ${session}.
Right click on Request 1-->Add-->Listener-->Assertion Result.
Click Request 2-->Modify the parameters as follows

5. Run View

 

Guess you like

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