7、使用SpringBoot 2.0快速编写API测试接口
简介
使用java的框架springBoot快速编写几个API接口测试
接口列表
1、模拟GET请求,用户列表接口
2、模拟POST请求,用户登录接口
package com.jmeter.demo;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@RestController
public class HelloController {
@RequestMapping(value = "users", method = RequestMethod.GET)
public @ResponseBody
Object users() {
List<String> userList = new ArrayList<>();