No need to write code, with interface management tools Eolinker efficiently complete the API testing process related business

Source: Internet
Author: User

Tags: MD5 ASC Register technology to complete automated HTTPS ORM Additions

Introduction

As a developer, it is sometimes necessary to assist the marketing department in the development, for example, in marketing, often by giving users a coupon to improve the rate of re-purchase. This article will show you how to build this business logic using the automated test [UI mode] of the interface management tool Eolinker.

Keywords

Marketing, timing tasks, data correlation

Next, we give the user a coupon as an example to build the process. Once you've built the entire process, you'll find that you don't need to write complex code anymore, just a few simple steps to complete.

Directory

1. Process Design
2. Process Commissioning
3. Scheduled Tasks
4. Using Tips
5. Summary

1. Process Design

Let's first determine which interface is needed to complete the business logic:

Interface 1 Login : The most basic login interface, marketing personnel login to their own account.
Interface 2 Get a list of users : Before issuing coupons, determine the user list first.
Interface 3 Get a list of coupons: Get all kinds of coupons.
Interface 4 give the user a coupon: The return result of interface 2 and interface 3 as the request parameter.
Interface 5 Sign out : After the orchestration is complete, log out.

In accordance with the above process design, I created a new 5 interfaces, while adjusting the correct test sequence.

The return parameter of interface 1 statusCode , I set 4 status code, just corresponds to 4 possible cases, if there are more possibilities, you can continue to add.

If the API documentation has established the relevant interface, you can add the existing interfaces in bulk in the automated normal UI mode.

When we edit the interface and complete the settings associated with the data, just go back to the Automated test page and click " Test All " to complete the test. The contents of how the data is associated will be described below.
As you can see, after we have completed the correct setup, we get a successful test result.

2. Process Commissioning

In a process test, the return parameter of the previous interface may be the request parameter of the next interface. This is when you need to use the associated data . For example, to send a coupon to the user, you need to pass the coupon returned on the previous interface Couponid. The following is a two-step data association:

    • First step: Get the return value of the coupon list
      We have coupons for 3 different denominations: 100 minus 10, 1000 minus 100 and over 10000 minus 1000, corresponding to different couponid.

    • Step two: Fill in the request parameters of interface 4
      The request parameter of interface 4 is the return parameter of Interface 2 and interface 3.

Click on the "association" button, the following box will appear, select the data to be associated, such as Couponid selected.

Generates a binding value. Both the UserID and the Couponid generate a binding value.
The format of the <response[39677].userList.userID> parameter value is the Eolinker-defined association parameter form, using the return value of the single-title package response The [Interface's association ID (which can be viewed in a singleton list)]. Sub-parameters.
If the sub-parameter of the return value is an array, you need to add the element ordinal, the first element is 0, and so on. such as Couponlist[0].
The association parameters can be used in the request header, the request body (Form-data, raw), and rest parameters.
In debugging, test reports are also very important.
With the normal UI Automation mode, after testing, a detailed test report is generated, and the complete test report can be seen by viewing the details. If the test fails, the test report can be corrected in time.

3. Scheduled Tasks

In the business process of this article, we can automate the entire process by testing tasks on a timed basis.
The task is added first in the two-level menu of the automated test-the timed test task. You need to add a group before adding a task, such as a new group of "Free user coupons".

Here you need to fill in the name: " give the user a coupon", the time set " permanent ", the period is " one week ", the date Select " Monday to Friday of the early 10 o'clock and six o'clock in the evening ", according to the rules to send coupons.
Select a previously set use case in the Use cases list : Coupons

Confirm the test environment, fill in my mailbox, and then select the notification type. Once this is set up, we can get all the conditions of the interface test by looking at the message and make sure the interface is working properly.


For example, each test history can be downloaded in the test task list, which is very convenient.

4. Request parameter processing using tips

Some parameters need to be encrypted before they are sent, such as passwords. In Eolinker, the parameter userpassword can be encrypted through the code injection function, for example
For interface 1, I use the Eolinker built-in encryption method to MD5 and SHA1 the request parameter UserPassword.

In the right navigation bar of the code injection function, Eolinker currently contains 3 encryption methods including MD5, which can be called directly by clicking on it. If you want to use a different encryption method, you just need to know some simple syntax you can use Javascript, Jquery code to encrypt. Of course, you can also do other processing of request parameters before sending.

Return parameter match

In addition to processing the request parameters, the parameters returned need to be verified, in this business, we only select specific users to send the corresponding coupons, which need to be verified to match the returned parameters.

For interface 2, I need to judge the return value before deciding whether the automated test process will continue, and eolinker the test by default when the validation fails. If you do not want to stop here, you can tick the " This use case check bit failed, still execute the next use case ". This will continue to test even if it fails.

Here's a check rule.

Validation rules:
StatusCode to String 000000
The Couponid in the list is 1,couponname to 100 minus 10.

Eolinker fill in the validation rules:

In the process of filling out the matching rules, the key is to select the correct type (string, int, etc.) and the hierarchical relationship for the parameters. For example, here the parameters couponlist and Couponid are different types, and Couponid is the subfield of couponlist.

5. Summary

Finally, complete the task and log out, so that a complete business process is complete. By automating test UI patterns for business process testing, you do not have to write code and can correct errors in a timely manner through test reports, which greatly improves productivity compared to traditional test methods.

Eolinker, efficient, professional, standardized, so that interface management more simple!

For more updates, please visit the Eolinker public number, which is transferred from the Eolinker public number.

Experience Now: https://www.eolinker.com

No need to write code, with interface management tools Eolinker efficiently complete the API testing process related business

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.

Tags Index: