API automated testing [postman generates reports]

There are two types of test reports generated by PostMan:

1. Console mode

2. The HTML test report uses a tool newman

Node.js is a component of the front end, which can be used mainly to develop asynchronous programs.

1. Console mode
1. Install node.js

Double-click node.js to install. After the installation is successful, enter node -v in the console to check whether the installation is successful.

2. Install newman

1) Enter the npm install -g newman --register=https://registry.npm.taobao.porg command in the console to install newman.

2) After the installation is successful, enter the newman -v command to check the newman version number.

 3) Export the report to the desktop in postman

4) Enter the command cd desktop in the console to enter the desktop. 

5) The exported file is a file in json format

 

 6) Then enter the command newman run interface test actual combat.postman_collection.json in the console, and then the test report is generated as follows:

2. HTML test report
1. View the HTML-based test report, but you need to install a plug-in. The command to install is: npm install newman-reporter-html.

2. After the installation is successful, execute the command: newman run Book.postman_collection.json -r html, and then generate an html report on the desktop, as shown in the figure below:

 3. HTTP authentication system
 The HTTP protocol has flaws. These flaws are mainly: The communication content is plain text, and the content is likely to be obtained by a third party without verifying the identity information of the communicating party. It is easy to be disguised and cannot prove the request header. The integrity of HTTP is based on these defects, so there is the HTTPS protocol. We can summarize HTTPS as: HTTPS=HTTP+encryption+authentication+integrity protection.

HTTP authentication system HTTP/1.1 version, the specific authentication methods used are: BASIC authentication, that is, basic authentication, DIGEST authentication, that is, digest authentication, SSL client authentication, FormBase authentication, that is, form-based authentication

BASIC basic authentication uses Base-64 encoding, but not encryption. It can be decoded without any additional information, so in the process of BASIC authentication on HTTP and other non-encrypted communication lines, it is easy for people to obtain information, and the security system is not high enough.

Basic authentication and status code 401 (unauthorized access)

 Basic authentication and status code 403 (permissioned but not accessible)

4. Related interview questions
1. Where is the interface document written?

YAPI's platform

2. Which tool do you use to capture packets?

charles

3. If you are given a service test, but there is no interface document, what will you do at this time?

Find the developer and ask the developer to talk about the logic of the service, the API provided by the service, and related information about the API (request method, request parameters, request URL)

4. How does PostMan do API automation testing?

By creating collections, creating new interfaces, writing test scripts, executing test scripts, generating reports, and exporting reports.

5. How are dynamic parameters handled in PostMan?

Taking login as an example, after successful login, a token is generated, and then the obtained token information is passed to the information of the next interface, and the obtained token is stored in the variable token, and then this variable will be called in the associated interface.

6. What is the difference between interface testing and UI testing (functional testing, UI automation testing)?

The interface test is more about the interaction between the client and the backend; the interface test can also completely test the product function test scenario; the UI test focuses on the interaction of the page and the verification of various prompt information on the page and business scenarios.
 

Guess you like

Origin blog.csdn.net/2301_76643199/article/details/130900769