Sunday, 26 April 2020

SE - 76 - Something about BDD/Cucumber

-> A Background is run before each scenario, but after any Before hooks. The order of the operations  : Before Hook 1 -> Before Hook 2 -> … -> Background -> Scenario -> .....-> After Hook2 -> After Hook 1

-> Before hooks will be run before the first step of each scenario. They will run in the same order of which they are registered. After hooks will be run after the last step of each scenario, even when there are failing, undefined, pending or skipped steps


->@Before and @After tagging a method with either of these will cause the method to run before or after each scenario runs. They will run in the same order of which they are registered.

->Both @Before and background runs before each scenario

->There can be only one Background in one Feature file and it allows us to set a precondition for all Scenarios in a Feature file.

->An important thing to note about the after hook is that even in case of test fail, after hook will execute for sure.

No comments:

Post a Comment