Search code examples
apirobotframeworkbdd

robot framework - BDD style- No Given present


When writing BDD style test case in robot framework if there is no test or keyword, then what should be written in the Given statement? I am writing an API test using the BDD style in the robot framework. But for the very first test which will be executed there is no Given statement that will be executed. Is there any placeholder which we can use? Please suggest


Solution

  • If there is no Given statement, then you should skip it. IMHO, You shouldn't write for styling as well. BDDs are meant to express the business requirement and having a dummy G-W-T statement, which doesn't explain a requirement doesn't make sense.

    For an example, your BDD should look like

    When the user registers only with First Name and Last Name 
    And doesn't enter Age 
    Then the error message "Please enter Age" should be displayed