The introduction

In addition to testing a single interface, we often need to test business processes for multiple interfaces that have data or logical associations, such as fetch captcha – register – login. The traditional test business process required writing a series of test code. Now, with the eoLinker full UI interface, slightly more complex API tests can be done without writing any code.

keywords

Process testing, automated testing, data correlation

After filling out the interface document, we often have to perform API business tests on multiple interfaces that have data or logical associations. The wonderful World Cup is in full swing, now I want to support the team to like the business.

Interface 1 Login: Before the test, you need to log in and use the returned token field as the request header field of the subsequent interface.

Interface 2 gets the team list: We need to request the team list array before we like it.

Interface 3 Thumbs up for a team: The team ID of the previous interface is used as the request parameter to send a thumbs up request.

Interface 4 Logout: In order not to affect the browser test environment, you need to log out and restore the environment before the test.

The following figure

If an interface has been established in the API document, you can batch add the existing interface in automatic common UI mode

I’ll go through how to handle complex parameters, match return values, take the last interface return value as the request parameter value, and so on.

The request parameters are processed

For the login interface, I use the built-in encryption method of eoLinker to encrypt the request parameter userPassword with MD5.

In pre-request code injection, just need to understand some simple object assignment, for loop syntax you can use Javascript, Jquery request parameters, request headers, etc.

Match the return parameters

For interface 2, I need to judge the return value before deciding whether to continue the automation. The test stops by default when eoLinker verification fails. Verification rules:

  • The value of statusCode is 000000
  • The first element in the list is Team China, with teamID as the number 1

Verification rules entered by eoLinker:

Note The type (string, int, Boolean, float, array, object) and hierarchy when filling in matching rules.

The return value of the previous request is used as the request parameter for this request

To like a favorite team, you need to pass the team teamID returned by the previous interface. Get the return value of the team list:

The first step is to fill in interface 2: get the return parameters of the team list and provide the data structure for the associated parameters.

Select the type of teamList (select the right type for accurate association) and add a subfield operation to fill in teamName and teamID.

Step 2: Fill in interface 3: request parameters for team likes.

Click and the following popbox will appear. Select teamID.

Generate binding values.

< Response [11465].teamList [0].teamid> is the association parameter form specified by eoLinker, using the return value of the single book name wrapped in response[association ID of the interface (which can be viewed in the singleton list)]. Parameters. Because the return value’s subargument teamList is an array, you need to append the element number, with the first element being 0, and so on. Correlation parameters can be used in the request header, request body (form-data, RAW), and REST parameters.

The test report

Using normal UI automation mode, you can complete a series of business process tests and generate detailed test reports with just a click of the mouse.

EoLinker, efficient, professional, standard, make interface management more simple!

Official website: www.eolinker.com