在关于如何测试CRUD的WebTau文档中,示例是使用相对URL
def customerPayload = [firstName: "FN", lastName: "LN"]
def id = http.post("/customers", customerPayload) {
return id
}
http.get("/customers/${id}") {
body.should == customerPayload 3
}
如何设置要使用的基本url?文章源自玩技e族-https://www.playezu.com/179399.html 文章源自玩技e族-https://www.playezu.com/179399.html
未知地区 1F
如果您使用的是Groovy standalone runner,那么可以通过命令行创建url
webtau –url=http://localhost:8080
或者有一个groovy配置文件 韦布陶。cfg。groovy公司
url = "http://localhost:8080
以Java为例 src/test/resources/webtau。属性 文件
url = http://localhost:8080
或者通过系统属性传递它以执行测试
-Durl="http://localhost:8080"
对于Java和Groovy,您还可以通过环境变量提供基本url
WEBTAU_URL=http://localhost:8080