During the interface test, a complete set of Interface Test cases exist, and the latter test case uses the data in the request results of the previous test case. In this case, the median value of the parameterized test case is required. Direct use of variables may cause problems. In this case, you need to use beanshell to change it.
Example:
For example, the usertoken in interface 1 must be obtained after successful logon. In this case, you need to test the logon interface first, extract the usertoken during logon, and then configure the call in the test case. Before the request, convert the call in the test case to and extract the variable value for the request parameter call.
1. Extract usertoken from the interface for Successful Logon
(Regular Expression extraction)
2. Use the variable usertoken in the test case.
--- Usertoken indicates that the variable usertoken is used.
3. Before an HTTP request, add a beanshell Preprocessor to handle variable value transformation.
For example:
4. perform the test
In the request parameters, the obtained usertoken value can be correctly assigned to the sparameter variable and executed successfully.
Jmeter Interface Test Series-test case variable parameterization Processing