-
Notifications
You must be signed in to change notification settings - Fork 12
Features Editor Tools Failed Tests Exporter
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.
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.
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
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.
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.
Each failure in the exported file includes:
TEST_FAILURE_1
Name: MyNamespace.MyTestClass.MyTestMethod
Message: Expected 42 but was 0
Stack Trace:
at MyNamespace.MyTestClass.MyTestMethod() in /path/to/file.cs:line 25
---
TEST_FAILURE_2
Name: MyNamespace.MyOtherClass.AnotherTest
Message: Object reference not set
Stack Trace:
(no stack trace)
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.
| 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 |
| Field | Type | Description |
|---|---|---|
name |
string |
Fully qualified test name |
message |
string |
Failure message (or empty string) |
stackTrace |
string |
Stack trace (or empty string) |
- Editor Tools Guide — Complete reference for all Unity Helpers editor tools
- Inspector Settings — Configuring Unity Helpers project settings
📦 Unity Helpers | 📖 Documentation | 🐛 Issues | 📜 MIT License
- Inspector Button
- Inspector Conditional Display
- Inspector Grouping Attributes
- Inspector Inline Editor
- Inspector Overview
- Inspector Selection Attributes
- Inspector Settings
- Inspector Validation Attributes
- Utility Components
- Visual Components
- Data Structures
- Helper Utilities
- Math And Extensions
- Pooling Guide
- Random Generators
- Reflection Helpers
- Singletons