Follow me to find out how Postman is used in the testing process, what it does and what it does

Postman common scenarios

Users need some methods to track web requests when they develop or debug network programs or web B/S mode programs. Users can use some network monitoring tools such as the famous Firebug and other web debugging tools.

Application scenarios

  • Postman is a popular interface testing tool that can send almost any type of HTTP request. The difference between PPostman and browsers is that browsers cannot output JSON, but Postman returns results more intuitively

  • Postman is an interface testing tool. When doing interface testing, Postman is like a client. It can simulate all kinds of HTTP requests initiated by users and send the request data to the server to obtain the corresponding response results, so as to verify whether the result data in the response matches the expected value. And to ensure that developers can timely deal with the bugs in the interface, so as to ensure the stability and security of the product after launch.

The postman interface

Functional areas: Request Displays Response Response results and test results. You can save the Request in a favorites folder

Sidebar: Includes search bar, Request Request history, and favorites management.

Quick area: The shortcut area provides common operation entrances, including running a set of favorites test data, importing others’ shared favorites test data (Import from File, Import from Folder, Import from Link, etc.), or creating new requests, favorites, environment variables, etc.

Settings area: Sets and manages environment variables and global variables.

Detailed as shown in figure

steps

  • 1. Request method: Refer to the API document for details (get)

  • 2. Enter the URL interface address www.baidu.com

  • 3. Click Send to send the request

  • 4. Response results

A common format for passing data in a request

The request string in the URL

  • Data type: string
  • Style data
https://tieba.baidu.com/f?ie=utf-
8&kw=%E7%BE%8E%E9%A3%9F&fr=search
Copy the code
  • Request mode: get
  • Request header: /
  • Request body:

The form

  • Data type: form
  • The sample data

  • Request mode: POST
  • Request header:
Content-Type:application/x-www-form-urlencoded
Copy the code

json

Json: body > raw

  • Data type: JSON
  • Example data:
{
    "username":"xx",
    "password":"asd123"
}
Copy the code
  • Request mode: POST
  • Request header:
Content-Type:application/json

Copy the code

Forms are different from JSON

\

type instructions
The form The most common way to submit data is by post, the default way to submit data in the browser
post The most popular way to transfer data

address

Parameter Query Cases

  • Form form

  • History: history

  • Json modifies the request header

Use case management

  • Mark: order can be adjusted to the top

NEW: Creates a folder

Add Folder: Creates subfolders

Add a Request: Empty folder, click create a new one

Save, save, save

Create a word module folder

Add Folder Creates subfolders

Create requests in their respective folders

Add a Request to the empty folder, click Create request

assertions

Assertions defined

  • Let the program, on behalf of a human, determine whether the results of test case execution conform to the expected process

Let the program judge test case execution instead of a human

Postman asserts

  • Using Java script
  • Under the tests TAB
    • Enter the assertions in the input box under the Tests TAB
  • Check the assertion results in tests Results
  • There are common assertions in Tests that are
    • Whether the response status of the assertion contains 200 (Status code is 200)
    • Asserts whether the response body data contains JSON
    • Asserts whether the response data contains the specified string