-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Closed
Labels
Description
源码
特性
- 类JSON的DSL编写用例
- 跨平台,跨编程语言
- 支持Mock
- 数据即断言
- 数据即变量
- 支持Mixin
- 支持CI
- 支持TDD
- 用户定义函数
快速开始
编写测试文件 httpbin.jsona
{
test1: {
req: {
url: "https://httpbin.org/post",
method: "post",
header: {
'content-type': 'application/json',
},
body: {
v1: "bar1",
v2: "Bar2",
},
},
res: {
status: 200,
body: { @partial
json: {
v1: "bar1",
v2: "bar2"
}
}
}
}
}
运行测试
apitest httpbin.jsona
module main
unit test1 (0.944) ✘
main.test1.res.body.json.v2: bar2 ≠ Bar2
...
用例测试失败,从Apitest打印的错误信息中可以看到, main.test1.res.body.json.v2 的实际值是 Bar2 而不是 bar2。
我们修改 bar2 成 Bar2 后,再次执行 Apitest
apitest httpbin.jsona
module main
unit test1 (0.930) ✔
这次测试通过了。