Mocks

Service mocks provide predictable behavior from service dependencies to speed up both the development and testing stages. You also don't need to deploy the original services, removing the CPU, RAM, and HDD requirements.

UP9 can export mocks to most popular coding languages and frameworks like Python, Java, Javascript, and Postman, and to mock hosting solutions like Wiremock, HoverFly, and Postman. All artifacts are version controlled.

Accessing the Artifacts

Once you have UP9 installed and observing service traffic, you can download a zip file that includes all of the tests, mocks, and contracts that belong to the current workspace.

Download Tests, Mocks and Contracts This is how the folder looks when opened:

[zipped folder]/
├── tests/
├── mocks/
└── contracts/

Tests, Mocks and Contracts Folder

Mocks Folder

The mocks folder includes mock configuration for all services that were observed in service traffic.

  • mockintosh.yml- main file with all mocked endpoints
  • mock-data- a directory that contains response payloads.
  • docker-compose.yml- Easy way to spin up all services as mocks

Running Mockintosh as single process

Using Docker

Each service will use a different port from 8000 and above, so ensure you've supplied enough ports to Docker command:

docker run -it -p 8000-8005:8000-8005 -v `pwd`:/tmp testrio/mockintosh /tmp/mockintosh.yml

Running Mocks Locally

Each service will use a different port from 8000 and above.

Install the software and run mockintosh:

  1. pip3 install mockintosh
  2. mockintosh mockintosh.yml

Running mockintosh.yml will start your mock services, as below:

[2021-02-02 13:34:17,775 root INFO] Mockintosh v0.6.2 is starting...
[2021-02-02 13:34:17,775 root INFO] Reading configuration file from path: mockintosh.yml
[2021-02-02 13:34:17,810 root INFO] Configuration file is a valid YAML file.
[2021-02-02 13:34:17,817 root INFO] Configuration file is valid according to the JSON schema.
[2021-02-02 13:34:17,920 root INFO] Serving at http://localhost:8001 the mock for 'http://carts'
...
[2021-02-02 13:34:17,921 root INFO] Serving at http://localhost:8008 the mock for 'http://user'
[2021-02-02 13:34:17,921 root INFO] Serving at http://localhost:8009 the mock for 'http://zipkin'
[2021-02-02 13:34:17,921 root INFO] Mock server is ready!

MIT License

All artifacts come as open source with an MIT license.

Mockintosh

For more information on using Mockintosh, including mocking Kafka buses and remote management, visit Mockintosh.

Support

For support, feel free to use any one of the three: