| @openapi-file=src/main/resources/public/apis/openapi.yml | |
| Feature: CreateUpdateDeleteCustomerKarateTest | |
| Background: | |
| * url baseUrl | |
| # * def auth = { username: '', password: '' } | |
| * def authHeader = call read('classpath:karate-auth.js') auth | |
| * configure headers = authHeader || {} | |
| @business-flow | |
| @operationId=[createCustomer, updateCustomer, deleteCustomer, getCustomer] | |
| Scenario: CreateUpdateDeleteCustomerKarateTest | |
| # createCustomer | |
| Given path '/customers' | |
| And request | |
| """ | |
| { | |
| "id" : 54, | |
| "version" : 93, | |
| "name" : "name-9mq", | |
| "email" : "eldon.block@yahoo.com", | |
| "addresses" : [ { | |
| "street" : "street-6906yzrgz", | |
| "city" : "Kitstad" | |
| } ], | |
| "paymentMethods" : [ { | |
| "id" : 93, | |
| "version" : 83, | |
| "type" : "MASTERCARD", | |
| "cardNumber" : "cardNumber-lt4efsym7we7zqb" | |
| } ] | |
| } | |
| """ | |
| When method post | |
| Then status 201 | |
| * def createCustomerResponse = response | |
| * def customerId = response.id | |
| # updateCustomer | |
| * def pathParams = { id: 68 } | |
| Given path '/customers/', pathParams.id | |
| And request | |
| """ | |
| { | |
| "id" : 33, | |
| "version" : 25, | |
| "name" : "name-4zih3tx9mzwnbz62afdss", | |
| "email" : "betsy.roob@hotmail.com", | |
| "addresses" : [ { | |
| "street" : "street-5m", | |
| "city" : "Padbergview" | |
| } ], | |
| "paymentMethods" : [ { | |
| "id" : 81, | |
| "version" : 75, | |
| "type" : "VISA", | |
| "cardNumber" : "cardNumber-ei0b72ietozm5eu" | |
| } ] | |
| } | |
| """ | |
| When method put | |
| Then status 200 | |
| * def updateCustomerResponse = response | |
| * def customerId = response.id | |
| # deleteCustomer | |
| * def pathParams = { id: 41 } | |
| Given path '/customers/', pathParams.id | |
| When method delete | |
| Then status 204 | |
| * def deleteCustomerResponse = response | |
| # getCustomer | |
| * def pathParams = { id: 69 } | |
| Given path '/customers/', pathParams.id | |
| When method get | |
| Then status 200 | |
| * def getCustomerResponse = response | |
| * def customerId = response.id |