stride3d/stride · error · InvalidOperationException
Multiple [UITest] classes in
Error message
Multiple [UITest] classes in '{testDllPath}'; pass --test-name to select. Available: {string.Join(", ", candidates.Select(t => t.FullName))} What it means
When no --test-name is supplied, LoadTest auto-selects the single [UITest] class in the DLL. If the DLL contains multiple annotated classes, it throws InvalidOperationException telling the user to pass --test-name and listing the available classes. Ambiguity must be resolved explicitly.
Solutions
- Add --test-name <ClassName> to the launch command specifying which test to run.
- Split tests into separate DLLs if you want each to be auto-selected.
- Remove or mark obsolete the tests you no longer intend to run.
- Update the CI/launch script to select the test explicitly.
Example fix
// before Stride.GameStudio.AutoTesting.exe --test-dll MyTests.dll // after Stride.GameStudio.AutoTesting.exe --test-dll MyTests.dll --test-name SmokeTest
Defensive patterns
Strategy: validation
Validate before calling
var count = asm.GetTypes().Count(t => t.GetCustomAttribute<UITestAttribute>() is not null);
if (count > 1 && testName is null)
throw new InvalidOperationException("Multiple [UITest] classes: --test-name is required"); Try / catch
try { test = LoadTest(dll, testName); }
catch (InvalidOperationException) { testName = PromptForTestName(); test = LoadTest(dll, testName); } Prevention
- Always pass --test-name once a project has 2+ tests
- Keep one test class per DLL for auto-selection
- Prune obsolete test classes
When it happens
Trigger: Running the host with a test DLL containing two or more [UITest] classes and omitting --test-name.
Common situations: Accumulating several UI test classes in one test project over time while the launch command still predates the second test; CI jobs that only ever ran one test.
Understand the failure class
Background: "no subcommand specified" and "... is required": CLI errors when a required argument is missing — this error's family across 13 libraries.
Related errors
- No [UITest] class named
- No [UITest] class found in
- [UITest] class must implement IUITest.
- Stride.Games.AutoTesting
- failed
AI-assisted analysis of stride3d/stride@96fad776d2 (2026-09-14).
Data as JSON: /api/errors/4d45f8fd08496507.
Report an issue: GitHub.
Appendix: source
Thrown at sources/editor/Stride.GameStudio.AutoTesting/UITestHost.cs:170
var candidates = asm.GetTypes()
.Where(t => t.GetCustomAttribute<UITestAttribute>() is not null)
.ToList();
if (candidates.Count == 0)
throw new InvalidOperationException($"No [UITest] class found in '{testDllPath}'.");
Type chosen;
if (testClassName is not null)
{
chosen = candidates.FirstOrDefault(t => t.Name == testClassName || t.FullName == testClassName)
?? throw new InvalidOperationException($"No [UITest] class named '{testClassName}' in '{testDllPath}'. Available: {string.Join(", ", candidates.Select(t => t.FullName))}");
}
else if (candidates.Count == 1)
{
chosen = candidates[0];
}
else
{
throw new InvalidOperationException($"Multiple [UITest] classes in '{testDllPath}'; pass --test-name to select. Available: {string.Join(", ", candidates.Select(t => t.FullName))}");
}
if (!typeof(IUITest).IsAssignableFrom(chosen))
throw new InvalidOperationException($"[UITest] class {chosen.FullName} must implement IUITest.");
return (IUITest)Activator.CreateInstance(chosen)!;
}
private void RunTest(IUITest test, Context ctx)
{
Task.Run(async () =>
{
var status = "ok";
object? exceptionInfo = null;
try
{
await test.Run(ctx);
}View on GitHub (pinned to 96fad776d2)