Newer
Older
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
Package HTTP {
Package MessageBasedConfiguration {
Import all from MessageBased
Message Gate HTTPGate accepts Request,Response
Component API {
//Add variables and timers here or define new component types and configurations
gate HTTPGate http
}
Configuration BasicClientServer {
API client as Tester,
API server as SUT,
connect client::http to server::http
}
} Note : "Message based types and instances"
Package MessageBased {
Import all from Standard
//Generic Method type -> required for generation!!!
Enumerated Method {
Method GET,
Method POST,
Method PUT,
Method PATCH,
Method DELETE
}
//Generic Request type
Structure Request (
String uri,
optional Method method,
optional Headers headers,
optional Parameters parameters,
optional Body body
)
//Generic Request instances
Request rGET (method = GET)
Request rPOST (method = POST)
Request PUT (method = PUT)
Request PATCH (method = PATCH)
Request DELETE (method = DELETE)
//Generic Response type
Structure Response (
optional Integer status,
optional String statusMessage,
optional Headers headers,
optional Body body
)
//Generic Response instances, name = status code
Response r200 (statusMessage = "OK")
Response r201 (statusMessage = "Created")
Response r204 (statusMessage = "No Content")
Response r400 (statusMessage = "Bad Request")
Response r401 (statusMessage = "Not Found")
Response r403 (statusMessage = "Not Authorized")
Response r404 (statusMessage = "Forbidden")
//Generic Response instances, name = status message
Response OK (status = "200")
Response Created (status = "201")
Response NoContent (status = "204")
Response BadRequest (status = "400")
Response NotFound (status = "404")
Response NotAuthorized (status = "401")
Response Forbidden (status = "403")
//supporting types
Collection Parameters of Parameter
Structure Parameter (
Location location,
String ^name,
String ^value
)
Type Location
Location path
Location query
//may need a structure, not necessarily relevant in standardized testing
Location cookie
//separate headers -> not necessary
//Location header;
Collection Headers of Header
Structure Header (
String ^name,
String ^value
//not relevant in TDL?
//optional contentLength of type Integer,
//optional contentType of type String
)
//Base body for extension
Structure Body ( )
//Basic string body
Structure StringBody extends Body (
String text
)
//Basic wrapper for collection responses
Structure CollectionBody extends Body (
Bodies items
)
//Any body can be included
//If consistent type is needed, a custom subtype shall be defined and used
Collection Bodies of Body
//Custom collection data instances can be defined
// - inline in the responses
// - predefined as a separate data element
//Custom collection data instances can be defined
//to enforce type consistency specific for API
//Basic form body
Structure FormBody extends Body (
String field,
String content
)
}
}