stride3d/stride · error · InvalidOperationException

No [UITest] class found in

Error message

No [UITest] class found in '{testDllPath}'.

What it means

UITestHost.LoadTest loads a test DLL and scans its types for the UITestAttribute. If no type in the assembly carries [UITest], it throws InvalidOperationException naming the DLL path. This validates that the supplied test assembly actually contains a runnable UI test.

Solutions

  1. Point --test-dll at the assembly that contains your [UITest]-annotated class.
  2. Add [UITest] to the test class in the test project and rebuild.
  3. Rebuild/redeploy the test DLL so the deployed copy includes the annotated types.
  4. Verify with a quick scan that the attribute is present (e.g. grep for [UITest] in the test project).

Example fix

// before
// MyGameTests.cs has no attribute
public class MyGameTests : IUITest { ... }
// after
[UITest]
public class MyGameTests : IUITest { ... }
Defensive patterns

Strategy: validation

Validate before calling

var asm = Assembly.LoadFrom(testDllPath);
bool hasTest = asm.GetTypes().Any(t => t.GetCustomAttribute<UITestAttribute>() is not null);
if (!hasTest) throw new InvalidOperationException($"{testDllPath} contains no [UITest] class");

Try / catch

try { test = LoadTest(testDllPath, testName); }
catch (InvalidOperationException ex) { Console.Error.WriteLine(ex.Message); return 1; }

Prevention

When it happens

Trigger: Running the auto-testing host with --test-dll pointing at an assembly that has no class annotated with [UITest].

Common situations: Pointing the tool at the wrong DLL (e.g. a game or engine assembly instead of the UITest project); building the test project without the attribute; an outdated DLL deployed next to the host.

Related errors


AI-assisted analysis of stride3d/stride@96fad776d2 (2026-09-14). Data as JSON: /api/errors/e33b4aba6f678f9c. Report an issue: GitHub.

Appendix: source

Thrown at sources/editor/Stride.GameStudio.AutoTesting/UITestHost.cs:156

        foreach (var win in app.Windows.OfType<Window>())
        {
            if (!win.IsVisible || !win.IsLoaded) continue;
            if (win.ActualWidth < 100 || win.ActualHeight < 100) continue;
            if (!ReadyWindowTypeNames.Contains(win.GetType().Name)) continue;
            Log($"ready: '{win.GetType().Name}' Title='{win.Title}' Size={win.ActualWidth}x{win.ActualHeight}");
            return true;
        }
        return false;
    }

    private IUITest LoadTest()
    {
        var asm = Assembly.LoadFrom(testDllPath);
        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.");

View on GitHub (pinned to 96fad776d2)