-
-
Notifications
You must be signed in to change notification settings - Fork 2k
/
payment-service.feature
43 lines (35 loc) · 1.35 KB
/
payment-service.feature
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
Feature: payment service
Background:
* def QueueConsumer = Java.type('mock.contract.QueueConsumer')
* def queue = new QueueConsumer(queueName)
* def handler = function(msg){ karate.signal(msg) }
* queue.listen(karate.toJava(handler))
* url paymentServiceUrl + '/payments'
Scenario: create, get, update, list and delete payments
Given request { amount: 5.67, description: 'test one' }
When method post
Then status 200
And match response == { id: '#number', amount: 5.67, description: 'test one' }
And def id = response.id
* listen 5000
* json shipment = listenResult
* print '### received:', listenResult
* match shipment == { paymentId: '#(id)', status: 'shipped' }
Given path id
When method get
Then status 200
And match response == { id: '#(id)', amount: 5.67, description: 'test one' }
Given path id
And request { id: '#(id)', amount: 5.67, description: 'test two' }
When method put
Then status 200
And match response == { id: '#(id)', amount: 5.67, description: 'test two' }
When method get
Then status 200
And match response contains { id: '#(id)', amount: 5.67, description: 'test two' }
Given path id
When method delete
Then status 200
When method get
Then status 200
And match response !contains { id: '#(id)', amount: '#number', description: '#string' }