Search for the Right Document
< All Topics
Print

BDD Scenarios Example for User Login

Feature: User Login

Description: Users should be able to log into the system with their registered email and password. The system should validate user credentials and provide appropriate feedback.


Scenario 1: Successful Login

Given the user is on the login page
And the user has a registered account with a valid email and password
When the user enters a valid email and password
And clicks the “Login” button
Then the user should be redirected to their dashboard
And the user should see a welcome message, “Welcome back, [User’s Name]!”


Scenario 2: Login with Invalid Credentials

Given the user is on the login page
When the user enters an invalid email or incorrect password
And clicks the “Login” button
Then the user should remain on the login page
And the user should see an error message, “Invalid email or password. Please try again.”


Scenario 3: Login Attempt with Unregistered Email

Given the user is on the login page
When the user enters an email that is not registered
And clicks the “Login” button
Then the user should remain on the login page
And the user should see an error message, “The email you entered is not registered.”


Scenario 4: Account Locked After Multiple Failed Attempts

Given the user is on the login page
And the user has failed to log in with incorrect credentials 5 times
When the user attempts to log in again
Then the system should lock the user’s account
And the user should see a message, “Your account has been locked due to multiple failed login attempts. Please reset your password or contact support.”


Scenario 5: Forgotten Password

Given the user is on the login page
When the user clicks the “Forgot Password” link
Then the system should navigate the user to the “Password Reset” page
And the user should be prompted to enter their registered email
And the system should display a message, “Please check your email for instructions to reset your password.”


Scenario 6: Redirect Logged-In User

Given the user is already logged into their account
When the user tries to access the login page
Then the system should redirect the user to their dashboard
And the user should see a message, “You are already logged in.”

Table of Contents