In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-01 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/03 Report--
Introduction
As a developer, you sometimes need to assist the marketing department in development. for example, in marketing, you often increase the repurchase rate by giving users coupons. This article will show you how to build this business logic using the automated test [UI pattern] of the interface management tool eoLinker.
Keywords
Marketing, scheduled tasks, data association
Next, we take giving coupons to users as an example to build the process. After building the whole process, you will find that you no longer need to write complex code, you can do it in a few simple steps.
Catalogue
1. Process design
2. Process debugging
3. Scheduled tasks
4. Use tips
5. Summary
1. Process design
Let's first determine the interfaces needed to complete the business logic:
Interface 1 login: the most basic login interface, marketers log in to their own account.
API 2 gets the list of users: determine the list of users before issuing coupons.
API 3 gets the list of coupons: get various types of coupons.
API 4 gives coupons to users: take the return results of interfaces 2 and 3 as request parameters.
API 5 exit login: after the business process is completed, log out.
According to the above process design, I created five new interfaces in the following figure and adjusted the correct test order.
I have set four status codes for the return parameter statusCode of API 1, which corresponds to four possible situations. If there are more possibilities, you can continue to add them.
If the relevant interfaces have been established in the API document, the existing interfaces can be added in batch in the automatic normal UI mode.
When we have edited the interface and set up the data association, we just need to go back to the automated test page and click "Test all" to complete the test. The content of how to correlate data will be described below.
As you can see in the following figure, after we have completed the correct settings, we have obtained the successful test results.
2. Process debugging
In process testing, the return parameter of the previous interface may be the request parameter of the next interface. At this point, you need to use the associated data. For example, to send a coupon to a user, you need to pass the coupon couponID returned by the previous API. Here are two steps for data association:
Step 1: get the return value of the coupon list
We have three kinds of coupons of different denominations: full 100 minus 10, full 1000 minus 100, and full 10000 minus 1000, corresponding to different couponID.
Step 2: fill in the request parameters of API 4
The request parameters of interface 4 are the return parameters of interface 2 and interface 3.
Click the "Associate" button, and the following pop-up box will appear to select the data to be associated, for example, couponID is selected in the following figure.
Generate a bound value. As shown in the figure, both userID and couponID generate binding values.
The format of parameter values is in the form of associated parameters specified by eoLinker, using the return value response of the single book name package [the associated ID of the API (which can be viewed in the singleton list)]. Child parameters.
If the child parameter of the return value is an array, you need to add the element sequence number, the first element is 0, and so on. Such as couponList [0].
The associated parameters can be used in the request header, request body (form-data, raw), and REST parameters.
In debugging, the test report is also very important.
Using the normal UI automation mode, a detailed test report is generated after the test is completed, and the complete test report can be seen by viewing the details. If the test fails, it can be corrected in time through the test report.
3. Scheduled tasks
In the business process of this article, we can make the whole process execute automatically by timing the test task.
First of all, add this task to the scheduled test task, which is the secondary menu of automated testing. You need to add a grouping before adding tasks, for example, a new grouping of "giving away user coupons" is created here.
Here you need to fill in the name: "give coupons to users", the time setting is "permanent", the period is "one week", and the date is "10:00 and 6 p.m., Monday to Friday". Send the coupons according to this rule.
Select the previously set use case: coupons in the use case list
Confirm the test environment, fill in my mailbox, and then select the notification type. After this setting, we only need to check the email in the future to get all the information about the interface test to ensure the normal operation of the interface.
As shown in the figure above, each test history can be downloaded from the test task list, which is very convenient.
4. Use tips request parameters to process
Some parameters need to be encrypted before they are sent, such as passwords. In eoLinker, the parameter userPassword can be encrypted through code injection, such as
For interface 1, I use eoLinker's built-in encryption method to encrypt the request parameter userPassword with MD5 and SHA1.
In the right navigation bar of the code injection function, eoLinker currently has three encryption methods, including MD5, which can be called directly by clicking on it. If you want to use other encryption methods, you only need to know some simple syntax and you can use Javascript and Jquery code to encrypt. Of course, you can also do other processing on the request parameters before sending them.
Return parameter matching
In addition to processing the request parameters, the returned parameters also need to be verified. In this business, we only select specific users to send the corresponding coupons, which requires verification to match the returned parameters.
For interface 2, I need to judge the return value before deciding whether the automated test process will continue. If the eoLinker verification fails, I will stop the test by default. If you don't want to stop here, you can check "execute the next use case when the use case check bit fails." In this way, the test will continue even if it fails.
Let's talk about the verification rules.
Verification rules:
StatusCode is the string 000000
The couponID in the list is 1 century couponName minus 10
Verification rules filled in by eoLinker:
In the process of filling in the matching rules, we mainly choose the correct type (string, int, etc.) and hierarchical relationship for the parameters. For example, here the parameters couponList and couponID are different types, and couponID is a subfield of couponList.
5. Summary
Finally, complete the task and log in, and such a complete business process is completed. Business process testing through the UI mode of automated testing can not only write code, but also correct errors in time through the test report, which greatly improves the work efficiency compared with the traditional testing method.
For more updates, please go to the eoLinker Wechat official account. This article is transferred from the eoLinker official account.
Experience now: https://www.eolinker.com
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.