BLOG
BlogGuides

Sign in to a mobile app in a test without the password in the test

Most app tests start behind a sign-in. Store the account once; the tester types the password into the app itself and the AI never sees it, on iPhone and Android.

Passwords do not belong in test text#

A test that starts "sign in with demo@example.com / Hunter2!" puts a password in a file that gets copied, shared, pasted into tickets and read by an AI. Every app test that needs an account has this problem.

Store the account once#

A sign-in account is a name, a username and a password stored for a project, for example customer with customer@example.com. Add it on the project's Sign-in accounts tab, or while writing a test with Sign in as…. The password is encrypted when saved, never shown again, never returned by the API, and never sent to the AI. The tester types it into the sign-in form itself.

Tests refer to it by name:

Open the app and sign in with the stored account "customer".
Check the home screen greets the user by first name.

The plan lists which accounts a test uses under Sign-in accounts; one the project does not have shows as (missing).

The plan before it runs: the steps, the checks, and the sign-in accounts it uses.
The plan before it runs: the steps, the checks, and the sign-in accounts it uses.

Fresh every run#

Each app run starts with fresh app data, so the sign-in is part of every test. That is a feature: a broken sign-in fails every test that needs it, which you will notice at once.

Several accounts, several roles#

Store one account per role ("customer", "admin", "free-user", "app-review"). The App Store reviewer's demo account deserves its own, used by a test of exactly what the reviewer will do: Pass App Store review.

Things the site's own rules still apply to#

  • Use accounts made for testing, not a real person's.
  • The tester signs in like a person, so one-session-per-user rules and sign-in alert emails apply.
  • Two-factor codes: give the run its own mailbox or phone number and sign in with an account whose codes go there (mailbox and phone number).
  • Deleting an account stops the tests that use it until you add it again.

From an agent#

An agent can add an account over MCP with add_credential, but the password then passes through the agent's own context. Prefer the web app, or the REST API from your secret store.

This post is part of Mobile release testing: a guide for app teams.

Filed underiPhone and iPadAndroidSign-in and codes