如何使用WebTau为REST API测试指定基本url

Object
Object
订阅者
265
文章
0
粉丝
测试交流1 184字数 53阅读0分10秒阅读模式
摘要在关于如何测试CRUD的WebTau文档中,示例是使用相对URL def customerPayload=[firstName:“FN”,lastName:“LN”] 定义id=h...

在关于如何测试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

 
    • Mykola Golubyev
      Mykola Golubyev 9

      如果您使用的是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

    匿名

    发表评论

    匿名网友
    :?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:
    确定

    拖动滑块以完成验证