*前言 :使用swagger需要模拟登录获取token,这是测试接口的前提。* **1.启动gateway和system项目,访问路径**:[http://localhost:9999/doc.html](http://localhost:9999/doc.html) **2.获取验证码,按图操作,输入参数key的值,此处输入123,点击发送,获取验证码图片,复制出来放到浏览器地址栏即可显示图片** ![](https://img.kancloud.cn/69/38/6938e72b07794b3116e2ff958afadc35_1892x695.png) ![](https://img.kancloud.cn/45/0a/450a9a15941fd6a1bb1447393b592282_178x113.png) **3.登录,获取token** ![](https://img.kancloud.cn/ce/b5/ceb572720fc19d4b4534db5c119685a5_1894x773.png) 登录参数说明 | 参数 | 说明 | | --- | --- | | captcha | 验证码 | | checkKey | 获取验证码是输入的key的值,此例中为123 | | password | 登录密码 | | username | 登录用户账号 | **4.拿到token,按图操作,保存token信息到请求头** ![](https://img.kancloud.cn/04/14/0414b479045ac632867f1e1281916314_1886x489.png) **5.测试接口-新增** ![](https://img.kancloud.cn/26/b6/26b6ede8bec2443ba39cf44cafd79f66_1895x707.png) **6.测试接口-查询 根据name查询,拿到该用户的id** ![](https://img.kancloud.cn/b1/c7/b1c72c3b5e81ae84a599f8dec81d5900_1899x869.png) ![](https://img.kancloud.cn/71/55/7155854b858c6a86e96ac1de49044c29_1163x532.png) **7.测试接口-修改 输入上述id和新的name,即可根据id修改name** ![](https://img.kancloud.cn/e3/4b/e34b7e0b2825db9ed64c45846b9efa57_1572x441.png) **8.根据id查询,输入上述id** ![](https://img.kancloud.cn/10/38/10382aebe1466160f9042f915f215c71_1500x612.png) **9.根据id删除** ![](https://img.kancloud.cn/3a/3d/3a3daa64ac5c93c79a5d6583558fd965_1466x491.png) 再次查询,result为空 ![](https://img.kancloud.cn/0f/89/0f8991b010688dfa5580142a9480f67e_1315x408.png)