Skip to content

motus-v1.0.12

Choose a tag to compare

@github-actions github-actions released this 26 May 23:36
· 71 commits to main since this release

A TRX viewer has been added: point the CLI at any .trx file and the visual runner opens with the assembly/class/method tree, per-test outcomes and durations, captured stdout/stderr, and one-click rerun back into the live runner. A defensive fix to the browser-wide tracing gate prevents a leaked Tracing.StartAsync from deadlocking every subsequent trace on the same browser.

Improvements

  • TRX viewer with motus trx show <file.trx> - A new trx show CLI subcommand boots the visual runner against a parsed .trx instead of a live discovery, with a configurable --port (default 5300). TrxParserService reads <TestDefinitions>/<UnitTest> to index each test by both id and name, joins them with <Results>/<UnitTestResult> entries, and produces a TrxParseResult (tests, per-test states, run summary). Definitions contribute className and codeBase; results contribute outcome, duration, error info, and categories. A new ViewerMode enum (Runner / Trace / Trx) is threaded through RunnerOptions and RunnerHost so the same Blazor app serves all three modes from one process. ITestSessionService.LoadFromTrxResults populates the session's discovered tests and states from the parse result. TestExecutionService now refuses to execute TRX-loaded tests (read-only) and reports a clear error rather than nulling out on missing reflection metadata. DiscoveredTest was made nullable-friendly (Type? TestClass, MethodInfo? TestMethod, optional CodeBase and Categories) so TRX rows that have no live reflection can still flow through the same model.
  • TRX summary panel, sidebar tree, and viewer-aware layout - A new TrxSummaryPanel renders the run-level outcome counts and duration as the default landing view when no test is selected; selecting a test in the tree switches to the existing TestConsolePanel so per-test results, output, and stack traces stay in the same place across modes. MainLayout, RunnerToolbar, TimelinePanel, TestMethodNode, and TestSuiteNode were updated to hide irrelevant tabs and controls in ViewerMode.Trx (Browser View, Visual Regression, and the bottom timeline panel disappear; the toolbar shows TRX-specific stats). Tree nodes in TRX mode are non-runnable by default and clicking them selects the result for inspection.
  • One-click rerun back into the live runner with "Back to Results" - TrxRerunService resolves a TRX-discovered test against its original codeBase: it asks TestDiscovery to load the assembly and find the matching MethodInfo, then replaces the TRX-loaded DiscoveredTest with the reflected one (preserving the original CodeBase so the test stays rerunnable) and flips ViewerMode to Runner so the user lands in the live runner with the test executing. Failure paths are surfaced as test states rather than thrown exceptions: a missing or unbuilt assembly produces a Failed state with "Assembly not found at <path>. Build the project and try again."; an assembly load exception reports the message and stack trace; a renamed/removed method produces "Test method <name> not found in assembly. It may have been renamed or removed." A new toolbar "Back to Results" button calls BackToResults() to flip ViewerMode back to Trx and restore the TRX view without re-parsing. Unit tests cover the missing-assembly, missing-method, successful-rerun, and back-to-results paths.
  • Captured stdout and stderr surfaced per test - The TRX parser was reading only <Output>/<ErrorInfo> and discarding <StdOut> and <StdErr>. ExtractOutput (renamed from ExtractError) now pulls all four, and TestNodeState gained optional StdOut/StdErr fields (defaulted to null so the many existing positional constructions in TestExecutionService, TrxRerunService, and TestSessionService keep compiling untouched). TestConsolePanel renders new "Test Output" and "Test Error Output" sections styled to match the existing error/stack-trace blocks (scrollable, monospace, distinct background and accent for stderr); the "Test passed with no errors" success message is now suppressed when captured output is present, so a passing test with ITestOutputHelper/Console.WriteLine content shows the output rather than the cheerful fallback.

Bug Fixes

  • Leaked Tracing.StartAsync deadlocked every subsequent trace on the browser - The browser-wide ConditionalWeakTable<IMotusSession, SemaphoreSlim> that serializes CDP Tracing.start across parallel workers is acquired in StartAsync and released in StopAsync. If a test called StartAsync and exited before reaching StopAsync (early return, untracked exception path, fixture teardown blow-up), the semaphore stayed at count 0 for the lifetime of the browser session, and every subsequent Tracing.StartAsync on that browser hung forever waiting on the gate. Two defenses now apply: StartAsync waits on the gate with a 2-minute BrowserGateTimeout and throws a TimeoutException with an actionable message ("wrap test bodies that call StartAsync in try/finally to ensure StopAsync runs") instead of blocking indefinitely; and BrowserContext.CloseAsync invokes a new Tracing.ReleaseStateOnContextClose during disposal, which cancels the pump, completes the data channel, resets the started flag, and releases the gate as a best-effort idempotent cleanup. A regression test models the failure: a leaker calls StartAsync without StopAsync, disposal-time cleanup releases the gate, and a second Tracing on the same browser session must complete its StartAsync within two seconds.
  • Sidebar splitter wasn't draggable in TRX viewer mode - MainLayout.razor renders a sidebar-resize-handle element with grid-area: sidehandle and a pointer-event handler that resizes the sidebar column on drag. The TRX shell-style override declared its grid areas as 'toolbar toolbar toolbar' 'sidebar resize main', naming the middle column resize instead of sidehandle, so the handle's declared grid area did not match any declared area in TRX mode and the element wasn't placed where the user expected. The same handle worked in the Trace and Runner modes because the base CSS does declare a sidehandle area. Renamed the TRX middle column to sidehandle to match, restoring drag-to-resize behavior between the test tree and the main pane.
  • Parameterized TRX tests rendered every theory row as its own class node with a duplicated label - TestSuiteNode.razor groups discovered tests by t.TestClass?.FullName ?? GetClassFromFullName(t.FullName). For live-discovered tests, TestClass is a real Type and grouping uses the actual Namespace.ClassName. For TRX-loaded tests TestClass is null (no reflection), so the fallback walked back to the last dot in the test's display name. Parameterized test names like Bool_ValidValues ("False",False) contain no dot at all, so GetClassFromFullName returned the whole string and each theory row became a one-test "class" with the same label as its single method node — the tree showed the same name twice with one extra indent. DiscoveredTest gained a ClassFullName: string? field, the TRX parser now populates it from the className attribute it already reads from <TestMethod>, and the grouping key prefers it over the dot-split fallback. Theory rows now sit under their real class node and the duplicated parent label is gone.