Logs
Overview
GPT Driver creates XCTest Attachments which can be directly viewed in XCode after a test run
GPT Driver also creates a Session URL which contains a log of each step executed via GPT Driver. This URL is hosted on the GPT Driver web platform.
How to retrieve the GPT Driver Session URL?
The GPTDriver session URL is made available through multiple channels:
OS Logs - Structured logging with
.noticelevel (maps to OSLogType.default)XCTest Attachments - Saved as
.weblocfile in test resultsPublic Property - Accessible programmatically via
driver.sessionURLCallback -
onSessionCreatedclosure for real-time access
Method 1: Extract from XCTest Attachments
The session URL is automatically saved as an XCTAttachment in your test results.
Location in Test Results
The attachment is saved with:
Name:
GPTDriver Session URL LinkLifetime:
.keepAlways(persists even after test completion)UserInfo: Contains
["link": "<session-url>"]File Format:
.webloc(macOS web location file in XML format)
Extracting from .xcresult Bundle
.xcresult BundleUsing Python Script
Using Swift Script
Method 2: Extract from OS Logs
The session URL is logged with .notice level using the unified logging system.
Log Format
The log entry follows this format:
Extracting from Log Files
Using log command (macOS)
Using os_log Export (CI)
If you're exporting logs in CI, you can parse them:
Method 3: Programmatic Access
Using the Public Property
Using the Callback
CI Integration Examples
GitHub Actions
Troubleshooting
Session URL Not Found
Check if session was created: Ensure
startSession()completed successfullyVerify attachment lifetime: The attachment uses
.keepAlways- check your test result bundle settingsCheck log level: Ensure
.noticelevel logs are captured in your CI environment
Parsing Issues
JSON format: The
xcresulttoolJSON output structure may vary - use recursive searchWebloc format: The
.weblocfile is XML format - use proper XML parsingEncoding: Ensure UTF-8 encoding when reading files
Performance
For large test suites, extracting attachments can be slow
Consider using the callback method (
onSessionCreated) for real-time accessCache session URLs if running multiple tests
Best Practices
Use the callback: Set
onSessionCreatedfor immediate accessSave to file: Write session URL to a file early in your test run
Include in test reports: Attach session URL to your test reporting tool
Set environment variable: Make session URL available to other CI steps
Archive results: Keep
.xcresultbundles for debugging
Last updated