Skip to content

Instantly share code, notes, and snippets.

@MykolaGolubyev
Created May 24, 2019 14:44
Show Gist options
  • Save MykolaGolubyev/deb5ae65703f02ab6abe1e05827e014c to your computer and use it in GitHub Desktop.
Save MykolaGolubyev/deb5ae65703f02ab6abe1e05827e014c to your computer and use it in GitHub Desktop.
scenario("CRUD operations for customer") {
def customerPayload = [firstName: "FN", lastName: "LN"]
def id = http.post("/customers", customerPayload) {
return id // return id value from response body
}
http.get("/customers/${id}") {
body.should == customerPayload // only specified properties will be asserted against
}
def changedLastName = "NLN"
http.put("/customers/${id}", [*:customerPayload, lastName: changedLastName]) {
lastName.should == changedLastName // specifying body is optional
}
http.get("/customers/${id}") {
lastName.should == changedLastName
}
http.delete("/customers/${id}") {
statusCode.should == 204
}
http.get("/customers/${id}") {
statusCode.should == 404
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment