mabl credentials are a special type of variable used for training login and authentication scenarios. This article explains how to work with credentials in mabl, including how to…
- Create credentials
- Require cloud credentials
- Configure credentials for test authoring
- Assign credentials to a plan
- Assign credentials to an ad hoc run
- Review credentials in test runs
If you're looking for information about training logins for your app, check out the article on logging into your app.
How to create mabl credentials
Workspace owners and editors can create a new set of mabl credentials by taking the following steps:
- Go to the credentials page: Configuration > Credentials
- Click on the + New credentials button.
- Enter the name of the credentials, the username, and the password. Optionally, you may configure additional settings:
- Add the credentials to a resource group to control who can access them.
- Save the credentials as cloud credentials. If your workspace requires cloud credentials, this checkbox is already selected and you cannot clear it.
- Add an MFA authenticator to use the credentials for multifactor auth workflows.
- Click Save.
How to require cloud credentials
Workspace owners can require that every new set of credentials in the workspace be saved as cloud credentials. This policy is off by default. To turn it on:
- Go to the workspace settings page: Settings > Workspace
- Under Cloud credentials, turn on Require cloud credentials.
mabl enforces this policy in its API rather than only in the create form, so it covers credentials created through the web app, the mabl CLI, and the public API alike. It applies to every user in the workspace, including other workspace owners and API keys.
Existing credentials are unaffected. They remain readable, editable, and usable for local training and execution, and the policy never converts them for you.
For guidance on when to require cloud credentials, check out the article on recommended security best practices.
How to configure credentials for test authoring
In manual training sessions, select the credentials you want to train with in the Optional configurations section.
- Credentials appear in the Trainer as
app.defaults.usernameandapp.defaults.password. In the API Test Editor, you can access mabl credentials asapi.credentials.usernameandapi.credentials.password. - HTTP basic auth credentials are applied when the browser launches in the mabl Trainer. They cannot be updated partway through a training session.
In test planning sessions with the mabl agent, specify the credentials you want to use, or add them manually by updating Test information.
Cloud credentials are not available for local training
You cannot use cloud credentials to train tests on your local machine, including manual training sessions and agent sessions started with Generate against local app. Depending on the situation, consider one of the following alternatives:
- Generate the test with the mabl agent. When you click Generate, mabl generates the test in the cloud, where it can access cloud credentials.
- Train the test with a different set of credentials. If you need to create the test on your local machine, train it with an alternative set of credentials that has the correct privileges and configure the test to use the cloud credentials during execution.
- Change the credentials for the current training session. If you are already in the Trainer, select a set of credentials that mabl can access locally: {x} > Manage variables > Session configuration
How to assign mabl credentials in plans
In plans, you can configure credentials either as a default for the entire plan run or as a test-specific override.
Add plan-level credentials
To assign default credentials to a plan, expand Advanced options on the plan settings page. Toggle on Login credentials required and select the credentials from the dropdown. Unless there is a test-specific override, tests will use these plan-level credentials during execution.
Configure test-specific overrides
Test-specific credentials function as an override and take priority over any plan-level credentials. To assign mabl credentials to an individual test, update its test variables in plan settings. If you are on the Edit plan page, you'll first need to click on the Show tests button to access individual tests in the plan.
In the Test variables panel, click on + Add parameter. Set the Type field to "Credentials" and select the credentials you want to use.
mabl credentials are not environment-specific. If an app login requires different credentials in different environments, you can use environment variables to log in to your app.
How to assign credentials to an ad hoc run
To assign credentials to an ad hoc test run, take the following steps:
- Navigate to the test details page of the test that you want to run.
- Click on the Run test button.
- Select the credentials you want to use. Cloud credentials are not available for local ad hoc runs.
- Click on the Start run button.
Reviewing test runs with mabl credentials
For security, mabl replaces the value of app.defaults.password and api.credentials.password with asterisks in local and cloud run output.
To identify which set of credentials were used in a browser or mobile test run, you can click on the setup step - mabl test run setup click to view logs. If credentials were passed to the test, they appear in the logs of this step.
In the following screenshot, the test output page shows that the "admin" credentials were used in this test run.
Checking credentials on the test output page