getting 302 while using a POST method in rest assured -
i have written test case below , got below error,
error in log:
failed: setpassword java.lang.assertionerror: 1 expectation failed. expected status code <200> <302>.
code:
@test(enabled=true) public void setpassword(){ requestspecification requestspecification= new config().getrequestspecification(); requestspecification requestheaders= new config().getheaders(); map<string,string> password = new hashmap<string, string>(); password.put("password", "password@2017"); given().spec(requestspecification).spec(requestheaders).body(password).when().post("https://example.com/testplatform@example.com/password"). then().statuscode(200).log().all(); }
i solved issue. getting 302 error because api url getting encoded. used urlencodingenabled(false) , solved issue.
Comments
Post a Comment