Testing Login Functionality with TestDriver
Test login functionality with TestDriver. This scenario demonstrates how to automate testing the login process for a web application using TestDriver.Prerequisites
Before running the tests, ensure you have performed the following steps:- If you haven’t already, signup for a Free Trial on the TestDriver website
- Run the
initcommand to set up the TestDriver configuration using the API key you got when you signed up for the trial:
Now you are ready to run the tests!
Scenario overview
- Visit the login page of the web application.
- Enter the username and password into the respective fields (see [Reusable Snippets](/features/reusable-snippets#How-to Create-and-Use-Reusable-Snippets)).
- Click the “Login” button.
- Verify that the user is redirected to the dashboard or home page after a successful login.
- Optionally, check if the user is logged in by verifying the presence of a logout button or user profile information.
Setup your test environment with predefined credentials.
This example uses GitHub secret management to store credentials. To use GitHub secrets, create or modify an existing.env file in the root of your project and add the following lines:
- Create a test file and use the credentials like this:
login.yaml
- Run the test using the command line:
- Watch replays in Your account

