当前位置:网站首页>Interface use case design
Interface use case design
2022-06-28 21:06:00 【Cool leg hair!】
Interface use case design
Interface use case design
What is writing about
- Prevent missing test at test points . Clarity of organization
- Easy to assign work , Evaluate workload and time
- Use during interview !
Test point of interface test
Test points are called test dimensions .
![[ Failed to transfer the external chain picture , The origin station may have anti-theft chain mechanism , It is suggested to save the pictures and upload them directly (img-Ow4UWNio-1656216457940)( The interface test - The first 02 God - Class notes .assets/image-20210708095129193.png)]](/img/85/77ccf10374bd03a63ff9c8dcd9ab5b.png)
A functional test
- Single interface function :
- A single business module in manual testing , Generally, it corresponds to an interface .
- Log in to business ——> Login interface
- Join the shopping cart business ——> Join the shopping cart interface
- Order business ——> Order interface
- Payment business ——> Payment interface
- With tools 、 Code . Bypass the front-end interface , The data needed to organize the interface , Expand the interface test .
- A single business module in manual testing , Generally, it corresponds to an interface .
- Business scenario functions :
- According to the actual situation of users Use scenarios , carding Interface business scene .
- When organizing business scenarios , Usually just do positive Test it ( Consistent with manual ).
- It is generally recommended to use the least Use cases Covering the most business scenarios .
- Sign in —— Search for products —— Plus shopping cart —— Place an order —— payment —— evaluation
Performance testing
- Response time
- throughput
- Concurrent number
- Server resource utilization
Security testing
Attack security . —— It has nothing to do with the test engineer .
Business security . —— The direction of the test .
Whether sensitive data is encrypted
![[ Failed to transfer the external chain picture , The origin station may have anti-theft chain mechanism , It is suggested to save the pictures and upload them directly (img-PwqfD43Y-1656216457941)( The interface test - The first 02 God - Class notes .assets/image-20210708103259396.png)]](/img/8f/b82fc2bbd56cd27985a1467a7c5906.png)
SQL Inject : Where the user can enter data , write in SQL sentence .
- SQL Inject security , Malicious written by the user SQL sentence , Not execute , Query the database !
Design methods and ideas
The same as manual design
- Manual testing Corresponding Functional test points , Functions corresponding to interface test Exactly the same .
tpshop Shopping Mall Sign in page , Key points of manual function test case design :
- Whether the page layout meets the requirements
- test user name Input box , Whether the input data is correct .
- test password Input box , Whether the input data is correct .
- test Verification Code Input box , Whether the input data is correct .
tpshop Shopping Mall Sign in page , Key points of interface test case design :
- test user name The input box corresponds to username Value Whether it is right .
- test password The input box corresponds to password Value , Whether it is right .
- test Verification Code The input box corresponds to verify_code Value , Whether it is right .
![[ Failed to transfer the external chain picture , The origin station may have anti-theft chain mechanism , It is suggested to save the pictures and upload them directly (img-phS6ypxW-1656216457941)( The interface test - The first 02 God - Class notes .assets/image-20210708105012588.png)]](/img/26/c18a91994cfcdaf068cacc8d896c15.png)
Different from manual design
- Manual testing , Test whether the data written into the input box is correct . Interface test Parameters Corresponding Parameter values Whether it is right .
- The interface test , Not just for The parameter value is carried out , You can also target Parameter itself To test .
- Forward parameter :
- Required parameters : be-all Mandatory ( Required ) Both contain .
- Combination parameter : be-all Mandatory + Any one or more optional parameters .
- All parameters : be-all Mandatory + be-all Optional parameters
- Reverse parameter :
- Multiple parameters : There are one or more required parameters ( You can specify any )
- Shaoshen : One or more required parameters are missing .
- No arguments : There are no required parameters .
- bad parameter : Parameter name input error .
- Forward parameter :
Single interface test cases
manual Test case documentation 8 The big thing :
Number 、 Use case name ( title )、 modular 、 priority 、 Preset conditions 、 Test data 、 Operation steps 、 Expected results
Interface Test case document 10 elements :
- Number 、 Use case name ( title )、 modular 、 priority 、 Preset conditions 、 Request method 、URL、 Request header 、 Request body ( Request data )、 Expected results
![[ Failed to transfer the external chain picture , The origin station may have anti-theft chain mechanism , It is suggested to save the pictures and upload them directly (img-Enhi2Len-1656216457941)( The interface test - The first 02 God - Class notes .assets/image-20210708112958875.png)]](/img/f8/1dcdd93df18e5d98100ff3fef5377d.png)
Analyze interface documents , With “ Login interface ” For example :
- Request method :post
- URL: “ system information ” Medium Protocols and domain names + /api/sys/login
- Request header :Content-Type : application/json
- Request body :{“mobile”:“13800000002”,“password”:“123456”}
- Expected results : {“success”:true,“code”:10000,“message”:“ Successful operation !”,“data”:“f5050a1b-7919-444c-9ec4-3c1a7286536d”}
- data: The value is generated successfully by login Token data . This data Will change regularly .
| Number | Use case name | modular | priority | Preset conditions | Request method | URL | Request header | Request body ( Request data ) | Expected results |
|---|---|---|---|---|---|---|---|---|---|
| login_001 | Landing successful | Sign in | p1 | Account number is registered | POST | { agreement + domain name }/api/sys/login | Content-Type:application/json | {“mobile”:“13800000002”,“password”:“123456”} | Status code :200 {“success”:true,“code”:10000,“message”:“ Successful operation !”,“data”:“f5050a1b-7919-444c-9ec4-3c1a7286536d”} |
Interface test case test point of login module :
- The number
- positive :
- Login successful
- reverse :
- User name is empty
- The user name contains special characters 、 Letter
- User name exceeds 11 position (12 position )
- Insufficient user name 11 position (10 position )
- User name is not registered
- The password is empty.
- The password contains special characters 、 Letter
- The password for 1 position
- The password for 100 position
- Wrong password
- positive :
- Parameters ( Interface test specific )
- positive :
- Required parameters : Correct user name + Correct password
- Combination parameter : Ignore
- All parameters : Correct user name + Correct password
- reverse :
- Multiple parameters : many abc:“123”
- Shaoshen ( Less mobile): No user name , Correct password
- No arguments : There are no parameters
- bad parameter ( Wrong phone number parameter name ):abc:1381234567, password:”123456”
- positive :
User name related 5 strip :
| login_002 | User name is empty | Sign in | p2 | —— | POST | { agreement + domain name }/api/sys/login | Content-Type:application/json | {“mobile”:“”,“password”:“123456”} | Status code :200 {“success”:false,“code”:20001,“message”:“ Wrong user name or password ”,“data”:null} |
|---|---|---|---|---|---|---|---|---|---|
| login_003 | The user name contains special characters 、 Letter | Sign in | p2 | —— | POST | { agreement + domain name }/api/sys/login | Content-Type:application/json | {“mobile”:“13800&#abc”,“password”:“123456”} | Status code :200 {“success”:false,“code”:20001,“message”:“ Wrong user name or password ”,“data”:null} |
| login_004 | User name super 11 position (12 position ) | Sign in | p2 | —— | POST | { agreement + domain name }/api/sys/login | Content-Type:application/json | {“mobile”:“138000000023”,“password”:“123456”} | Status code :200 {“success”:false,“code”:20001,“message”:“ Wrong user name or password ”,“data”:null} |
| login_005 | Insufficient user name 11 position (10 position ) | Sign in | p2 | —— | POST | { agreement + domain name }/api/sys/login | Content-Type:application/json | {“mobile”:“1380000000”,“password”:“123456”} | Status code :200 {“success”:false,“code”:20001,“message”:“ Wrong user name or password ”,“data”:null} |
| login_006 | User name is not registered | Sign in | p2 | Mobile phone number that does not exist in the database | POST | { agreement + domain name }/api/sys/login | Content-Type:application/json | {“mobile”:“16700542479”,“password”:“123456”} | Status code :200 {“success”:false,“code”:20001,“message”:“ Wrong user name or password ”,“data”:null} |
Password related 5 strip :
| login_007 | The password is empty. | Sign in | p2 | —— | POST | { agreement + domain name }/api/sys/login | Content-Type:application/json | {“mobile”:“13800000002”,“password”:“”} | Status code :200 {“success”:false,“code”:20001,“message”:“ Wrong user name or password ”,“data”:null} |
|---|---|---|---|---|---|---|---|---|---|
| login_008 | The password contains special characters 、 Letter | Sign in | p2 | —— | POST | { agreement + domain name }/api/sys/login | Content-Type:application/json | {“mobile”:“13800000002”,“password”:“123&%rt”} | Status code :200 {“success”:false,“code”:20001,“message”:“ Wrong user name or password ”,“data”:null} |
| login_009 | password 1 position | Sign in | p2 | —— | POST | { agreement + domain name }/api/sys/login | Content-Type:application/json | {“mobile”:“13800000002”,“password”:“1”} | Status code :200 {“success”:false,“code”:20001,“message”:“ Wrong user name or password ”,“data”:null} |
| login_010 | password 100 position | Sign in | p2 | —— | POST | { agreement + domain name }/api/sys/login | Content-Type:application/json | {“mobile”:“13800000002”,“password”:“ place 100 A password consisting of characters ”} | Status code :200 {“success”:false,“code”:20001,“message”:“ Wrong user name or password ”,“data”:null} |
| login_011 | Wrong password | Sign in | p2 | —— | POST | { agreement + domain name }/api/sys/login | Content-Type:application/json | {“mobile”:“13800000002”,“password”:“888888”} | Status code :200 {“success”:false,“code”:20001,“message”:“ Wrong user name or password ”,“data”:null} |
Parameters related :
| login_012 | Required parameters ( All parameters ) | Sign in | p2 | —— | POST | { agreement + domain name }/api/sys/login | Content-Type:application/json | {“mobile”:“13800000002”,“password”:“123456”} | Status code :200 {“success”:true,“code”:10000,“message”:“ Successful operation !”,“data”:"f5050a1b-7919-444c-9ec4- 3c1a7286536d "} |
|---|---|---|---|---|---|---|---|---|---|
| login_013 | Multiple parameters | Sign in | p2 | —— | POST | { agreement + domain name }/api/sys/login | Content-Type:application/json | {“abc”:“123”,“mobile”:“13800000002”,“password”:“123456”} | Status code :200 {“success”:true,“code”:10000,“message”:“ Successful operation !”,“data”:"f5050a1b-7919-444c-9ec4- 3c1a7286536d "} |
| login_014 | Shaoshen ( Less mobile) | Sign in | p2 | —— | POST | { agreement + domain name }/api/sys/login | Content-Type:application/json | {“password”:“123456”} | Status code :200 {“success”:false,“code”:20001,“message”:“ Wrong user name or password ”,“data”:null} |
| login_015 | No arguments | Sign in | p2 | —— | POST | { agreement + domain name }/api/sys/login | Content-Type:application/json | {“success”:false,“code”:99999,“message”:“ I'm sorry , The system is busy , Please try again later !”,“data”:null} | |
| login_016 | bad parameter (mobile Wrong parameter name ) | Sign in | p2 | —— | POST | { agreement + domain name }/api/sys/login | Content-Type:application/json | {“abc”:“13800000002”,“password”:“123456”} | Status code :200 {“success”:false,“code”:20001,“message”:“ Wrong user name or password ”,“data”:null} |
Business scenario test cases
- How to use , How to design business .
- With the least number of test cases , Try to cover as many interfaces as possible .
Analyze test points
in the light of “ Employee management ” Business scenario :
- Sign in —— Add employees —— Query employees —— Modify employees —— Query again —— Delete employee —— Query employee list
Add employees
Request method :post
URL: { agreement + domain name }/api/sys/user
Request header :
- Content-Type: application/json
- Authorization: Bearer f5050a1b-7919-444c-9ec4-3c1a7286536d ( Specific data source Successful login returns In response body data Value )
Request body ( Request data ):{“username”:“ Einstein ”,“mobile”:“17289432100”,“timeOfEntry”:“2021-07-12”,“formOfEmployment”:1,“departmentName”:“ test 0607”,“departmentId”:“1412421425733664768”,“workNumber”:“234”,“correctionTime”:“2021-07-30T16:00:00.000Z”}
![[ Failed to transfer the external chain picture , The origin station may have anti-theft chain mechanism , It is suggested to save the pictures and upload them directly (img-sJhILEWQ-1656216457942)( The interface test - The first 02 God - Class notes .assets/image-20210708155543953.png)]](/img/79/cd4740744ac695d1f7526b28a6ca27.png)
Expected results :
- Status code :200
- {“success”:true,“code”:10000,“message”:“ Successful operation !”, “data”:{“id”:“113749504”}}
| Use case name | modular | priority | Preset conditions | Request method | URL | Request header | Request body ( Request data ) | Expected results |
|---|---|---|---|---|---|---|---|---|
| Add employees | Employee management | p0 | Login successful | post | { agreement + domain name }/api/sys/user | Content-Type: application/json, Authorization: Bearer f5050a1b-7919-444c-9ec4-3c1a7286536d | {“username”:“ Einstein ”,“mobile”:“17289432100”,“timeOfEntry”:“2021-07-12”,“formOfEmployment”:1,“departmentName”:“ test 0607”,“departmentId”:“1412421425733664768”,“workNumber”:“234”,“correctionTime”:“2021-07-30T16:00:00.000Z”} | Status code :200 {“success”:true,“code”:10000,“message”:“ Successful operation !”, “data”:{“id”:“113749504”}} |
Query employees
- Request method :GET
- URL: { agreement + domain name }/api/sys/user/:target
- Request header :
- Content-Type: application/json
- Authorization: Bearer f5050a1b-7919-444c-9ec4-3c1a7286536d ( Specific data source Successful login returns In response body data Value )
- Request body :
- nothing
- Return the data :
- Status code :200
- {“success”: true,
“code”: 10000,
“message”: “ Successful operation !”,
“data”: { Details of the employee queried } }
| emp_manager_002 | Query employees | Employee management | p1 | Login successful | GET | { agreement + domain name }/api/sys/user/:target | Content-Type: application/json, Authorization: Bearer f5050a1b-7919-444c-9ec4-3c1a7286536d | Status code :200 {“success”: true, “code”: 10000, “message”: “ Successful operation !”, “data”: { Details of the employee queried } } | |
|---|---|---|---|---|---|---|---|---|---|
Modify employees
| emp_manager_003 | Modify employees | Employee management | p0 | Login successful | PUT | { agreement + domain name }/api/sys/user/:target | Content-Type: application/json, Authorization: Bearer xxx | {“username”:“ Peppa Pig ”} | Status code :200 {“success”:true,“code”:10000,“message”:“ Successful operation !”, “data”:{“id”:“xxx”}} |
|---|---|---|---|---|---|---|---|---|---|
Returns... In the data id , representative Modified employee id ( It's a data that changes ).
Delete employee
| emp_manager_004 | Delete employee | Employee management | p0 | Login successful | delete | { agreement + domain name } /api/sys/user/:target | Content-Type: application/json, Authorization: Bearer xxx | Status code :200 {“success”:true,“code”:10000,“message”:“ Successful operation !”,“data”:null} | |
|---|---|---|---|---|---|---|---|---|---|
Query employee list
| emp_manager_005 | Query employee list | Employee management | p0 | Login successful | GET | { agreement + domain name } /api/sys/user?page=1&size=10 | Content-Type: application/json, Authorization: Bearer xxx | Status code :200 { “success”: true, “code”: 10000, “message”: “ Successful operation !”, “data”: { “total”: xxxx, “rows” [ {},{},… 10 Details of employees ] } } |
|---|
边栏推荐
- 在哪个软件上开户比较安全,开户流程是什么?
- API gateway Apache APIs IX helps the evolution of snowball dual active architecture
- 精通数据分析能力,收入翻倍?什么才是最强竞争力
- LeetCode188. 买卖股票的最佳时机IV
- LeetCode每日一题——710. 黑名单中的随机数
- [learning notes] Introduction to principal component analysis
- Figure neural network can also be used as CV backbone model. Huawei Noah Vig architecture is comparable to CNN and transformer
- LeetCode226. Flip binary tree
- Various types of long
- How to use dataant to monitor Apache apisex
猜你喜欢

Leetcode daily question - 515 Find the maximum value in each tree row

Automatic operation and maintenance platform based on Apache APIs

Leetcode 36. Effective Sudoku (yes, once)

Application practice | 1billion data second level correlation. Huolala's OLAP System Evolution Based on Apache Doris (with PPT download)
How to recover after Oracle delete accidentally deletes table data

Pyechart drawing multiple Y-axis line graphs

学习太极创客 — MQTT 第二章(八)ESP8266 MQTT 用户密码认证

Pie (poj3122) super detailed and easy to understand binary introduction
![[Note: analog MOS integrated circuit] bandgap reference (basic principle + current mode + voltage mode circuit explanation)](/img/cd/be62272d465ca990456c222b38df67.png)
[Note: analog MOS integrated circuit] bandgap reference (basic principle + current mode + voltage mode circuit explanation)

Bitbucket 使用 SSH 拉取仓库失败的问题
随机推荐
Please allow the "imperfection" of the current domestic Tob
ANR无响应介绍
Bitbucket 使用 SSH 拉取仓库失败的问题
LeetCode560. 和为K的子数组
LeetCode123. The best time to buy and sell stocks III
题解 The Blocks Problem(UVa101)紫书P110vector的应用
Ehcache配置资料,方便自己查
[graduation season · advanced technology Er] hard work can only pass, hard work can be excellent!
How to understand the fast iteration of cloud native database?
RT thread thread synchronization and thread communication
Ehcache configuration data, convenient for self checking
The principle and source code analysis of Lucene index construction
LeetCode122. 买卖股票的最佳时机II
券商公司开户哪个最靠谱最安全呢
Leetcode daily question - 324 Swing sort II
The comprehensive application of the setstack computer (uva12096) Purple Book p116stl
请问同业存单是否靠谱,安全吗
学习太极创客 — MQTT 第二章(八)ESP8266 MQTT 用户密码认证
Resilience4j retry source code analysis and retry index collection
LeetCode121. The best time to buy and sell stocks