# Packages
# README
█████████████ ██████ █████ █████
░░███░░███░░███ ███░░███░░███ ░░███
░███ ░███ ░███ ░███ ░███ ░░░█████░
░███ ░███ ░███ ░███ ░███ ███░░░███
█████░███ █████░░██████ █████ █████
░░░░░ ░░░ ░░░░░ ░░░░░░ ░░░░░ ░░░░░
mox is a tool to stub external dependencies.
About
It is written in Go with mappings defined in JSON.
Responses can be generated using Go templates. It supports sprig template functions.
Try it together with bro - a load testing tool.
Check out nft repo to learn more about bro & mox for non-functional testing.
Installation
Make sure you have Go installed and GOPATH
is set up correctly.
Clone this repository and run:
make install
Usage
mox
mox [flags]
--debug
--logJson
--accessLog
--skipBanner
--port=8080
--adminPort=9090
--configPath=./config
Flags
--debug
Enables debug mode. Results in more detailed logging.
--logJson
Changes log format to JSON.
--accessLog
Requires debug mode (--debug
).
For all incoming requests, it logs whether they matched any mapping.
--skipBanner
Skips printing banner to stdout.
--port=8080
Defines a port for mocks handler.
--adminPort=9090
Defines a port for admin API (including /metrics endpoint).
--configPath=./config
Path to config location with mappings, files and templates.
API Endpoints
mocks handler
user-defined mappings
- GET /<mapping_url>
- POST /<mapping_url>
- ...
predefined functions
- sleep for N ms /mox/sleep?seconds=1
- sleep for random 0-N ms /mox/sleep?seconds=1