-/- /_ _
_/__/ (__(/_
_
,_ // __, -/- ,_ ,
_/_)__(/_(_/(__(_/__/__(_/__/_)__(_/__/_)_
/ _/_ _/_ /
/ (/ (/ /
_.-^~~^^^`~-,_,,~''''''```~,''``~'``~,
______,' -o :. _ . ; ,'`, `.
( -\.._,.;;'._ ,( } _`_-_,, `, `,
``~~~~~~' ((/'((((____/~~~~~~'(,(,___> `~'
The Playtypus is an eventmachine-based command line utility that plays HTTP calls. A JSON input file (or files) tells The Playtypus what uri, method, headers, and body to send to a host, as well as the precise time to send each call. Optional response logging will write all details of HTTP responses to disk by call sequence.
Install The Playtypus gem
$ gem install playtypus
Define a series of HTTP calls in a JSON file
[
{
"timestamp" : "1970-01-01T00:00:00.0000000000Z",
"path" : "/v1/users",
"verb" : "POST",
"headers" : {
"Content-Type" : "application/json",
"X-AUTH-TOKEN" : "123456789"
},
"body" : {
"user" : {
"name" : "the playtypus",
"domicile" : "github"
}
}
},
{
"timestamp" : "1970-01-01T00:00:01.0000000000Z",
"path" : "/v1/users/1",
"verb" : "GET",
"request_filename" : "list_requests.log",
"headers" : {
"Content-Type" : "application/xml"
}
}
]
Tell The Playtpus to play
$ playtypus play --host=http://localhost:8081 --call-log=log.json --response-log=responses/ --preserve-times
This section describes required and optional arguments The Playtypus understands.
Describes available commands or one specific command
(Required) The HTTP protocol to use, as well as the host address to use in playback:
--host=https://169.0.0.1:443/
(Required) A file or directory containing a JSON array of calls to play:
--call-log=calls/
(Optional) A destination directory for response logs stored in sequence by call:
--response-log=responses/
(Default=false) Specifies whether timestamps should be used in playback:
--preserve-times
Call logs specify arrays of JSON instructing The Playtypus what, as well as when, to play HTTP calls. Five properties are used:
timestamp - a string in ISO 8601 format. The initial timestamp matters not--the relative distance between each timestamp defines the distance between two calls.
path - a relative path to be appended to the global --host address
verb - GET, PUT, POST, DELETE, et cetera
headers - a dictionary of headers to send
body - a payload in dictionary or string format
response_filename - by default, if you specify the response-log, playtypus will log files in that folder sequentially starting from 000000000.log. If you want to specify the actual log file name, add this to your call. Note: it will ALWAYS append to the file
docker run -v /full/path/to/repo/folder:/home/user/folder --name playtypus myrepo/playtypus play -c /home/user/folder/calls.json -h https://<url>:<port> -r /home/user/folder/responses
rake at the root of the projectrake againDistributed under the MIT-LICENSE
Content type
Image
Digest
Size
393.1 MB
Last updated
about 9 years ago
docker pull drewlander/playtypus