For the complete documentation index, see llms.txt. This page is also available as Markdown.

clearKeychain

Clear iOS keychain data for the app under test.

The clearKeychain command clears all data from the iOS Keychain.

Syntax

The command takes no arguments.

- clearKeychain

Why use this command?

The iOS Keychain is a secure storage container used by apps to persist login credentials, tokens, and other sensitive information.

In automated testing, the Keychain can become a source of state leakage, where a previous test run leaves a user logged in, causing subsequent tests to fail or behave unexpectedly. Using clearKeychain ensures your app starts from a clean, default state.

Automate Keychain clearing

If you want to clear the Keychain every time the app starts without adding a separate command, you can use the clearKeychain parameter directly within the launchApp command:

- launchApp:
    clearKeychain: true

You can use Hooks to automate Keychain clearing across all your tests.

Last updated