这是验证 API 授权的正确语法吗? given().get("url").when().auth("username","pwd").then().assertthat().statuscode(200)
Is this the correct syntax to validate authorization of API? given().get("url").when().auth("username","pwd").then().assertthat().statuscode(200)
我正在使用 BDD 测试抢先授权,以便使用 Rest assured 实现 API 自动化。这是正确的语法吗?
given().get("url").when().auth("username","pwd").then().assertthat().statuscode(200)
我可以在 given()
之后写 get()
还是应该在 when()
中?
试试这个,当我将它与 Testng 一起使用时,它对我有用。
httpreq.auth().preemptive().basic("ToolsQA", "TestPassword");
reponse = httpreq.request(Method.GET,"/authentication/CheckForAuthentication");
感谢您的提问,
我正在使用 BDD 测试抢先授权,以便使用 Rest assured 实现 API 自动化。这是正确的语法吗?
given().get("url").when().auth("username","pwd").then().assertthat().statuscode(200)
我可以在 given()
之后写 get()
还是应该在 when()
中?
试试这个,当我将它与 Testng 一起使用时,它对我有用。
httpreq.auth().preemptive().basic("ToolsQA", "TestPassword");
reponse = httpreq.request(Method.GET,"/authentication/CheckForAuthentication");
感谢您的提问,