Postman interface testing key points and error summary

This article mainly summarizes common errors and solutions that occur in the interface testing tool postman.

Request classification and specific parameter introduction:

  • GET request:  GET request is the most common request type and is most often used to query the server for information . If necessary, query string parameters can be appended to the end of the URL to send the information to the server.
  • POST request:
  • The most frequently used request after GET is POST request, which is usually used to send data that should be saved to the server . POST requests should submit data as the body of the request.

GET request parameters:

Now to query the data details with id 1544559104095219713, you only need to write the id and corresponding value under Paramas. You can also directly append ?id=1544559104095219713 to the URL address of the GET request. At this time, we can also see that under Params The id and corresponding value are automatically added, as shown in Figure 1.1.

Figure 1.1

 GET requests do not need to pass parameters, such as paging:

As shown in Figure 1.2, enter the paging interface address and click send.

Figure 1.2

POST request parameters:

For most post request parameters, parameter types are selected and parameters are passed in the body. This section introduces two commonly used post request parameter passing methods.

1.Pass parameters of from-data type:

from-data: For parameters whose data source is external files, you can pass in Text type or File type, and set the parameter name in the key column input box. For example, I set the parameter file name here to excel, and then select the corresponding file type. , select the File type; then Select Files in the Value column, as shown in Figure 2.1.

Figure 2.1

 2. Pass parameters from raw

The main parameter format is JSON type, and the incoming data needs to be passed in as a parameter in JSON format, as shown in Figure 2.2.

Figure 2.2

 Summary of interface test error points:

For the backend, writing the interface does not mean that the work is over. It is best to self-test to reduce the workload of joint debugging and post-testing. This part summarizes the errors and solutions that may occur in daily interface testing.

1."Request method  'POST/GET' not supported",如图3.1

 The current request method is not supported. Check whether the request method of the interface in the controller corresponds to the request method of the interface in postman.

Figure 3.1

2. "No handler found for GET /ecology/river/lis",如图3.2

 Generally, the interface URL is incorrect. Check whether the URL is written correctly.

It is also possible that the Mapper layer has not been scanned. Check the Mapper path of the corresponding interface.

Figure 3.2

 3. The request is unauthorized, as shown in Figure 3.3

Generally, the interface authentication is not released. There are two solutions:

  • 1. You need to add the Authorization of the interface and the corresponding value in the interface request header -----Headers, as shown in Figure 3.3.1
  • 2. Release the authentication of the interface in the background.



Figure 3.3.1 

Figure 3.3

 4.error nestexception ibatis error SQL Exception

This means that there is a problem with the program writing. Generally, the SQL statement is incorrect. There are mainly the following types:

  1. Entity class attributes do not correspond to database table fields.
  2. The SQL statement of the interface in the Mapper.xml file is incorrectly written: check syntax issues, attributes, and fields; note that database table field names cannot be SQL keywords.
  3. Check whether the database address is correct and Reconnect the database.

5. Request exception

Request exceptions are a big problem, mainly because the interface is written incorrectly. Check the interface content and troubleshoot the error.

The above are common interface testing errors in postman. I hope it can help everyone.

Guess you like

Origin blog.csdn.net/qq_44973310/article/details/127917128
Recommended