Getting this below error...404 cannot register stu...
# help
s
Getting this below error...404 cannot register stub. I am trying to run in spring boot.
b
Hi @Shruti Mishra, why are you assigning the stub definition to the
wiremockRule
object and not to the
wiremockServer
object?
s
Ahh Okay @Bas Dijkstra will try with wiremock server in place of wiremockRule
Tried with WiremockServer in place of WireMock Rule @Bas Dijkstra but still the same 404 error is being thrown.
b
(Isn't there a way to properly post the code in Slack instead of in a screenshot? This is very hard to read...) I think you've got a different problem here... It looks like the only thing your test method is doing is adding a stub definition to your WireMock instance. Are you trying to call that in another test? There's a good chance you're spinning up the WireMock server anew for every test, which means that your stub definition isn't registered when you run the actual test. Try adding the stub definition and running the actual test in the same
@Test
method 🙂
s
@Bas Dijkstra Actually the code is in my system where I do not have the access to open the slack. Apologies for the same! Just wanted to confirm one point over here that, if we put @test annotation on the method, then is it possible to deploy that particular url in server...or in wiremock it is only written for testing purpose. Thanks.
b
No,
@Test
is an annotation used by your testing framework (JUnit or TestNG). It identifies a method as a test method.
s
Actually my requiremnt is to deploy the url in the server...in that case will wiremock work using spring boot?
b
I have no idea what 'deploy the url in the server' means, sorry. Maybe someone else does. Have you had a look here? https://docs.spring.io/spring-cloud-contract/docs/current/reference/html/project-features.html#features-wiremock
s
Hi @Bas Dijkstra I have been getting the same error from last few days, when trying to configure wiremock with Spring boot. "Request was not matched as there were no stubs registered:" As suggested, I have written only one testethod using wiremock server. wiremockserver.stubfor() Can you please sugggest some solution. Thanks
b
Hi @Shruti Mishra , that’s very hard to do without actually seeing what your code looks like. I’d love to help out and have a look but I don’t think I’ve got a lot of time this coming week, but if you’re allowed to share your code (via GitHub or in another way) I’ll see what I can do. The solution is probably not too difficult but without looking at the code it’s going to be guesswork.
s
Untitled.java
Hi @Bas Dijkstra Please find the postman and eclipse error console.
b
Thank you, I’ll try and have a look soon.
s
Thanks @Bas Dijkstra