
Using MockServer it is easy to selectively forward requests to a local process running in debug mode, all other request can be forwarded to the real services for example running in a QA or UAT environment during deployment and debugging it is helpful to run a single application or service or handle a sub-set of requests on on a local machine in debug mode.
Using MockServer allows development work to continue even when an external service fails
isolate development teams during the initial development phases when the APIs / services may be extremely unstable and volatile. If an API or service is not yet fully developed MockServer can mock the API allowing any team who is using the service to start work without being delayed start working against a service API before the service is available. create test assertions that verify the requests the system-under-test has sent. Avoid sharing data between tests that is difficult to manage and maintain and risks tests infecting each other easily set up mock responses independently for each test to ensure test data is encapsulated with each test. It is important only the system-under-test is tested and not its dependencies to avoid tests failing due to irrelevant external changes such as network failure or a server being rebooted / redeployed. isolate the system-under-test to ensure tests run reliably and only fail when there is a genuine bug. easily recreate all types of responses for HTTP dependencies such as REST or RPC services to test applications easily and affectively. This is useful in the following scenarios: MockServer allows you to mock any server or service via HTTP or HTTPS, such as a REST or RPC service. if an expectations is matched its action will be performed instead of proxying the request. when a request is received it is first matched against active expectations that have been configured. if MockServer is being used as a proxy expectations can also be created. the protocol is dynamically detected by both MockServer. HTTP, HTTPS / TLS, SOCKS, etc) are supported on the same port to simplify configuration all protocols (i.e. generated certificates use a single MockServer root CA certificate enabling the root certificate to be. all SSL traffic is handled transparently by auto-generating an appropriate SSL certificate. to proxy requests the operating system (or JVM) should be configured to use an HTTP Proxy. if the traffic is encrypted an SSL certificate is auto-generated allowing SSL traffic to be recorded transparently. requests are forwarded using a SOCK CONNECT CMD request that established a socket tunnel. an SSL certificate is auto-generated allowing encrypted HTTPS traffic to be recorded transparently. requests are forwarded using a CONNECT request that sets up an HTTP tunnel. to proxy requests the HTTP client should be configured to use an HTTP Proxy. each request is forwarded dynamically using its Host header. to proxy requests the HTTP client should use the hostname and port of MockServer. all requests are forwarded to a single hostname or IP and port. MockServer supports the following proxying techniques: record proxied requests and responses to analyse how a system behaves. verify proxied requests have been sent (i.e. HTTPS Tunneling Proxying (using HTTP CONNECT). proxy all requests using any of the following proxying methods:. retrieve logs, requests or expectations to help debug. return an invalid response or close the connection when a request matches an expectation. execute a callback when a request matches an expectation, allowing the response to be created dynamically. forward a request when the request matches an expectation (i.e. return a "mock" response when a request matches an expectation. if no matching expectation proxy requestĪn expectation defines the action that is taken, for example, a response could be returned. find matching expectation and perform action. Then, if no matches are found, it proxies the request if appropriate otherwise a 404 is returned.įor each request received the following steps happen: When MockServer receives a request it matches the request against active expectations that have been configured. both a proxy for some requests and a mock for other requests at the same time. a proxy recording and optionally modifying requests and responses. a mock configured to return specific responses for different requests. What is MockServerįor any system you integrate with via HTTP or HTTPS MockServer can be used as: APACHE JMETER ROOT CA CERTIFICATE DOWNLOAD CODE
To get started see the guide for mocking or proxying or the code examples.