Package: mockintosh
MockintoshQuick LinksDocumentation WebsiteYouTube Video SeriesBug TrackerSlackStack OverflowFaker API ReferenceAboutYou've just found a new way of mocking microservices!An example config that demonstrates the common features of Mockintosh:services:-name:Mock for Service1hostname:localhostport:8000managementRoot:__admin# open http://localhost:8001/__admin it in browser to see the UIendpoints:-path:"/"# simplest mock-path:"/api/users/{{param}}"# parameterized URLsresponse:"simplestringresponsewith{{param}}included"-path:/comprehensive-matching-and-responsemethod:POSTqueryString:qName1:qValue# will only match if query string parameter existsqName2:"{{regEx'\\d+'}}"# will require numeric valueheaders:x-required-header:someval# will cause only requests with specific header to workbody:text:"{{regEx'.+'}}"# will require non-empty POST bodyresponse:# the mocked response specification goes belowstatus:202body:"Itworked"headers:x-response-header:"{{random.uuid4}}"# a selection of random/dynamic functions is availablex-query-string-value:"{{request.queryString.qName2}}"# request parts can be referenced in responseMockintosh is a service virtualization tool that's capable to generate mocks forRESTful APIsand communicate
withmessage queuesto either mimicasynchronoustasks or to simulatemicroservice architecturesin a blink of an eye.The state-of-the-art mocking capabilities of Mockintosh enables software development teams to workindependentlywhile building and maintaining acomplicatedmicroservice architecture.Key features:Multiple services mocked by a single instance of MockintoshLenientconfiguration syntaxRemotemanagement UI+APIRequest scenarios support withmulti-response endpointsandtagsMock Actorpattern for Kafka, RabbitMQ, Redis and some other message bus protocolsGraphQL queries recognizingIn this articlewe explain how and why
Mockintosh was born as a new way of mocking microservices.Quick StartInstall on MacOSInstall Mockintosh app on Mac usingHomebrewpackage manager:$brewinstallup9inc/repo/mockintoshInstall on WindowsDownload an installer fromreleasessection and launch it. Follow the steps in wizard to install Mockintosh.Install on LinuxInstall Mockintosh Python package usingpip(orpip3on some machines):$pipinstall-UmockintoshUse Demo Sample ConfigRun following command to generateexample.yamlfile in the current directory:$mockintosh--sample-configexample.yamlthen, run that config with Mockintosh:$mockintoshexample.yamlAnd openhttp://localhost:9999in your web browser.You can also issue some CURL requests against it:curl-vhttp://localhost:8888/

curl-vhttp://localhost:8888/api/myURLParamValue123/action

curl-v"http://localhost:8888/someMoreFields?qName1=qValue&qName2=12345"-XPOST-H"X-Required-Header: someval"--data"payload"Command-line ArgumentsThe list of command-line arguments can be seen by runningmockintosh --help.If you don't want to listen all of the services in a configuration file then you can specify a list of service
names (nameis a string attribute you can set per service):$mockintoshexample.yaml'Mock for Service1''Mock for Service2'Using--quietand--verboseoptions the logging level can be changed.Using--bindoption the bind address for the mock server can be specified, e.g.mockintosh --bind 0.0.0.0Using--enable-tagsoption the tags in the configuration file can be enabled in startup time,
e.g.mockintosh --enable-tags first,secondOpenAPI Specification to Mockintosh Config Conversion (experimental)Note: This feature is experimental. One-to-one transpilation of OAS documents is not guaranteed.It could be a good kickstart if you have already an OpenAPI Specification for your API. Mockintosh is able to transpile
an OpenAPI Specification to its own config format in two different ways:CLI Option--convertUsing the--convertone can convert an OpenAPI Specification to Mockintosh config.JSON output example:$wgethttps://petstore.swagger.io/v2/swagger.json
$mockintoshswagger.json-cnew_config.jsonjsonYAML example:$mockintoshswagger.json-cnew_config.yamlyamlAutomatic ConversionIf you start Mockintosh with a valid OpenAPI Specification file then it automatically detects that the input is an
OpenAPI Specification file:$mockintoshswagger.jsonand automatically starts itself from that file. Without producing any new files. So you can start to edit this file
through the management UI without even restarting Mockintosh.Build the DocsSingle-command from/docsto review docs locally:dockerrun-p8080:4000-v$(pwd):/sitebretfisher/jekyll-serveOr manual:InstallJekyllandBundler:$geminstalljekyllbundlerInstall the gems:$cddocs/
$bundleconfigset--localpath'vendor/bundle'$bundleinstallRun the server:$bundleexecjekyllserve