Jmeter Interface Test Series-test case variable parameterization Processing

Source: Internet
Author: User

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

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.