-
Notifications
You must be signed in to change notification settings - Fork 0
Test Report
TestReport automatically captures rich diagnostic data during test sessions. On test failure, it packages screenshots, video recordings, hierarchy snapshots, console logs, and action timelines into a .zip archive for debugging.
When a test runs via UIAutomationTestFixture:
-
Session starts in
SetUp()— begins video recording, hooks console output - During the test — captures hierarchy snapshots and screenshots at action start/failure events
-
Session ends in
TearDown()— stops recording, packages everything into a.zip -
On failure — the zip is retained; on pass it is deleted (unless
UploadPassesis enabled)
| Data | Description |
|---|---|
recording.mp4 |
Full video of the test at 15 FPS, 1280x720 |
video_timestamps.csv |
Per-frame session timestamps for video sync (see below) |
screenshot_*.png |
Screenshots at action start and failure points |
hierarchy_*.json |
Full scene hierarchy with screen-space bounds |
session.json |
Structured timeline: events, logs, metadata |
log.txt |
Plain text Unity console output |
persistent_data/ |
Application.persistentDataPath contents (on failure, optional) |
The session.json file contains:
- events — Action timeline with type, message, timestamp, hierarchy/screenshot references, caller source location
- logs — All Unity console output (Debug.Log, warnings, errors, exceptions) plus action events with custom log types
- metadata — Git branch/commit, app version, platform, machine name, screen resolution
- videoDuration — Duration of the recorded video
- videoStartOffset — Seconds between session start and recording start (for video-to-log sync)
- videoTimestampsFile — Filename of the frame timestamp CSV sidecar
Console entries use extended log types beyond Unity's built-in set:
| Value | Type | Description |
|---|---|---|
| 0 | Error | Debug.LogError |
| 1 | Assert | Debug.LogAssertion |
| 2 | Warning | Debug.LogWarning |
| 3 | Log | Debug.Log |
| 4 | Exception | Debug.LogException |
| 5 | Screenshot | Screenshot capture event |
| 6 | Snapshot | Hierarchy snapshot event |
| 7 | ActionStart | Test action started |
| 8 | ActionSuccess | Test action completed successfully |
| 9 | ActionWarn | Test action warning |
| 10 | ActionFailure | Test action failed |
Hierarchy snapshots capture every GameObject in the scene with:
- Name, active state, path, instance ID
- Screen-space bounds (x, y, w, h) for UI elements
- World-space AABB bounds for 3D objects with Renderers (projected client-side using the VP matrix)
- Depth ordering (camera distance for 3D, canvas sort order for UI)
- Camera view-projection matrix for client-side 3D→screen coordinate conversion
- Component annotations (Button, Toggle, Slider, Text, Image, etc.)
- Child count and nested children structure
Detailed snapshots (via Snapshot()) additionally capture component property values: text content, colors, font sizes, interactable states, layout settings, and more.
Capture a detailed hierarchy snapshot at any point during a test:
await Snapshot(); // Full depth
await Snapshot(maxDepth: 3); // Limited depthWhen enabled (default: on), Application.persistentDataPath contents are included in the diagnostic zip on test failure. This captures save files, player prefs, logs, etc.
- Max depth: 3 directory levels
- Max size: 50 MB total
- Configure via Edit > Project Settings > UI Automation > Capture Persistent Data on Failure
- Or programmatically:
TestReport.CapturePersistentData = false;
Sessions are stored as zip archives in Application.temporaryCachePath/UIAutomation_Diagnostics/.
// Get all diagnostic session zip paths
var sessions = TestReport.GetDiagnosticsFolders();Add project-specific metadata to diagnostic sessions:
TestReport.MetadataCallback = () => new Dictionary<string, string>
{
{ "buildNumber", "123" },
{ "environment", "staging" }
};TestReport automatically detects Git or Plastic SCM branch and commit:
// Disable auto-detection if needed
TestReport.AutoDetectVCS = false;Video recordings may not start at exactly session time zero and can drift due to encoder stalls. To enable accurate video-to-log synchronization, each session includes:
videoStartOffset — The offset (in seconds) between when the test session started and when the recorder began capturing frames. The web viewer uses this to map between session timestamps and video playback position:
videoTime = sessionTime - videoStartOffset
sessionTime = videoTime + videoStartOffset
video_timestamps.csv — A per-game-frame sidecar file that records the session-relative wall-clock time for every frame rendered while the recorder was active. Format: frameIndex,sessionTime (no header, times in seconds). This allows detection of encoder stalls or dropped frames where video time diverges from session time.
- Server Integration — Auto-upload sessions to a server
- UIAutomationTestFixture — Base test class
- Test Actions — Actions that generate diagnostic events
Basic Filters
Proximity
Hierarchy
Spatial
Ordering
Modifiers
Combining
Reflection
- Click Actions
- Text Input
- Drag Actions
- Gesture Input
- Wait and Find
- Assertions
- GameObject Manipulation