Service Testing with Mesh Dynamics
Mesh Dynamics supports service testing by developers from their laptops, as well as running service tests in CI. We first outline the underlying process. Then we will go over the differences in the setup for each of these use cases. In addition, the setup needs to change depending on whether you are using a Kubernetes environment (which does the service discovery for you), or an environment where you need to do the service discovery yourself.
Process overview

The process of creating service tests includes:
- Creating test requests for the APIs exposed by the service, and creating a collection with the test requests.
- Converting the collection to a test suite. Mesh Dynamics automatically creates accurate mocks for the egress requests and corresponding responses.
- Add context propagation rules, if necessary. Mesh Dynamics identifies and suggests rules by learning from the API data.
- Running the test suite once to generate sample test results.
- Adding decision rules to the test suite. Mesh Dynamics identifies and suggests rules by learning from the original and test run data.
The service tests created can subsequently be run from either the developer's laptop, or in CI.
The test suite must be updated as new test cases are identified, as APIs evolve, or additional capabilities are added.
Local vs CI
Local setup
The following configuration is used for running service tests locally from the developer's laptop with the service under test running in the developer's IDE.

- Mesh Dynamics' cloud test driver drives the requests to the local copy of the service running in the developer's laptop through ngrok.
- Egress requests go to the API Studio proxy, which accesses the cloud mock service.
- The results are sent to the Mesh Dynamics cloud service.
You may need to change the egress request configurations for your service to send the requests to the API Studio. In addition to the configuration change, you need to run ngrok to be able to forward the requests from the cloud test driver to the local instance of the service under test.
CI Setup
In the CI setup, Mesh Dynamics cloud test driver drivers the requests directly to the service. The service configurations for egress requests must be setup to be sent to the Mesh Dynamics cloud services.

Kubernetes vs Docker
If you are using Kubernetes for deployment, or a Docker deployment that uses pre-determined service endpoints / ports, then you can specify the endpoint url for the services. Docker deployments that use dynamic service endpoints and rely on service discovery need to be handled differently. Testing in an environment with dynamic Docker deployments will be covered in a separate article.