-/- /_ _
_/__/ (__(/_
_
,_ // __, -/- ,_ ,
_/_)__(/_(_/(__(_/__/__(_/__/_)__(_/__/_)_
/ _/_ _/_ /
/ (/ (/ /
_.-^~~^^^`~-,_,,~''''''```~,''``~'``~,
______,' -o :. _ . ; ,'`, `.
( -\.._,.;;'._ ,( } _`_-_,, `, `,
``~~~~~~' ((/'((((____/~~~~~~'(,(,___> `~'
About
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.
Usage
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", "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
Command line arguments
This section describes required and optional arguments The Playtypus understands.
help
Describes available commands or one specific command
--host, -h
(Required) The HTTP protocol to use, as well as the host address to use in playback:
--host=https://169.0.0.1:443/
--call-log, -c
(Required) A file or directory containing a JSON array of calls to play:
--call-log=calls/
--response-log, -r
(Optional) A destination directory for response logs stored in sequence by call:
--response-log=responses/
--preserve-times, --no-preserve-times
(Default=false) Specifies whether timestamps should be used in playback:
--preserve-times
Call logs
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
Contributing
- Fork/clone The Playtypus repo
- Make sure tests pass by running
rake
at the root of the project - Add tests for your change. Make your change, and make sure that tests pass by running
rake
again - Commit to your fork using a good commit message
- Push and submit a pull request
License
Distributed under the MIT-LICENSE