1.

What are annotations in Cucumber?

Answer»

An annotation is a type of TEXT that has been pre-defined and has a specified meaning. It tells the compiler/interpreter what to do when the program runs. The annotations on Cucumber are as FOLLOWS:

  • Given: It specifies the requirements for RUNNING the test.
    Example: Given I have an account on Interviewbit.
  • When: It establishes the starting POINT for any test scenario.
    Example: When I log in to Interviewbit.
  • Then: It contains the expected result of the test which is to be executed.
    Example: Then registration should be successful.
  • And: Between any two statements, it gives the logical AND CONDITION. AND can be combined with the GIVEN, WHEN, and THEN statements.
    Example: When I enter my account number AND CVV.
  • But: It denotes a logical OR relationship between two propositions. OR can be combined with the GIVEN, WHEN, and THEN statements.
    Example: Then I should be logged in BUT I must enter the OTP.


Discussion

No Comment Found