Last active
August 29, 2015 13:56
-
-
Save artemnikitin/8952347 to your computer and use it in GitHub Desktop.
Spock sample for Data Driven Testing
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
@Unroll("For currency #ccy and amount = #sum response will be #response_code - #response_text") | |
def "Check max and min sum for different currencies"() { | |
given: "Body for request with sum and currency" | |
String content = TestProperties.getRestBody(ccy, sum) | |
when: "Send request" | |
Response result = Request.send(RequestType.PUT, url, content); | |
then: "Check response" | |
result.status.contains(http) | |
result.body.contains(response_code) | |
result.body.contains(response_text) | |
where: | |
ccy |sum ||http |response_code |response_text | |
"RUB"|0.5 ||"HTTP/1.1 400 Bad Request"|"\"result_code\": 241"|"Amount is less than minimum" | |
"RUB"|15001||"HTTP/1.1 400 Bad Request"|"\"result_code\": 242"|"Amount is greater than maximum" | |
"USD"|0.01 ||"HTTP/1.1 400 Bad Request"|"\"result_code\": 241"|"Amount is less than minimum" | |
"USD"|451 ||"HTTP/1.1 400 Bad Request"|"\"result_code\": 242"|"Amount is greater than maximum" | |
"EUR"|0.01 ||"HTTP/1.1 400 Bad Request"|"\"result_code\": 241"|"Amount is less than minimum" | |
"EUR"|352 ||"HTTP/1.1 400 Bad Request"|"\"result_code\": 242"|"Amount is greater than maximum" | |
"KZT"|0.7 ||"HTTP/1.1 400 Bad Request"|"\"result_code\": 241"|"Amount is less than minimum" | |
"KZT"|70001||"HTTP/1.1 400 Bad Request"|"\"result_code\": 242"|"Amount is greater than maximum" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment