0% Complete

Introduction

This lesson is intended for users who want to find an approach for handling credentials and logins in their mabl tests.

Before taking this lesson

Make sure you are comfortable with the following lessons: 

  • Organizing tests for success
  • Reusable testing flows
  • Mastering variables for testing

Learning objectives

By the end of this lesson you will:

  • Identify different options for managing credentials within mabl
  • Understand the use case for different types of 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.

Note: If your application uses basic auth login, you should refer to this help doc for handling authentication. 

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.

You can find more information on credentials here.

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.)

 

Reflect

What did we learn?

Reflect:

  • Can you identify three places where credentials can be stored and managed in mabl?

Apply

  • Think about how your team currently uses credentials for testing. What style of credential management in mabl would work the best for your team?
  • If you cannot decide on a strategy that works for your team, reach out to your CSM or mabl support for help developing a solution that fits your testing needs!

Feedback

Was this helpful?

Take this 2 minute survey to let us know how we can make mablU better!