当前位置:网站首页>Postman interface test tool

Postman interface test tool

2022-06-10 18:08:00 llp1110

Postman- Interface testing tool

1.Postman Introduce

1.Postman What is it?

  1. Postman Is a super powerful for sending HTTP Requested Testing tools
  2. do WEB Common tools for page developers and testers
  3. Create and send any HTTP request (Get/Post/Put/Delete…)

2.Postman Related resources

1. Official website https://www.postman.com/

2. file https://learning.postman.com/docs/getting-started/introduction/

3.Postman install

Specific installation steps

● download Postman Software

Address : https://www.postman.com/downloads/

image-20220604104912403

● install

  1. Double click to install ( It's simple ), Postman Will not let you choose the installation path , Will be installed directly , Generally installed in System disk .
  2. Installation successful , There are shortcut icons on the desktop .

2.Postman Quick start

1. Quick start requirements

● requirement : Use Postman towards http://www.baidu.com issue get request , Get back html Format data

image-20220604114500098

2. Quick start - Implementation steps

  1. To register first Postman An account number : This is simpler , Enter email , Add the account name and password
  2. Sign in Postman( Data synchronization will be performed after login )

image-20220604114626007

  1. Get into Postman

image-20220604114822172

3.Postman Complete the simple Controller Layer test

explain : Use Postman , Complete the written UserHandler Method request

The project path of my project configuration is springmvc, So the requested url yes http://localhost:8080/springmvc/ Address of the interface

1.POST request

@PostMapping(value = "/user/buy")
public String buy() {
    
    System.out.println(" Purchase goods ~");
    return "success";
}

There are no special parameters for the interface , Yes header Parameters are not required , All direct originations Post The request can be

image-20220604115825426

2.GET request

@RequestMapping(value = "/user/find", params = "bookId=100", method = RequestMethod.GET)
public String search(String bookId) {
    
    System.out.println(" Query books  bookId= " + bookId);
    return "success";
}

Request mode :GET、 Must pass parameters :bookId And the value must be 100

image-20220604120044949

[email protected] The default support GET/POST request

Here we are @RequestMapping The method of the request is not specified in , The default is to support get and post Requested

@RequestMapping(value = "/user/hi")
public String hi() {
    
    System.out.println("hi");
    return "success";
}

GET request

image-20220604120553210

POST request

image-20220604120631054

4. Requests that match multi-layer paths

@RequestMapping(value = "/user/message/**")
public String im() {
    
    System.out.println(" Send a message ");
    return "success";
}

image-20220604121001772

5. Request address to get parameters

@RequestMapping(value = "/user/reg/{username}/{userid}")
public String register(@PathVariable("username") String name,
                       @PathVariable("userid") String id) {
    
    System.out.println(" Parameters received --" + "username= " + name + "--" + "usreid= " + id);
    return "success";
}

image-20220604121613412

6.DELETE request

@DeleteMapping(value = "/delete")
public void delete(){
    
    System.out.println(" Delete successful ");
}

image-20220604122055322

原网站

版权声明
本文为[llp1110]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/161/202206101723426851.html