Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Feature: person mock server
- Background:
- * def persons =
- """
- {
- '1': { id: 1, firstName: 'FN1', lastName: 'LN1', email: 'email1@email.com' },
- '2': { id: 2, firstName: 'FN2', lastName: 'LN2', email: 'email2@email.com' },
- '3': { id: 3, firstName: 'FN3', lastName: 'LN3', email: 'email3@email.com' },
- '4': { id: 4, firstName: 'FN4', lastName: 'LN4', email: 'email4@email.com' }
- }
- """
- Scenario: pathMatches('/person/get/{id}')
- * def response = persons[pathParams.id]
- Scenario: pathMatches('/person/remove')
- * def list = $persons.*
- * eval if (list.length) karate.remove('persons', '$.' + list[0].id)
- Scenario: pathMatches('/person/all')
- * def response = $persons.*
- Scenario: methodIs('post')
- * def person = request
- * def id = person.id || ~~(persons.length + 1)
- * set person.id = id
- * eval persons[id + ''] = person
- * def response = person
Add Comment
Please, Sign In to add comment