How does dependency injection work in Cucumber? How does dependency injection work in Cucumber? selenium selenium

How does dependency injection work in Cucumber?


As I understand you correctly you use JUnit as a test framework with cucumber-spring. JUnit provides the following lifecycle.

When you annotate the method with annotation @Before that it will call this method before each test that you have. As for @After could be used for cleaning resources and call after each test.

Your test flow when you run the test:

  • testInitializer
  • i_clcik_on_the_button
  • tearDownTest

In addition, you could use logging (slf4j) instead of System.out.println and it will be easier to track test flow.