当前位置:网站首页>Postman learning

Postman learning

2022-06-22 18:44:00 It's a big deal


Preface

Tips :https://www.bilibili.com/video/BV1434y1h7vf?spm_id_from=333.1007.top_right_bar_window_history.content.click&vd_source=33acb67196498979ff3eb7ff24fccf9a Go to the link


Tips : The following is the main body of this article , The following cases can be used for reference

One 、Git request

Git Requests generally have no request body , Just focus on the request method and address .
test API Website :
https://api.apiopen.top/swagger/index.html

Two 、 Interface test process

1、 Get interface information : Interface document or packet capture

Use of bag grabbing F12. Switch to network, Better choose Fetch/xhr.

Video provided by the packet capturing test website :
testingedu.com.cn:8000/Home/user/login.html

 Insert picture description here

Required interface information :
The interface is in the process of passing to the server , Generate message , Message format : That's ok + head + body , It is divided into request message (request) And return message (response).

2.1.1 The composition of the request message

That's ok + head + body :
The request message is divided into four elements :
Request line : HTTP Methods and URL Address .
Request header : Generally, I don't pay much attention to . The only default concern is content-type Request format type .
Request body :get Generally, there is no request body , Never mind ,post put Method , Parameters are usually placed in the request body .

The format of the request body eg:
Type 1 :Content-Type: text/html; charset=utf-8
I understand it , This is like a package type of express delivery , If I take a popsicle and ask the courier to mail it , He would take a frozen box to hold , If I take a Book , He would take an ordinary box to hold .Content-Type It is equivalent to the packaging type .
Type 2 :Content-Type:application/json

2.1.2 The composition of the return message

Generally, only the request body and status code are concerned .
Common status codes :

Category The reason the phrase
1XXInformational( Informational status code ) The accepted request is being processed
2XXSuccess( Success status code ) The request is processed normally
3XXRedirection( Redirect the status code ) Additional operations are required to complete the request
4XXClient Error( Client error status code ) The server was unable to process the request
5XXServer Error( Server error status code ) Server processing request error

Link to the original text :https://blog.csdn.net/qq_35689573/article/details/82120851

2、 Edit request message ( copy ), Complete the request , In the process, modify the parameters according to your own test case design .

3、 Verify the returned results

postman Write the verification of expected results in , The so-called assertion .
stay tests/ Write assertion script in the test .

summary

postman It's easy to use .

原网站

版权声明
本文为[It's a big deal]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/173/202206221712519368.html