[英]Status code doesn't match actual status code
I'm having this errors for all of my test cases . 我所有的测试用例都遇到这个错误。 Please, help to find out what's wrong?
请帮忙找出问题所在? I'm new to testing, so sorry if it's a silly question.
我是测试的新手,如果这是一个愚蠢的问题,请原谅。
java.lang.AssertionError: 1 expectation failed. java.lang.AssertionError:1个期望失败。 Expected status code <200> doesn't match actual status code <301>.
预期状态码<200>与实际状态码<301>不匹配。
@Test (priority=1)
public static void authSuccess(){
String id = "xxxxxxxxxx";
given().
param("id",id).
when().
post("/auth").
then().
statusCode(200).
body("content.id", equalTo(id));
}
@Test (priority=2)
public static void authFail(){
String id = "xxxxxxxxxx";
given().
param("id", id).
when().
post("/auth").
then().
statusCode(400).
body("errors[0]", equalTo("Incorrect ID"));
}
Hope you have tested in Postman/SoapUI before attempting into automation tests. 希望您在尝试自动化测试之前已经在Postman / SoapUI中进行了测试。
And you got 200 in postman as well. 而且您还有200名邮递员。
Couple of pointers 几个指针
Hope this helps out! 希望这会有所帮助!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.