Our great sponsors
-
Delphi-WebMocks
Library for stubbing and setting expectations on HTTP requests in Delphi with DUnitX
-
InfluxDB
Power Real-Time Data Analytics at Scale. Get real-time insights from all types of time series data with InfluxDB. Ingest, query, and analyze billions of data points in real-time with unbounded cardinality.
In the previous post Testing HTTP clients in Delphi with DUnitX and WebMocks we looked at a DUnitX test's basic structure using WebMocks to stub an HTTP endpoint. At this point, it appears very simplistic and not at all like many real-world HTTP interactions. Most requests don't merely respond "OK" with no content. Let's explore how and what content we can mock, giving your test subjects scenarios allowing you to write tests asserting their behaviour.
In the previous article, we saw how easy it is to set up a DUnitX project with WebMocks. In this article, we learnt how to customize HTTP responses with WebMocks using its HTTP-oriented interface methods. Give it a try in your projects and let me know how you get on in the comments or via Twitter. You can find the demo code on GitHub. The next part of this series will be along shortly "Matching HTTP requests with WebMocks in Delphi".
Related posts
- Matching HTTP requests with WebMocks in Delphi
- We created WireMock, an API platform that is designed to improve developer productivity and enables developers and testers to Mock APIs in every stage of the API lifecycle
- A chromecast alternative
- HTTP-Shortcuts: Android app to create home screen shortcuts that trigger arbitr
- How to protect API Keys in React projects using Gateweaver