Replies: 4 comments 1 reply
-
Can you publish somewhere a sample that does not work? |
Beta Was this translation helpful? Give feedback.
-
@maciejwalkowiak In cucumber with Spring Boot you have a class which define the runtime context for Cucumber Test. It is on this class you put the annotation @SpringBootTest(webEnvironment = RANDOM_PORT)
@CucumberContextConfiguration
@EnableWireMock({
@ConfigureWireMock(name = "my-service", property = "application.url"),
@ConfigureWireMock(name = "positions-service", property = "position.url"),
@ConfigureWireMock(name = "crm-service", property = "crm.url")
})
@Testcontainers
public class BootstrapCucumberContextConfiguration { After that I try to inject defined Wiremock server into Step class as we do for Spring Bean : public class Steps {
@Autowired
private BeanInterface bean;
@InjectWireMock("my-service")
private WireMockServer myService;
@Given("my step...")
public void step1() {
myService.stubFor(...);
} When you run this configuration you end up with a null myService which provoque a NullPointerException (of course). |
Beta Was this translation helpful? Give feedback.
-
In addition, Cucumber use the suite Junit 5 feature through the annotation |
Beta Was this translation helpful? Give feedback.
-
I don't think this is going to work. |
Beta Was this translation helpful? Give feedback.
-
I have successfully used this library for a @SpringBootTest. I am now trying to utilize it on a Spring Boot Cucumber test and am having issues. The @InjectWireMock isn't being wired for the test.
Has anyone been able to use this library with a Spring Boot Cucumber test?
Beta Was this translation helpful? Give feedback.
All reactions