986 questions
-3
votes
0
answers
43
views
Why does can stop working test with Wiremock [closed]
I have tests which work exactly how they should work, but then something happen, and now It doesnt work. I think It can be problem with version.
public void mockEmployeeSearch(...
3
votes
4
answers
111
views
How can I get request.query.size as empty value instead of length of the structure when the query parameter isn't sent
I am trying to dynamically generate a list with N entities, the quantity can be set using the query parameter size as the following GET /search?size=15. I want to set a default value for it when the ...
0
votes
1
answer
110
views
wiremock AutoConfigureWireMock HttpHostConnectException: Connection refused
@ActiveProfiles("it")
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
@ContextConfiguration(classes = ServiceApplication.class)
@AutoConfigureWireMock(port = 0)
@...
0
votes
1
answer
31
views
How to configure Wiremock to work with AVD?
I'm trying to setup wiremock standalone in the way to record all requests from certain api on my android emulator with steps below:
Launching wiremock on machine with:
java -jar wiremock-standalone-3....
0
votes
0
answers
38
views
How to test aync Spring WebClient with WireMock?
Whenever I have a client in my Spring Boot application I use WireMock for integration testing. Works very well.
I now have to implement an async client for which I am using WebClient, but my typical ...
0
votes
1
answer
140
views
Connection handling problems when repeatedly starting server on ephemeral port
In the following scenario:
In a loop:
construct and launch server
construct client and make a request
print response code
cleanup server and client
I am seeing occasional timeouts and rarely other ...
0
votes
1
answer
130
views
What's the deal with url and urlPattern in WireMock?
I use WireMock to stub the following URL to an external service: /users/{username}/repos. The official docs says that using regexes is discouraged
note Using the Path and query regex is generally not ...
0
votes
0
answers
110
views
What's the right way to configure the directories with WireMock?
My resources tree is
src/test/resources/
├── application-test.yml
└── wiremock
├── __files
│ ├── github-repo-branches.json
│ └── github-user-repos.json
└── mappings
├── ...
1
vote
1
answer
49
views
Integrating wiremock with node for google oauth flow
I am trying to mock google oauth flow with wiremock in my nodejs app for integration tests.
I have configured in my passport manager code:
passport.use(new GoogleStrategy({
clientID: config....
0
votes
0
answers
48
views
Where does wiremock.net-alpine bodyFileName files need to be mounted?
This is what my current docker compose looks like, wanting to mock a service where the mappings are mounted to /app/__admin/mappings and files that are used in bodyFileName are mounted to/app/__admin/...
1
vote
0
answers
150
views
WireMock SSL Connection Error When Mocking External HTTPS Service
I'm encountering an SSL connection issue when using WireMock to mock an external HTTPS service. The mock server is configured and starts up correctly, but when my application tries to make a request ...
0
votes
0
answers
79
views
Is it possible to use come context-path for Wiremock/Wiremock-UI
I am trying to use holomekc/wiremock-gui:3.x.x-alpine version as a Docker base image to create Docker file with wiremock UI. And my problem is that seems there is no way to set up some context-path in ...
0
votes
0
answers
33
views
Typecasting the response from the date time function to a number
I am using the same function - "ts":"{{now offset='1 months' format='epoch'}}". The Response I get is "ts":"1749708866319".
I need the response as a number ...
1
vote
1
answer
53
views
Why are files baked into my image not available when deployed in an app service container?
I'm trying to deploy a custom image to an app service in azure.
Incidentally it's based on a wiremock image and simply copies some configuration files to be used at runtime.
When I docker build and ...
0
votes
1
answer
84
views
Wiremock sending error response while running test suit
I run Wiremock as a standalone server by using below parameters.
java -Xms2048m -Xmx2048m -Dhttp.keepAlive=true -jar wiremock-standalone-3.12.1.jar --max-request-journal-entries 300 --global-response-...
0
votes
0
answers
53
views
WireMock how to fail unmapped requests?
We're using WireMock with browser proxying and snapshotting for tests where requests to remote services is not under our control. This works really well.
The thing we'd like is for any requests, that ...
0
votes
0
answers
54
views
Wiremock stubbing for queries with list values
I have no problem with stubbing request with several query parameters in Wiremock. But when one or many of them are required to be in format ?name=value1&name=value2&name=value3 I get stumped.
...
1
vote
0
answers
225
views
How to return a number instead of a string in Wiremock JSON response template
Below is shown the JSON response file for a wiremock request. The issue is that the value for num in the request is a number, but this response file is returning num as a string.
{
"num": &...
0
votes
1
answer
89
views
Wiremock verify lost ThreadLocal Context in quarkus 3.19.1 and wiremock 3.0.1
I have a question about wiremock
AppResourceTest.class in the link below doesn't work as i expectedwith wiremock-standalone.
I start Wiremock server inside a QuarkusTestResourceLifecycleManager custom ...
0
votes
1
answer
364
views
Wiremock Docker reporting Unhealthy Health status when using a port not 8080
I am setting up a wiremock docker for running my (Spring) app locally and running tests locally and in a pipeline. I am using port 8081 rather than port 8080 as 8080 is used by the application to ...
0
votes
0
answers
56
views
How to register mocked server to Discovery Testcontainer - OpenFeign & Wiremock
TL;DR:
How to mock a microservice in integration tests when using Feign and Eureka?
I am running integration tests on the Controller Layer of my Employee Service, which uses OpenFeign to create a ...
0
votes
0
answers
136
views
WireMock verifyThat fails when tests are executed in parallel
I'm using WireMock standalone App through docker. A few mocked endpoints are shared across many tests. When I run my tests sequentially, all work fine and pass. But when the tests are executed in ...
0
votes
1
answer
43
views
Need to assign last url parameter to property in wiremock mapping
I want to assign last url parameter to object property which should be in integer
Example :
{
"request": {
"method": "GET",
"urlPattern": "/api/v4/Automation/Get/test/([0-9]+)"
},
"...
0
votes
1
answer
464
views
How to Load wiremock-state-extension in Wiremock Docker container
Currently, I am using Wiremock 3.12 version.I am trying to load wiremock-state-extension from local folder to container folder.So, According to official documentation:
https://github.com/wiremock/...
1
vote
1
answer
84
views
Is there a way to add a Component referencing a WireMockContainer to a Dapr testcontainer?
I am trying to test a spring boot application using dapr. For my test set up I want to start a Dapr testcontainer and have a Conmponent that references a Wiremock testcontainer to stub http calls.
...
0
votes
1
answer
256
views
Wiremock stub mappings missing after switching thread in asynchronous invocation
I'm writing integration test using Wiremock, in Kotlin and Micronaut.
I have endpoint that do some logic, then it runs async function (and return 202), like this:
@Async
open fun asynFunction(): ...
0
votes
1
answer
184
views
Custom Action for a wiremock stub
I have my wiremock service running on a kubernetes pod. One of the mappings is as follows:
{
"request": {
"method": "POST",
"urlPattern": "/v1/...
0
votes
1
answer
153
views
Wiremock failed on Spring Bean init method
I tried to mock three APIs provided by ShortPixel with Wiremock.
https://shortpixel.com/knowledge-base/article/shortpixels-cdn-api-endpoints/
https://shortpixel.com/knowledge-base/article/shortpixel-...
0
votes
1
answer
245
views
Why does WireMock return a binary file with changes?
I have a stub with the following description: in the image.
wiremock stub in postman
The bodyFileName is set to response.bin, which WireMock should return. However, for some reason, WireMock returns a ...
0
votes
1
answer
66
views
Redirect url from x-www-form-urlencoded request doesn't work out of the box
row body is printed in Postman as
TradeSha=https%3A%2F%2Fenv.example.com%2Fpayments%2FRedirectHandler%2F1002%3FtId%3D100201195%26token%3D9c8dce5b-ddbb-4190-9cbe-3da45fad50d2
Location header is printed ...
0
votes
1
answer
417
views
Wiremock GRPC demo example is not returning response
I am trying to run the demo provided at wiremock grpc page using spring boot: https://wiremock.org/docs/grpc/
I have the following configuration for the beans:
@Configuration
public class ...
0
votes
1
answer
112
views
How to check if all elements of JSON array have property in request body with Wiremock?
I have a following example JSON body, which will be sent to Wiremock.
{
"array1": [
{
"prop1": "value",
},
{
"prop1": "value"...
0
votes
2
answers
100
views
How to Handle Dynamic Parameters in Request Object for WireMock API Testing .Net?
I am trying to create a request object with a dynamic parameter for testing an API endpoint using WireMock. Below is my current implementation:
var response = new Response
{
CustomerId = ...
0
votes
0
answers
624
views
Mocking a gRPC server with wiremock-grpc-extension. Getting "Method not found error"
I have two services communicating with gRPC (one is gRPC server, and the other is gRPC client). I want to write a test for the gRPC client and want to mock the gRPC server.
I am trying to that by ...
0
votes
1
answer
245
views
How to reference key from same JSON during response templating in Wiremock Standalone
I'm using WireMock Standalone to mock API responses, and I need to dynamically calculate values within my response templates. Specifically, I want to perform basic arithmetic operation (multiplication)...
-1
votes
2
answers
575
views
How to fail a test case while Wiremock encounters Request was not matched
I am using Wiremock with version and Java 21
<dependency>
<groupId>com.github.tomakehurst</groupId>
<artifactId>wiremock</artifactId>
<version&...
2
votes
1
answer
332
views
How to disable WireMock server for a single test?
I'm writing tests for my Spring Boot service. I use Wiremock for mocking HTTP requests. I need to disable the WireMock server temporarily for one specific test to simulate the unavailability of the ...
0
votes
0
answers
85
views
Upgrade to Spring Boot 3 and in dependency heck. Can someone explain "omitted for duplicate" and "version managed from" in dep:tree -Dverbose
I've been fighting versions in maven all week, and I'm getting desperate.
I finally got it to compile, but there are somehow subtle differences that show up at runtime. Specifically for the wiremock ...
1
vote
1
answer
143
views
Wiremock should not trust backend endpoint when proxying
I am running Wiremock as a standalone process to proxy all requests to "https://mybackend.net". Why the connection is trusted (I expect a SSL certificate problem)?
This is the command used ...
1
vote
1
answer
352
views
Wiremock has null requesthandler when testing multiple classes
I am attempting to upgrade one of my projects to use Spring Boot 3. The code is running with no issues and all of my tests pass when run individually or I run tests from only a single class.
The issue ...
1
vote
1
answer
107
views
Wiremock sends 404 error for HEAD request
I'm having a file correctly served by wiremock standalone, located in a subdirectory of __files, via an http GET request sent by curl:
Curl -XGET http://wiremockserver/api/file/myfile.json
So myfile....
0
votes
1
answer
334
views
Whats the best way to test OpenAPI generated code with WireMock that runs on dynamic port?
I have Spring Boot 3 application. I use openapi.json to define rest client and openapi-generator-maven-plugin to generate java code for the client. This results in ApiClient class being generated ...
0
votes
1
answer
199
views
How to handle dynamic number of path parameters in Wiremock?
I am new to Wiremock and am having problem handling a URL that can have one or more path parameters.
For example, I have this URL:
/product/{productname};weight={weight};size={size};isdigital={...
2
votes
1
answer
736
views
wiremock jsonPath and int values
I'm Evaluating the Wiremock to be used in our project
Need help in understanding how to generate the integer field in the response taken out of request (both are JSONs).
Example of stub mappings:
...
0
votes
0
answers
102
views
How to override --root-dir when starting mock server in IntelliJ?
I want to use WireMock plugin in Idea Intellij Ultimate but I want to make the same folder's structure executable from WireMock standalone, which is:
<ROOT_DIR>/mappings
<ROOT_DIR>/...
0
votes
1
answer
608
views
Response Template in Wiremock Standalone is not working with json string
I have the following response configuration that I'm testing with wiremock standalone jar v3.4.0.
{
"id": "e6e2b5cf-52c1-3b0a-b368-3ea71e444fbf",
"request": {
&...
0
votes
1
answer
252
views
How to specify which WireMock stub JSON file to use in each test case?
I have some integration tests which use WireMock for stubbing external HTTP requests. All of the stubs are located in a mappings directory and are all automatically picked up by the tests.
I would ...
-2
votes
1
answer
110
views
wiremock in java offset 1 hour [closed]
help please.
trying using in wiremock dynamic data
Wiremock editing in intellij idea
"expiresAt": "{{now offset='1 hour' timezone='Australia/Sydney' format='unix'}}",
but got error ...
0
votes
0
answers
212
views
Quarkus Wiremock: RequestBody actual and expected not equal due to added value to the expected value
I'm in need of some help with the following: Upon verifying the actual body content to be equal to the expected I run into the following issue:
CLICK HERE FOR THE IMAGE -> Expected vs Actual body ...
0
votes
1
answer
246
views
Wiremock extensions ClassNotFoundException with Dockerfile
I have the following situation:
I have the following folder structure:
-- wiremock (root)
--- src/main/java/org/company/wiremock/CustomHostTransformer.java
--- src/main/resources/META-INF/services/com....