My Certifications Visit Documentation Mabl Home Mabl Product Portal Mabl Login

Login Flows

Summary

Summary

Learning targets 🧠
In this video, you will see how to: 

  • Add and manage credentials
  • Create a login flow in a test
  • Apply a variety of login flow use cases

Review our documentation: Login Flows

 

Why is this important?

Login flows are an important part of test automation, but not every team uses the same authentication scenarios. Whether you use the same username and password, multiple sets of credentials per environment, or some other combination, there are options in mabl that can help with managing credentials and maximizing reusability. 🙌

What is it?

A login flow incorporates credentials (e.g. username and password) into a parcel of reusable steps that can be applied as needed to your mabl tests.

Getting started

mabl credentials

mabl provides a designated place for storing usernames and passwords in the Configuration -> Credentials section. 

While this is a natural first choice for many users setting up their login flows, depending on your current setup, there may be another option that better suits your situation.

Options for Storing & Managing Credentials

As you consider the following options for setting up credentials, ask yourself the following question:

"Which option would be the easiest for our team to manage?"

Credentials

  • Username and password appear in the test as app.defaults.username and app.defaults.password
  • Credentials need to be associated with a test run or plan run
  • Only one set of credentials can be associated per plan, making this a good option for teams who use a default set of credentials for most tests.
  • This is also a good option if you want to temporarily associate a set of credentials with a test or plan run, either in the app itself or from the mabl CLI. 

How to associate credentials with a plan or test:

  • For a plan or a new browser test, toggle on "Show advanced options" and select the credentials from the dropdown.
  • For an ad hoc test run, choose the appropriate credentials from the "Login credentials" dropdown.

Environment variables

  • Ideal for teams that use different credentials in different environments
  • Updates to usernames/passwords can be handled on the environment level

Steps to create an environment variable:

  1. Click on the "Configuration" tab on the left.
  2. You should see your environments listed across the top of the table.
  3. Hover over the environment name (NOT the URL) and click on the pencil that appears
  4. Click on "Add Environment Variable"
  5. Create username and password variables.

Note: You should create these variables with the same name in each environment that uses them.

*Helpful tip: Following the convention of using all caps for environment variables (e.g. ADMIN_PASSWORD) can help distinguish them from the other variables while training a test. 🤓

Designated login flows

  • Ideal for teams that test a small number of user roles (e.g. < 10)
  • Each user role has a designated login flow (e.g. admin, standard user, manager)
  • Credentials can be managed from the Flows section (updated within a specific test)
  • Eliminates the need to set credentials for a test or a plan
  • Can accommodate environment-specific credentials

Steps to record and save a designated login flow:

  1. Click on the "+ Add steps" button
  2. Click "Create flow"
  3. Give the flow a name that will connote its purpose (e.g. "Admin login")
  4. Record steps for the login within the flow

To update credentials, you can go to one of the tests using the flow, click "Edit steps" and update within the test. (The flow will be updated across all tests that use it.)