Given user is currently at Login page

With the Given above it would be invalid if I include the actual navigation to login page in the step definition simply because navigating to a page is an action and should be included in When.. unless that's just fine... or is there any other way to do it?

@Given("user is currently at Login page")
def user_is_at_login_page(){
    WebUI.verifyElementPresent('Login Page Heading')

I'm using Katalon Studio btw

  • That is just fine.
    – Mate Mrše
    Commented Dec 5, 2019 at 9:06

2 Answers 2


Given is your setup, it brings the system under test in a state you can start doing the action you want to test.

The given part describes the state of the world before you begin the behavior you're specifying in this scenario. You can think of it as the pre-conditions to the test.


Depending on the complexity of the Given it will most likely do actions that other scenarios would do as a when.

Often my givens (for example: Given a fresh user is on page X) do the following in a single step:

  • Clean data
  • Create data and users
  • Login user
  • Navigate to the wanted state

I like to keep my Given, When, Thens as short as possible, they should describe the behaviour not the details.


The Given statement usually fulfills both the test setup conditions of setup-action and setup-verification. However, in some cases it may not contain the setup action. So, it basically depends on your test and there is no hard rule for not including an action. For example,

Given I am at some bakery
When I place an order for some cake
Then I get an invoice for my order

Here, the Given statement can have both scenarios, of the tester having to go the bakery, or being already at the bakery. Therefore it depends on how the test specification and/or test automation services requires the scenario to be setup.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.