Explain the purpose of keywords that are used for writing a scenario in Cucumber.

  • Given: keyword is used to specify a precondition for the scenario.
  • When: keyword is used to specify an operation to be performed.
  • Then: keyword is used to specify the expected result of a performed action.
  • And: keyword is used to join one or more statements together into a single statement.
  • But: For negative expected result. E.g I should not see.