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
init
command 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.You can also use the
exec
command to fetch a test user
dynamically from a database or API..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