Created
May 24, 2019 14:44
-
-
Save MykolaGolubyev/deb5ae65703f02ab6abe1e05827e014c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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