This document provides information on how to configure and run End-to-End (E2E) tests for App Check providers using this sample app.
The app's behavior can be configured using environment variables passed during test execution.
Starting with Xcode 13, you can pass environment variables directly to the test runner by prefixing them with TEST_RUNNER_. The prefix is stripped when it reaches the test process.
TEST_RUNNER_RECAPTCHA_SITE_KEY: The reCAPTCHA Enterprise site key used by theRecaptchaEnterpriseProvider.- Access in Code: Read via
ProcessInfo.processInfo.environment["RECAPTCHA_SITE_KEY"].
- Access in Code: Read via
TEST_RUNNER_APP_CHECK_PROVIDER: Specifies which App Check provider factory to use.- Supported Values:
recaptcha(default),debug. - Access in Code: Read via
ProcessInfo.processInfo.environment["APP_CHECK_PROVIDER"].
- Supported Values:
For local debugging and manual testing, you can override the environment variables by setting manualProviderOverride in AppDelegate.swift:
let manualProviderOverride: String? = "debug" // Force debug providerThe commands below should be run from the repository root.
- Ensure you have a local checkout of the
app-checkrepository if you are developing it locally. SetFIREBASE_APP_CHECK_LOCAL_PATHto point to it.
export TEST_RUNNER_RECAPTCHA_SITE_KEY="your_site_key_here"
export TEST_RUNNER_APP_CHECK_PROVIDER="recaptcha"
export FIREBASE_APP_CHECK_LOCAL_PATH="/path/to/your/local/app-check"
xcodebuild test \
-workspace FirebaseAppCheck/Apps/FIRAppCheckTestApp/FIRAppCheckTestApp.xcworkspace \
-scheme FIRAppCheckTestApp \
-destination 'platform=iOS Simulator,name=iPhone 16'export TEST_RUNNER_APP_CHECK_PROVIDER="debug"
export FIREBASE_APP_CHECK_LOCAL_PATH="/path/to/your/local/app-check"
xcodebuild test \
-workspace FirebaseAppCheck/Apps/FIRAppCheckTestApp/FIRAppCheckTestApp.xcworkspace \
-scheme FIRAppCheckTestApp \
-destination 'platform=iOS Simulator,name=iPhone 16'Note: The Debug provider might require you to register the generated debug token in the Firebase Console for the tests to pass if they interact with live services.
FIRAppCheckTestAppTests: A hosted unit test target containing the test cases. It runs inside the app process to have access to the full app context.