Advanced HTTP Mocking with WireMock

Ash Grove

Create HTTP mocks with WireMock’s REST API from any language for deterministic testing and development. Don’t have mocks yet? No worries. You can record live traffic with WireMock that can be played back. Testing apps that rely on APIs can be painful, flaky and complicated because more than likely, the APIs you rely on are out of your control. It’s time to take control back.

During this talk, you’ll learn how to do the following:

* Record and playback network traffic.

* Programmatically setup mocks via the REST API with cURL, Node.js and Java.

* Simulate error scenarios & latency.

* Verify HTTP calls were made the expected number of times and with expected content.

* Simulate stateful behavior using “scenario” mappings (same endpoint, different results).

Bonuses:

* WireMock is FREE and OPEN SOURCE!

* All of WireMock’s features are accessible via its REST (JSON) interface and its Java API.

* There is a WireMockRule for Java JUnit tests.

* WireMock can run as an embedded HTTP server on an Android device. (with a few config tweaks)

Java node.js Web