The question pulled out in this session is how to use Eolinker for parameter binding.
Description: Parameter binding refers to parameter transfer between APIS, as shown in the figure. For example, in the scenario, there are two interfaces: 1, login interface, and 2, query interfaceIn automated testing, the “API” in a use case can be called a “step”, and API1 and API2 in a use case:
There are two ways to do this in Eolinker: 1. Transfer parameters in the form of “interface parameter extraction and binding” in Eolinker; 2. Set and reference environment global variables.
Method 1: interface binding value
For example, API1 returns:Since subsequent apis need to be able to receive this return content from API1, you need to go to the edit page of API1 and fill in the Settings “Extract return result module” to extract the returned result
The methods of extracting parameters are as follows: 1. Structure matching features of Json document: The hierarchy is clear, and the complete hierarchy and structure of extracted parameters need to be restored. As shown in figure API1, result is an array containing the object element user_id, and its hierarchy should be restored in the extracted format.In API2 the system automatically generates binding parameter rules. Finally, click Test to see the binding.
2, JsonPath matching features: batch acquisition, applicable to array using JsonPath rules to traverse the fields to be extracted, field groups (after extraction will be assembled into an array, need to be extracted in the form of array element items, such as ARR [0])Reference parameter values in API2Finally, the test results are obtained.If you want to get values without parentheses, you need to modify the writing rules for getting parameters in API2.The test results are as follows:
In API1, the specific value is iterated according to the XML structure of the returned valueGet it in API2
Get test results.
4. XPath matches API1 and returns the following:API1 parameter binding rules are as follows:API2 references the following binding parameters:Test results:
5, Raw API1 fill in Raw extract, and then reference in API2. The test results are as follows:
Global variables are classified into custom global variables and environment global variables. For details about custom global variables, see the help documents on the official website.Help.eolinker.com/api_managem… Parameter binding: 1. Get the return parameter in API1’s post-script and set it to the environment global variable2. Script references in front of API2 (examples in the figure are interface references and script code references respectively) Finally, the test results are obtained:
This paper sorted out two methods of eolinker parameter binding, welcome your comments and communication, you can feel free to contact the author if you have any questions in the process of using. Eolinker: popular API management and development platform in China, supporting Saas and private deployment. Use address: www.eolinker.com