mirror of
https://github.com/wiremock/WireMock.Net.git
synced 2026-01-11 14:20:29 +01:00
Is there a way to record API calls in the file format required for WireMock Testcontainers? #592
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @asos-alexhaigh on GitHub (Apr 30, 2024).
One feature of WireMock that I have always appreciated was the ability to generate the JSON files for Mocks by recording requests and responses from the real API. It removes human error and allows us to have full confidence that we are testing with the correct data.
I've just started using the WireMock test containers in a new project and it seems that it requires JSON in a different format which has required me to manually adjust the files to get it to work.
Is there a way to record files so I don't have to do this manual step?
This is how I am loading the mapping files
An example of a recorded JSON file. This will not work when provided to a testcontainer.
My manual migration from to the above, to make it work with the test container.
@StefH commented on GitHub (Apr 30, 2024):
The recorded JSON file seems to be from WireMock (Java version)
The manual migration JSON is the one that this project (WireMock.Net for .NET) uses.
Note that there should be some support in this project to support JSON files from WireMock.org (Java), bit I'm not sure if that still works.
See also https://github.com/WireMock-Net/WireMock.Net/wiki/WireMock.Org