In Cucumber, is it possible to programmatically get the current step being executed?

后端 未结 11 2675
清歌不尽
清歌不尽 2020-12-04 00:22
Scenario: As a user, I want to login to the system
Given I am on my website
When I enter valid credentials
Then I am taken to the home page

The sce

11条回答
  •  南笙
    南笙 (楼主)
    2020-12-04 01:08

    Are you asking if it is possible to get some logging that indicates that the step When I enter valid credentials is executed?

    If so, the answer is yes.

    Cucumber as such doesn't have a notion of logging so you would have to add your own favorite logging framework. Since Cucumber doesn't know about logging through your favorite log framework, you will have to add a log statement in each step you implement in Java.

    I have never seen the need for logging myself. The execution log from Maven, or whatever build tool you are using, have been sufficient for me for a long time.

    The reports include the steps executed so that case is covered.

提交回复
热议问题