Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
MTS - Methods for Testing and Specification
EG 203 647 - Specification and testing of RESTful APIs
Commits
54300423
Commit
54300423
authored
Jul 16, 2020
by
Philip Makedonski
Browse files
* updated generated TTCN-3 example with refined generation
parent
2e0c8a7e
Changes
1
Hide whitespace changes
Inline
Side-by-side
TC/Generated/generated-tds.tdlan2.ttcn3
View file @
54300423
...
...
@@ -6,8 +6,20 @@ module Generated_TDs_for_Examples_for_RESTful_API_guide_2020_07_01_17_45 {
}
function
TEMPLATE_client_main
(
)
runs
on
API
{
http_to_server_http
.
send
(
"TODO_INLINE_DATA_INSTANCE_FOR_Request"
)
;
http_to_server_http
.
receive
(
"TODO_INLINE_DATA_INSTANCE_FOR_Response"
)
;
http_to_server_http
.
send
(
Request
:
{
method
:=
"METHOD"
,
uri
:=
"URI"
,
parameters
:=
"TODO_INLINE_COLLECTION"
}
)
;
http_to_server_http
.
receive
(
Response
:
{
status
:=
"STATUS"
,
statusMessage
:=
"MESSAGE"
,
body
:=
"TODO_INLINE_DATA_INSTANCE_FOR_ResourceData"
}
)
;
}
testcase
tc_TEMPLATE
(
)
runs
on
MTC_BasicClientServer
system
...
...
@@ -22,8 +34,20 @@ module Generated_TDs_for_Examples_for_RESTful_API_guide_2020_07_01_17_45 {
}
function
TD_RESOURCE_ID_GET_200_001_client_main
(
)
runs
on
API
{
http_to_server_http
.
send
(
"TODO_INLINE_DATA_INSTANCE_FOR_Request"
)
;
http_to_server_http
.
receive
(
"TODO_INLINE_DATA_INSTANCE_FOR_Response"
)
;
http_to_server_http
.
send
(
Request
:
{
method
:=
"GET"
,
uri
:=
"/resource/{id}"
,
parameters
:=
"TODO_INLINE_COLLECTION"
}
)
;
http_to_server_http
.
receive
(
Response
:
{
status
:=
"200"
,
statusMessage
:=
"The requested resource"
,
body
:=
"TODO_INLINE_DATA_INSTANCE_FOR_ResourceData"
}
)
;
}
testcase
tc_TD_RESOURCE_ID_GET_200_001
(
)
runs
on
MTC_BasicClientServer
...
...
@@ -38,8 +62,20 @@ module Generated_TDs_for_Examples_for_RESTful_API_guide_2020_07_01_17_45 {
}
function
TD_RESOURCE_ID_GET_401_002_client_main
(
)
runs
on
API
{
http_to_server_http
.
send
(
"TODO_INLINE_DATA_INSTANCE_FOR_Request"
)
;
http_to_server_http
.
receive
(
"TODO_INLINE_DATA_INSTANCE_FOR_Response"
)
;
http_to_server_http
.
send
(
Request
:
{
method
:=
"GET"
,
uri
:=
"/resource/{id}"
,
parameters
:=
"TODO_INLINE_COLLECTION"
}
)
;
http_to_server_http
.
receive
(
Response
:
{
status
:=
"401"
,
statusMessage
:=
"Unauthenticated"
,
body
:=
"TODO_INLINE_DATA_INSTANCE_FOR_ResourceData"
}
)
;
}
testcase
tc_TD_RESOURCE_ID_GET_401_002
(
)
runs
on
MTC_BasicClientServer
...
...
@@ -54,8 +90,20 @@ module Generated_TDs_for_Examples_for_RESTful_API_guide_2020_07_01_17_45 {
}
function
TD_RESOURCE_ID_GET_404_003_client_main
(
)
runs
on
API
{
http_to_server_http
.
send
(
"TODO_INLINE_DATA_INSTANCE_FOR_Request"
)
;
http_to_server_http
.
receive
(
"TODO_INLINE_DATA_INSTANCE_FOR_Response"
)
;
http_to_server_http
.
send
(
Request
:
{
method
:=
"GET"
,
uri
:=
"/resource/{id}"
,
parameters
:=
"TODO_INLINE_COLLECTION"
}
)
;
http_to_server_http
.
receive
(
Response
:
{
status
:=
"404"
,
statusMessage
:=
"Not found"
,
body
:=
"TODO_INLINE_DATA_INSTANCE_FOR_ResourceData"
}
)
;
}
testcase
tc_TD_RESOURCE_ID_GET_404_003
(
)
runs
on
MTC_BasicClientServer
...
...
@@ -70,8 +118,20 @@ module Generated_TDs_for_Examples_for_RESTful_API_guide_2020_07_01_17_45 {
}
function
TD_RESOURCE_POST_204_001_client_main
(
)
runs
on
API
{
http_to_server_http
.
send
(
"TODO_INLINE_DATA_INSTANCE_FOR_Request"
)
;
http_to_server_http
.
receive
(
"TODO_INLINE_DATA_INSTANCE_FOR_Response"
)
;
http_to_server_http
.
send
(
Request
:
{
method
:=
"POST"
,
uri
:=
"/resource"
,
parameters
:=
"TODO_INLINE_COLLECTION"
}
)
;
http_to_server_http
.
receive
(
Response
:
{
status
:=
"204"
,
statusMessage
:=
"No content"
,
body
:=
"TODO_INLINE_DATA_INSTANCE_FOR_ResourceData"
}
)
;
}
testcase
tc_TD_RESOURCE_POST_204_001
(
)
runs
on
MTC_BasicClientServer
system
...
...
@@ -86,8 +146,20 @@ module Generated_TDs_for_Examples_for_RESTful_API_guide_2020_07_01_17_45 {
}
function
TD_RESOURCE_ID_FILE_PUT_204_001_client_main
(
)
runs
on
API
{
http_to_server_http
.
send
(
"TODO_INLINE_DATA_INSTANCE_FOR_Request"
)
;
http_to_server_http
.
receive
(
"TODO_INLINE_DATA_INSTANCE_FOR_Response"
)
;
http_to_server_http
.
send
(
Request
:
{
method
:=
"PUT"
,
uri
:=
"/resource/{id}/file"
,
parameters
:=
"TODO_INLINE_COLLECTION"
}
)
;
http_to_server_http
.
receive
(
Response
:
{
status
:=
"204"
,
statusMessage
:=
"No content"
,
body
:=
"TODO_INLINE_DATA_INSTANCE_FOR_ResourceData"
}
)
;
}
testcase
tc_TD_RESOURCE_ID_FILE_PUT_204_001
(
)
runs
on
MTC_BasicClientServer
...
...
@@ -102,8 +174,20 @@ module Generated_TDs_for_Examples_for_RESTful_API_guide_2020_07_01_17_45 {
}
function
TD_SEARCH_GET_200_001_client_main
(
)
runs
on
API
{
http_to_server_http
.
send
(
"TODO_INLINE_DATA_INSTANCE_FOR_Request"
)
;
http_to_server_http
.
receive
(
"TODO_INLINE_DATA_INSTANCE_FOR_Response"
)
;
http_to_server_http
.
send
(
Request
:
{
method
:=
"GET"
,
uri
:=
"/search"
,
parameters
:=
"TODO_INLINE_COLLECTION"
}
)
;
http_to_server_http
.
receive
(
Response
:
{
status
:=
"200"
,
statusMessage
:=
"The requested resource"
,
body
:=
"TODO_INLINE_DATA_INSTANCE_FOR_ResourceData"
}
)
;
}
testcase
tc_TD_SEARCH_GET_200_001
(
)
runs
on
MTC_BasicClientServer
system
...
...
@@ -118,8 +202,20 @@ module Generated_TDs_for_Examples_for_RESTful_API_guide_2020_07_01_17_45 {
}
function
TD_SUBSCRIPTION_POST_201_001_client_main
(
)
runs
on
API
{
http_to_server_http
.
send
(
"TODO_INLINE_DATA_INSTANCE_FOR_Request"
)
;
http_to_server_http
.
receive
(
"TODO_INLINE_DATA_INSTANCE_FOR_Response"
)
;
http_to_server_http
.
send
(
Request
:
{
method
:=
"POST"
,
uri
:=
"/subscription"
,
parameters
:=
"TODO_INLINE_COLLECTION"
}
)
;
http_to_server_http
.
receive
(
Response
:
{
status
:=
"201"
,
statusMessage
:=
"Created"
,
body
:=
"TODO_INLINE_DATA_INSTANCE_FOR_ResourceData"
}
)
;
}
testcase
tc_TD_SUBSCRIPTION_POST_201_001
(
)
runs
on
MTC_BasicClientServer
...
...
@@ -134,8 +230,20 @@ module Generated_TDs_for_Examples_for_RESTful_API_guide_2020_07_01_17_45 {
}
function
TD_SERVICE_GET_200_001_client_main
(
)
runs
on
API
{
http_to_server_http
.
send
(
"TODO_INLINE_DATA_INSTANCE_FOR_Request"
)
;
http_to_server_http
.
receive
(
"TODO_INLINE_DATA_INSTANCE_FOR_Response"
)
;
http_to_server_http
.
send
(
Request
:
{
method
:=
"GET"
,
uri
:=
"/service"
,
parameters
:=
"TODO_INLINE_COLLECTION"
}
)
;
http_to_server_http
.
receive
(
Response
:
{
status
:=
"200"
,
statusMessage
:=
"The requested service"
,
body
:=
"TODO_INLINE_DATA_INSTANCE_FOR_ResourceData"
}
)
;
}
testcase
tc_TD_SERVICE_GET_200_001
(
)
runs
on
MTC_BasicClientServer
system
...
...
@@ -242,79 +350,141 @@ module MessageBased {
template
Location
query
:=
"query"
template
Location
cookie
:=
"cookie"
template
Request
GET
:=
{
uri
:=
?
,
method
:=
?
,
headers
:=
?
,
parameters
:=
?
,
body
:=
?
uri
:=
?
,
method
:=
?
,
headers
:=
?
,
parameters
:=
?
,
body
:=
?
}
template
Request
POST
:=
{
uri
:=
?
,
method
:=
?
,
headers
:=
?
,
parameters
:=
?
,
body
:=
?
uri
:=
?
,
method
:=
?
,
headers
:=
?
,
parameters
:=
?
,
body
:=
?
}
template
Request
PUT
:=
{
uri
:=
?
,
method
:=
?
,
headers
:=
?
,
parameters
:=
?
,
body
:=
?
uri
:=
?
,
method
:=
?
,
headers
:=
?
,
parameters
:=
?
,
body
:=
?
}
template
Request
PATCH
:=
{
uri
:=
?
,
method
:=
?
,
headers
:=
?
,
parameters
:=
?
,
body
:=
?
uri
:=
?
,
method
:=
?
,
headers
:=
?
,
parameters
:=
?
,
body
:=
?
}
template
Request
DELETE
:=
{
uri
:=
?
,
method
:=
?
,
headers
:=
?
,
parameters
:=
?
,
body
:=
?
uri
:=
?
,
method
:=
?
,
headers
:=
?
,
parameters
:=
?
,
body
:=
?
}
template
Response
d200
:=
{
status
:=
?
,
statusMessage
:=
"OK"
,
headers
:=
?
,
body
:=
?
status
:=
?
,
statusMessage
:=
"OK"
,
headers
:=
?
,
body
:=
?
}
template
Response
d201
:=
{
status
:=
?
,
statusMessage
:=
"Created"
,
headers
:=
?
,
body
:=
?
status
:=
?
,
statusMessage
:=
"Created"
,
headers
:=
?
,
body
:=
?
}
template
Response
d204
:=
{
status
:=
?
,
statusMessage
:=
"No Content"
,
headers
:=
?
,
body
:=
?
status
:=
?
,
statusMessage
:=
"No Content"
,
headers
:=
?
,
body
:=
?
}
template
Response
d400
:=
{
status
:=
?
,
statusMessage
:=
"Bad Request"
,
headers
:=
?
,
body
:=
?
status
:=
?
,
statusMessage
:=
"Bad Request"
,
headers
:=
?
,
body
:=
?
}
template
Response
d401
:=
{
status
:=
?
,
statusMessage
:=
"Not Found"
,
headers
:=
?
,
body
:=
?
status
:=
?
,
statusMessage
:=
"Not Found"
,
headers
:=
?
,
body
:=
?
}
template
Response
d403
:=
{
status
:=
?
,
statusMessage
:=
"Not Authorized"
,
headers
:=
?
,
body
:=
?
status
:=
?
,
statusMessage
:=
"Not Authorized"
,
headers
:=
?
,
body
:=
?
}
template
Response
d404
:=
{
status
:=
?
,
statusMessage
:=
"Forbidden"
,
headers
:=
?
,
body
:=
?
status
:=
?
,
statusMessage
:=
"Forbidden"
,
headers
:=
?
,
body
:=
?
}
template
Response
OK
:=
{
status
:=
"200"
,
statusMessage
:=
?
,
headers
:=
?
,
body
:=
?
status
:=
"200"
,
statusMessage
:=
?
,
headers
:=
?
,
body
:=
?
}
template
Response
Created
:=
{
status
:=
"201"
,
statusMessage
:=
?
,
headers
:=
?
,
body
:=
?
status
:=
"201"
,
statusMessage
:=
?
,
headers
:=
?
,
body
:=
?
}
template
Response
NoContent
:=
{
status
:=
"204"
,
statusMessage
:=
?
,
headers
:=
?
,
body
:=
?
status
:=
"204"
,
statusMessage
:=
?
,
headers
:=
?
,
body
:=
?
}
template
Response
BadRequest
:=
{
status
:=
"400"
,
statusMessage
:=
?
,
headers
:=
?
,
body
:=
?
status
:=
"400"
,
statusMessage
:=
?
,
headers
:=
?
,
body
:=
?
}
template
Response
NotFound
:=
{
status
:=
"404"
,
statusMessage
:=
?
,
headers
:=
?
,
body
:=
?
status
:=
"404"
,
statusMessage
:=
?
,
headers
:=
?
,
body
:=
?
}
template
Response
NotAuthorized
:=
{
status
:=
"401"
,
statusMessage
:=
?
,
headers
:=
?
,
body
:=
?
status
:=
"401"
,
statusMessage
:=
?
,
headers
:=
?
,
body
:=
?
}
template
Response
Forbidden
:=
{
status
:=
"403"
,
statusMessage
:=
?
,
headers
:=
?
,
body
:=
?
status
:=
"403"
,
statusMessage
:=
?
,
headers
:=
?
,
body
:=
?
}
}
...
...
@@ -328,8 +498,11 @@ module ExampleAPI {
}
template
Request
postResource
:=
{
uri
:=
"/resource"
,
method
:=
mPOST
,
headers
:=
?
,
parameters
:=
postParameters
,
body
:=
"TODO_NOT_SUPPORTED_YET"
uri
:=
"/resource"
,
method
:=
mPOST
,
headers
:=
?
,
parameters
:=
postParameters
,
body
:=
"TODO_NOT_SUPPORTED_YET"
}
template
Parameters
postParameters
:=
{
...
...
@@ -337,8 +510,11 @@ module ExampleAPI {
}
template
Request
postResourceInline
:=
{
uri
:=
"/resource"
,
method
:=
mPOST
,
headers
:=
?
,
parameters
:=
"TODO_NOT_SUPPORTED_YET"
,
body
:=
"TODO_NOT_SUPPORTED_YET"
uri
:=
"/resource"
,
method
:=
mPOST
,
headers
:=
?
,
parameters
:=
"TODO_NOT_SUPPORTED_YET"
,
body
:=
"TODO_NOT_SUPPORTED_YET"
}
template
Parameter
ID1
:=
{
...
...
@@ -347,13 +523,17 @@ module ExampleAPI {
}
template
Response
getResource200
:=
{
status
:=
"200"
,
statusMessage
:=
"OK"
,
headers
:=
?
,
body
:=
"TODO_NOT_SUPPORTED_YET"
status
:=
"200"
,
statusMessage
:=
"OK"
,
headers
:=
?
,
body
:=
"TODO_NOT_SUPPORTED_YET"
}
template
Response
getResourceCollection200
:=
{
status
:=
"200"
,
statusMessage
:=
"OK"
,
headers
:=
?
,
body
:=
validResources
status
:=
"200"
,
statusMessage
:=
"OK"
,
headers
:=
?
,
body
:=
validResources
}
template
CollectionBody
validResources
:=
{
...
...
@@ -361,13 +541,18 @@ module ExampleAPI {
}
template
Response
getResourceCollectionInline200
:=
{
status
:=
"200"
,
statusMessage
:=
"OK"
,
headers
:=
?
,
body
:=
"TODO_NOT_SUPPORTED_YET"
status
:=
"200"
,
statusMessage
:=
"OK"
,
headers
:=
?
,
body
:=
"TODO_NOT_SUPPORTED_YET"
}
template
Request
getSearchInline
:=
{
uri
:=
"/search"
,
method
:=
mGET
,
headers
:=
?
,
parameters
:=
"TODO_NOT_SUPPORTED_YET"
,
body
:=
?
uri
:=
"/search"
,
method
:=
mGET
,
headers
:=
?
,
parameters
:=
"TODO_NOT_SUPPORTED_YET"
,
body
:=
?
}
template
Parameters
GetRequestParameters
:=
{
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment