Failed Tests Exporter¶
Overview¶
The Failed Tests Exporter is an editor utility that hooks into the Unity Test Runner API to automatically capture failed test results. When a test run completes, it records each failure's name, message, and stack trace, and can export them to a timestamped text file in a configurable directory (defaults to the project root).
This is especially useful for CI/CD pipelines where you need a machine-readable artifact of test failures, or for tracking intermittent test failures across multiple runs.
Setup¶
The Failed Tests Exporter is disabled by default. To enable it:
- Open Project Settings (
Edit > Project Settings) - Navigate to Wallstop Studios > Unity Helpers
- Expand the Failed Tests Exporter section
- Check Enable Failed Tests Exporter
The exporter activates immediately when the setting is toggled. No domain reload is required.
Output Directory¶
By default, failed test result files are written to the project root. You can configure a different output directory:
- In the Failed Tests Exporter settings section, find the Output Directory row
- Click Browse… to open a folder picker dialog
- Select any folder within your project — the path is stored as a relative path from the project root
- Click the × button to clear the setting and revert to the project root
The output directory field is read-only to prevent typos — use the Browse… button to select a folder visually.
Path Validation
The output directory is validated on every use:
- If the configured directory no longer exists (e.g., it was renamed or deleted), the exporter automatically falls back to the project root
- Absolute paths, paths containing
.., and paths outside the project root are rejected- Invalid paths are automatically corrected when settings are loaded
Usage¶
Automatic Export¶
When enabled, the exporter automatically:
- Clears previous failures when a new test run starts
- Records each individual test failure (name, message, stack trace)
- Exports all failures to a timestamped file when the test run completes
The output file is written to the configured output directory (or the project root if none is set) with the format failed-tests-YYYY-MM-DD-HHmmss.txt.
Manual Export¶
You can manually export or clear captured failures using the menu items:
- Tools > Wallstop Studios > Unity Helpers > Export Failed Tests — Writes captured failures to a text file
- Tools > Wallstop Studios > Unity Helpers > Clear Failed Tests — Clears the in-memory failure list
Both menu items are only enabled when there are captured failures.
Output Format¶
Each failure in the exported file includes:
| Text Only | |
|---|---|
API Reference¶
Note: The
FailedTestsExporterclass and its nestedFailedTestInfostruct areinternaland primarily intended for use within the Unity Helpers assembly. External consumers interact with this feature through the menu items and the settings UI described above.
FailedTestsExporter¶
| Member | Type | Description |
|---|---|---|
Instance | FailedTestsExporter | Static reference to the active exporter instance (null when disabled) |
Failures | IReadOnlyList<FailedTestInfo> | Read-only list of captured test failures |
IsEnabled() | bool | Whether the exporter is enabled in Unity Helpers settings |
FailedTestInfo¶
| Field | Type | Description |
|---|---|---|
name | string | Fully qualified test name |
message | string | Failure message (or empty string) |
stackTrace | string | Stack trace (or empty string) |
See Also¶
- Editor Tools Guide — Complete reference for all Unity Helpers editor tools
- Inspector Settings — Configuring Unity Helpers project settings