Questions tagged [wiremock]
Library used for stubbing and mocking web services.
778
questions
0
votes
1
answer
22
views
wiremock java matchingJsonPath with AND/OR condition not working
{
"id": "0001",
"type": "donut",
"name": "Cake",
"ppu": 0.55,
"batters":
...
0
votes
0
answers
21
views
How to Reproduce SSLHandshakeException scenario in Wiremock
I am using wiremock to mock the rest endpoints, and have to write a test where I want to simulate the behavior when my application hits an endpoint the receiving server should return SSL Handshake ...
0
votes
0
answers
17
views
Wiremock matchesJSONPath if null or empty
I'm trying to add a Wiremock stub that matches if the JSON in a request body is either non-existent OR an empty string.
The stub I have at the moment is:
{
"id" : "e331007e-3e6d-...
-1
votes
0
answers
11
views
Wiremock: how to form json for farm-data as post body [closed]
I need to mock the POST request for farm-data , but I am not able to do , getting error,
can someone help here
0
votes
1
answer
29
views
wiremock path param matching [closed]
I need to create very basic mapping stup for wiremock server for the integration tests.
I am calling the POST with the payload on url that has path param in it:
/ngdms/odrers/{order-id}
this is the ...
-1
votes
2
answers
59
views
Xpath matching with wiremock.net
I am trying to match request body in my wiremock.net mock service and send specific response back, only when
'code' tag contains value of '01.23.45.678.910'.
here is the xml:
<soapenv:Envelope ...
0
votes
0
answers
18
views
Hybris java.net.ConnectException: Connection refused during ant integrationtests
I have Integration test which have call to a configured WireMock server. I can see in the logs, that wiremock starts successfully, also I can curl the URL, but when I'm trying to reach URL from test ...
1
vote
1
answer
28
views
Pick wiremock parameter dynamically
I am trying to use the body of the request as a lookup object. I can add transformer parameters but then I need to pick the correct one using a json query. For example with this stub:
stubFor(
...
1
vote
1
answer
170
views
WireMock not matching regex with negative lookahead
I'm currently facing an issue when trying to get my standalone WireMock to match a GET request with a certain path pattern using a regex with a negative lookahead:
{
"request": {
&...
3
votes
1
answer
45
views
Ho do I intercept wiremock request to replace its entire body with new body
I am getting wiremock request which is in encrypted format (either whole body or some fields). I wanted to create a wiremock extension which intercepts wiremock request and replaces encrypted body ...
0
votes
1
answer
28
views
starting wiremock as part of local development
I have a hello world micronaut application which starts locally and makes some calls to an external service. What I want to do is start wiremock as part of the local build on my machine, so that ...
0
votes
0
answers
24
views
How to create wiremock stubs in NestJS?
I have a requirement to create Wiremock stubs in NestJS.
As per the firm policy, I can only use Wiremock NPM as mentioned here: Wiremock NPM
However, there is a limited documentation available so ...
0
votes
0
answers
38
views
MalformedStreamException when sending multipart http request to Wiremock
I am using Wiremock (which appears to use jetty) to stub some http responses.
I am sending a multipart http request but Wiremock/jetty responds to with a 500 error and some html which details a ...
0
votes
0
answers
25
views
Exception in thread "main" java.lang.NoClassDefFoundError: com/github/tomakehurst/wiremock/core/Options
Getting this error whenever I am trying to run the jar file. How to fix this
Error: A JNI error has occurred, please check your installation and try again
Exception in thread "main" java....
0
votes
1
answer
25
views
Wiremock JSON proxyBaseUrl with one value change in response
I want to achieve a proxy from another url with changing one value within the response
So having something like that (not working, just an idea)
{
"request": {
"method":...
0
votes
2
answers
71
views
Using regex to negate a filter in wiremock jsonpath
I am using wiremock for stubbing and it uses Jayway JsonPath.
I want to create a stub only when the json element doesn't contain exactly 10 digits.
stub is
"request": {
"...
0
votes
0
answers
28
views
Cannot connect to Wiremock
I am trying to connect from java at some mocked endpoint with WireMock.
This is the initialization of the server at application start
public class Application {
static String userName = "xxx&...
0
votes
0
answers
45
views
how to fix request matching Date time error in query params wiremock
Why am i getting request match error in wiremock
"request": {
"method": "GET",
"urlPath": "/abc/v1",
"queryParams": {
&...
0
votes
0
answers
33
views
Integrate any document based database with Wiremock
while running Wiremock as a standalone server to mock apis,i am able to store mocks in a local file and able to load these inmemory.
can i integrate any remote document based data base like Mongo DB ...
0
votes
1
answer
14
views
Array in QueryParams wiremock
I need to pass through queryParams in wireMock
Person=[{age=6,name=AAA}]
I've been getting 404 when I test in the curl request. Aly leads would be appreciated.
Only thing i know is
"Person&...
0
votes
0
answers
17
views
Pass Array as Query Param WireMock
I need to pass the following array as query paramsin wiremock.Is there any possibility of doing that?
"Person": [
{
"name": "AAA",
"age": "...
0
votes
0
answers
40
views
How to get wiremock to return 404 on error instead of 500 when the response bodyFileName is not found
I'm looking at getting Wiremock to return a 404 instead of a 500 when it fails to find a response file. I have the following stub:
{
"request": {
"method": "GET&...
3
votes
0
answers
53
views
Wiremock withBodyFile OutOfMemoryError for large files
In the following stub request, I use withBodyFile which loads large files (>300MB) from specific locations on local disk using streams:
public void mockGetUrlContent(String url) {
stubFor(get(...
0
votes
1
answer
39
views
WireMock returning 404 when using PostJsonAsync
Getting a weird issue when using WireMock. This is my setup:
var reAuthRequest = new ReAuthRequest
{
ResponseType = "code"
};
var serializeObject = System.Text.Json.JsonSerializer....
0
votes
1
answer
44
views
MTOM with WireMock
I am trying to use soap MTOM protocol with WireMock, attaching one file to SOAP request directed to mocked service, but it gives me some problems...
@Test
public void AfpToPdf() throws ...
1
vote
1
answer
51
views
Disable logging of WireMock
I'm using @AutoConfigureWireMock(port = 0) to init mock server.
This is the setup class written in Kotlin:
@AutoConfigureWireMock(port = 0)
@SpringBootTest(
webEnvironment = SpringBootTest....
0
votes
0
answers
21
views
How can I mock rest client from external library in spring boot tests?
I tried to use MockRestServiceServer to mock rest client from external library but it doesn't work because tested code instantiate its own RestTemplate internally and I don't have access to it.
It ...
0
votes
1
answer
54
views
wiremock getting query param
Is there a possibility to get query param from wireMock?
I need to check if the param can be decrypted properly, but all I could found is withQueryParam() which is good for matching, but since I don't ...
0
votes
1
answer
36
views
WireMock - Is it possible to template the status code?
I'm currently trying to customize the Status code in a WireMock mapping.
I want to do something similar to this.
"response" : {
"status" :"{{#if true}}200{{/if}}{{else}} ...
0
votes
0
answers
65
views
Running Wiremock in HTTPS mode with Keystore
I am trying to create an HTTPS mocks using wiremock to test an external call.
Initially I tried to run the wiremock by providing the --https-port tag and set it as 8443. I was able to access localhost:...
0
votes
0
answers
78
views
How to exclude certain logging level from [Test worker] logger
I use WireMock library for unit testing and every time I receive a lot of the DEBUG logs:
I try to exclude logs with `logbak-test.xml' file but it give an unexpectedly result: even I create an empty ...
0
votes
1
answer
62
views
WireMockEducation:test: Could not find com.github.JensPiegsa:wiremock-extension:0.4.0
I tried to add the wiremock-extension to the project, but Gradle can't find the needed repository.
I take the repo from the official maven repo:
https://mvnrepository.com/artifact/com.github....
1
vote
1
answer
32
views
can I block mappings changes via API in WireMock standalone?
TLDR: Is there a way to disable whole or part of the Stub Mappings API (i.e. disable POST/PUT/DELETE to '/__admin/mappings')? Let's assume I want to do it on Wiremock instance level, not a proxy ...
0
votes
1
answer
106
views
422 Unprocessable Entity: Can Wiremock create scenario with a missing quotation?
I am creating a scenario wherein I'd intentionally remove the quotation in the request body and add the corresponding error message. However, Wiremock returns 422 unprocessable entity. Is there a way ...
0
votes
0
answers
29
views
Wiremock Standalone: dynamic response based on current day
I would like to mock API that returns the state of third party service. And there are a lot of them.
So, to cover our logic related to those statuses, I would like my mock to return different statuses ...
0
votes
0
answers
32
views
Is there a way for wiremock to accept duplicate values using postman?
I am using wiremock as my server. I tried to send a post request though postman. The request consists of duplicate values like this one.
{
"testType":"4ref345d9hkgfsg343",
&...
0
votes
0
answers
117
views
Disable Transfer-Encoding chunked in wiremock standalone server
I am running wiremock standalone using wiremockserver.
The application does not work in PCF because of the header Transfer-Encoding: chunked.
(If this header is present then in PCF I get the error 502 ...
0
votes
0
answers
45
views
Getting java.lang.ClassNotFoundException: com.github.tomakehurst.wiremock.common.FileSource while running wiremock test class via maven
I'm trying to run mvn clean install however while running the wiremock test class I'm getting the below exception
at org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate....
0
votes
1
answer
59
views
Wiremock - Connection Refused - JUnit5
I have a stub that I can see under /__admin/ but when making any sort of rest calls nothing registers in either __admin/requests or __admin/requests/unmatched which I feel is strange. Is Wiremock ...
0
votes
1
answer
24
views
is there a way to mock internal service calls while writing Component testcases
I'm writing my component level test-cases for my repository. My API calls internally a third party API which I need to mock. I don't have direct access to that API neither I can directly call it, it ...
0
votes
0
answers
79
views
Why is Wiremock server not picking correct stubbing with similar URL but different REST operations
I have an integration test that ends up making two API calls to the same service. One is a GET call, and the other is a PUT. When it calls the GET, it works just fine, but when it calls the PUT, it ...
0
votes
0
answers
174
views
Spring Cloud Contract with Wiremock - how to choose Scenario manually?
Im working in a project using Spring Cloud Contract and Wiremock to create integration tests. Everything was fine until we need to add multiple responses to the same request in Wiremock. Reading some ...
0
votes
1
answer
55
views
SSlconfiguration exception on finagle upgrade
I recently upgraded to finagle-core 22.4.0 from 21.4.0 and see this while loading integration tests in the application. I use wiremock-standalone version 2.27.2. Netty version is 4.1.73.Final. How can ...
0
votes
0
answers
36
views
wiremock logging format to JSON
We use wiremocks for functional tests on the CI pipeline. We have the following configuration yml file:
services:
- name: wiremock/wiremock:main-alpine
alias: mock-cms
command: [ &...
1
vote
1
answer
466
views
How to run "--verbose" for wiremock in docker compose file
I want to get verbose output from mockwire when running in docker using docker compose file.
I tried these three ways but none of them work.
first way
services:
wiremock:
image: wiremock
...
0
votes
0
answers
159
views
Wiremock test running individually, but not when executing all tests
I created some integration tests using wiremock. They pass individually, but when I execute the test task from gradle they fail with the following error:
2022-05-09 11:42:40.077 ERROR 23116 --- [...
0
votes
1
answer
257
views
How to write integration tests for spring boot rest API using wiremock, rest assured, Junit5
I have a basic spring boot project rest api and i want to write integration tests for my rest api. Tech stack: wiremock, restassured, Junit5. How to proceed further.
5
votes
2
answers
1k
views
Conflicting module versions. Module [groovy-xml is loaded in version 4.x.x and you are trying to load version 3.x.x
I am working to setup wiremock for springboot rest api and using rest assured and spring-cloud-starter-contract-stub-runner from spring cloud. when i run the sample integration test i encounter module ...
0
votes
1
answer
14
views
Is there a way to set custom responses from an external server when a specific request receive?
I have a program that is only displaying bug behavior when a certain response is received from an external server.
The only thing is, the external server is in a static state so no code changes can be ...
0
votes
0
answers
64
views
Not able to run wiremock server from docker file in intellij
I am new to docker.I was trying to create a wiremock for my pet project. I am able to run wiremock locally with command java -jar wiremock-jre8-standalone-2.33.1.jar --port 8089 --verbose
Now, I do ...