Appeal:

1. Set the API test sequence freely; 2. There is data association between apis, for example, the request parameters of the back interface will bind the return results of the front interface, etc. 3. Verify the returned results; 4. Support data processing, such as password encryption when testing the login interface; 5, support advanced code use cases, can use code to achieve the purpose of controlling the test process, the general language is JS;

I used Postman before, but I felt sad when I talked about it too much. Later I saw Eolinker on the forum, and then I tried it, and it could implement all the functions mentioned above. More interesting is support UI interface to create automated testing products, this feeling, much better than home! Here we share automated tests in simple mode.

Introduce a,

Once logged in, create an API project, input the API documentation, and then switch to the automated testing function to test.

Singletons and use cases

Singletons are the basic unit below automated testing. In layman’s terms, singletons are “test conditions and results for a single API.” For example, there is a user login interface that passes ABC and 123 as request parameters and returns “OK” as a result of success.

A use case is a collection of multiple singletons. A use case can contain 1 to infinite singletons and combine these singletons in sequence. For example, test the complete user login process (register – login – judge login status – log out).

Environmental variables

Like Postman, eoLinker provides environment variables to help users quickly switch between testing API environments without changing the API (for example, the parameters and addresses of the development and production environments may be different).

The difference is that eoLinker environment variables are more powerful. In addition to setting global variables, eoLinker can set all API address prefixes, request headers and other information.

Create a good environment in the environment management, in the automatic test can be switched according to different environment at any time, very convenient.

4. Create a singleton

If you have already entered the API information in interface management, you can directly import the interface document when creating a singleton, which saves a lot of time. Or we can manually enter the singleton information.

These include:

1. Singleton names

2, the API URL

Request parameters

4. Judgment conditions for return results

Because this article is about automated testing in easy mode, all of the above will be done in the UI without writing any code, making it much easier to operate.

5. Set data association between singletons

Reviewing the user login process (register – login – determine login status – Log out), we find that the request parameters of all apis except the first register API more or less use the return values of the previous APIS. For example, the login user name and password are the registered user name and password. To determine the login status, you need to know the token after login.

EoLinker’s automated tests also provide the ability to easily set up data associations between apis with a graphical interface. When filling in the request parameter information of the singleton, the “Associate” button will appear on the right side, and you can click it to select the return result of the API to be associated with the request parameter.

Vi.API automation testing

After editing all the singletons, it’s time for the final testing phase. EoLinker can test singletons individually or use cases in batches.

Clicking the test button in the use case will test all the APIS and provide feedback when an error is reported, such as a comparison with the preset result.

7. Example (Register – Login – Judge login status – Log out)

  1. Create a registration singletonCopy the code

2. Set request parameters and return result criteria

3. Analogous to creating a subsequent API singleton, but can add an association condition to the request parameters (the token in the figure below is bound to the token value returned by the previous login interface)

4. Test and check the returned results

5. After the test is completed, the whole process does not exceed 10 minutes, and every time after the project is updated, all the automatic tests can be run again, which greatly saves the development and test time.

EoLinker also provides the ability to import Postman data, so consider ditching Postman from now on.