使用python进行组织编写接口测试用例
- 接口测试其实就是几个步骤。
- 拿到接口的url地址
- 查看接口是用什么方式发送
- 添加请求头,请求体
- 发送查看返回结果,校验返回结果是否正确
一个hello,world程序
#-*- coding:utf-8 -*-
import bottle
from bottle import run, route, response
@route('/hello/:a')
def hello(a):
return 'hello world.nihaosdfasd'+a
bottle.run( host='0.0.0.0', port=8081)
启动后在浏览器输入:
http://localhost:8081/hello/ABSK
则输出结果为:
hello world.nihaosdfasdABSK