Hello everyone, I am in need of help regarding usi...
# help
j
Hello everyone, I am in need of help regarding using Wiremock (WM) in automation. My situation is as follows: • there is already an instance of WM running in container on remote server where I have access to, which we used so far for manual testing only. • I have a Java based test automation project using Gradle build tool which includes WM library ◦ While WM is included but I am first one to use it ◦ this project was build by one of our senior devs, not me I am just a contributor here My intention is to call WM API before tests to check if there are any existing mappings and then process to result
if there are proceed with tests
if they are not there call method to add mappings necessary for services that are being tested and then proceed with tests
Now I am not sure if I can use the WM library imported via Gradle for this or do I need to create a so called "gateway" by including WM api and then using REST assured to create additional methods to contact the remote server. P.S. I am new to all this BE automation testing and I kinda learn as I go. So not really sure if this is correct solution.
o
Hi!
My intention is to call WM API before tests to check if there are any existing mappings and then process to result
Is it for manual or automated tests? For manual tests, indeed you might want to use a tool to ensure everything is configured correctly. For automated tests, you have two options: using an external service (like your current instance or WireMock Cloud) or creating WireMock instances right inside the tests
j
For automation. here is the very rough prep I did
o
Then it really depends. You can use the existing external server, or maybe just use the WireMock rules to configure everything within tests and keeping everything at one place.
j
well the tests are run against services that are also in pods running "next" to wiremock on the same server. So contacting the existing server felt like least work needed.
I forgot to add in initial description that these are regression/integration tests not unit/component tests.
o
Yes, then an external server might be better
WireMock Java library can easily interact with the remote server, using the same APIs. And there is a CLI client. So yes, it should be quite straigth forward to code your needs
j
ok thank you. I will try and see what I can do and if any problems arise I will pop here on Slack again
👍 1