-
Notifications
You must be signed in to change notification settings - Fork 0
/
dynamic-demo.feature
48 lines (42 loc) · 1.34 KB
/
dynamic-demo.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
44
45
46
Feature: Dynamically creating rules and executing them
Background:
* url 'http://localhost:9000'
Scenario: Create a rule, execute it, and then finally delete it
# The rule is ... When GET /motto is called, THEN server should respond with veritas vos liberabit
* def theMethod = 'get'
* def theUri = '/motto'
* def theResponse = 'Veritas vos Liberabit'
* def theContentType = "application/txt"
* def theStatus = 200
# Creating the rule on the server
Given path '/_rule'
And request
"""
{
"request": {
"method" : #(theMethod),
"uri" : #(theUri)
},
"response" : {
"headers": {
"Content-Type": #(theContentType)
},
"body" : #(theResponse),
"status" : #(theStatus)
}
}
"""
When method post
Then status 201
And def ruleId = response
And print response
# Invoke the dynamically created uri
Given path theUri
When method GET
# Then status 200 <-- this will work
# Then status theStatus <-- this will not work
Then match responseStatus == theStatus
#And header Content-Type = 'application/txt' <-- This will work
#And header Content-Type = theContentType <-- this will NOT work
And match responseHeaders['Content-Type'][0] == theContentType
And match response == theResponse