Repository navigation
motus-v1.0.12
·
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 newtrx showCLI subcommand boots the visual runner against a parsed.trxinstead of a live discovery, with a configurable--port(default5300).TrxParserServicereads<TestDefinitions>/<UnitTest>to index each test by bothidandname, joins them with<Results>/<UnitTestResult>entries, and produces aTrxParseResult(tests, per-test states, run summary). Definitions contributeclassNameandcodeBase; results contribute outcome, duration, error info, and categories. A newViewerModeenum (Runner/Trace/Trx) is threaded throughRunnerOptionsandRunnerHostso the same Blazor app serves all three modes from one process.ITestSessionService.LoadFromTrxResultspopulates the session's discovered tests and states from the parse result.TestExecutionServicenow refuses to execute TRX-loaded tests (read-only) and reports a clear error rather than nulling out on missing reflection metadata.DiscoveredTestwas made nullable-friendly (Type? TestClass,MethodInfo? TestMethod, optionalCodeBaseandCategories) 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
TrxSummaryPanelrenders 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 existingTestConsolePanelso per-test results, output, and stack traces stay in the same place across modes.MainLayout,RunnerToolbar,TimelinePanel,TestMethodNode, andTestSuiteNodewere updated to hide irrelevant tabs and controls inViewerMode.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" -
TrxRerunServiceresolves a TRX-discovered test against its originalcodeBase: it asksTestDiscoveryto load the assembly and find the matchingMethodInfo, then replaces the TRX-loadedDiscoveredTestwith the reflected one (preserving the originalCodeBaseso the test stays rerunnable) and flipsViewerModetoRunnerso 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 aFailedstate 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 callsBackToResults()to flipViewerModeback toTrxand 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 fromExtractError) now pulls all four, andTestNodeStategained optionalStdOut/StdErrfields (defaulted tonullso the many existing positional constructions inTestExecutionService,TrxRerunService, andTestSessionServicekeep compiling untouched).TestConsolePanelrenders 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 withITestOutputHelper/Console.WriteLinecontent 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 CDPTracing.startacross parallel workers is acquired inStartAsyncand released inStopAsync. If a test calledStartAsyncand exited before reachingStopAsync(early return, untracked exception path, fixture teardown blow-up), the semaphore stayed at count0for the lifetime of the browser session, and every subsequentTracing.StartAsyncon that browser hung forever waiting on the gate. Two defenses now apply:StartAsyncwaits on the gate with a 2-minuteBrowserGateTimeoutand throws aTimeoutExceptionwith an actionable message ("wrap test bodies that call StartAsync in try/finally to ensure StopAsync runs") instead of blocking indefinitely; andBrowserContext.CloseAsyncinvokes a newTracing.ReleaseStateOnContextCloseduring 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 callsStartAsyncwithoutStopAsync, disposal-time cleanup releases the gate, and a secondTracingon the same browser session must complete itsStartAsyncwithin two seconds. - Sidebar splitter wasn't draggable in TRX viewer mode -
MainLayout.razorrenders asidebar-resize-handleelement withgrid-area: sidehandleand 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 columnresizeinstead ofsidehandle, 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 asidehandlearea. Renamed the TRX middle column tosidehandleto 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.razorgroups discovered tests byt.TestClass?.FullName ?? GetClassFromFullName(t.FullName). For live-discovered tests,TestClassis a realTypeand grouping uses the actualNamespace.ClassName. For TRX-loaded testsTestClassis null (no reflection), so the fallback walked back to the last dot in the test's display name. Parameterized test names likeBool_ValidValues ("False",False)contain no dot at all, soGetClassFromFullNamereturned 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.DiscoveredTestgained aClassFullName: string?field, the TRX parser now populates it from theclassNameattribute 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.