Skip to content

iOS test console logs

Appelium can attach test-run logs to each recorded UI test. These logs are different from logs generated by the application under test: they describe the test itself, the environment and why an XCUITest flow expected a certain result.

Use a short log before a meaningful action and another when the flow enters an expected or unexpected state. The final report becomes a readable timeline instead of a list of unrelated assertion messages.

Initialize the test SDK

Start Appelium in the UI-test runner before calls that should be recorded:

override func setUpWithError() throws {
    AppeliumTests.start(apiKey: "YOUR_TEST_API_KEY")
}

Calls made before the test SDK starts are ignored.

Log levels and domains

AppeliumTests.logVerbose("Waiting for account state")
AppeliumTests.logDebug("Test user seeded", domain: "Fixtures")
AppeliumTests.logInfo("Opening checkout", domain: "Checkout")
AppeliumTests.logWarning("Retrying navigation after timeout", domain: "Navigation")
AppeliumTests.logError("Place order button remained disabled", domain: "Checkout")
Method Use it for
logVerbose Detailed timing and polling information
logDebug Fixture values, branches and test-precondition state
logInfo Major test steps and successful milestones
logWarning A recoverable retry or unusual condition
logError Failure context. XCTest assertion output is also captured by the SDK.

Every method accepts an optional domain. Keep domains stable (Fixture, Login, Checkout) rather than encoding a random test ID into every log.

log(_:) is a convenience alias for logDebug(_:):

AppeliumTests.log("Opening the registration form")

Retention and test boundaries

The test logger retains at most 60 seconds of current-run activity. It is reset between tests, so the report contains the events associated with that test rather than the entire class or worker process. Long gaps at the beginning of a test are therefore not guaranteed to appear at the time of failure.

For long test phases, log the relevant transition immediately before the slow operation and log its result afterward.

Capture useful, non-sensitive context

Good:

AppeliumTests.logInfo(
    "Submitted registration with valid fixture",
    domain: "Registration"
)
AppeliumTests.logError(
    "Expected confirmation navigation did not occur",
    domain: "Registration"
)