Files
Terminal.Gui/Tests/UnitTestsParallelizable/ParallelizableBase.cs
Copilot 041e9de70e Migrate 210 tests to UnitTests.Parallelizable, add CreateFakeDriver helper, prove View.Draw() works in parallel tests, and provide comprehensive performance analysis (#4297)
* Initial plan

* Migrate Category A test files to UnitTests.Parallelizable (135 tests)

Co-authored-by: tig <585482+tig@users.noreply.github.com>

* Add 11 ButtonTests to Parallelizable, remove from UnitTests

Co-authored-by: tig <585482+tig@users.noreply.github.com>

* Add comprehensive test migration report

Co-authored-by: tig <585482+tig@users.noreply.github.com>

* Add comprehensive performance analysis of UnitTests

Co-authored-by: tig <585482+tig@users.noreply.github.com>

* Migrate 2 Autocomplete tests and add Text tests analysis

Co-authored-by: tig <585482+tig@users.noreply.github.com>

* Add proof-of-concept: TextFormatter.Draw works in parallel tests with local driver

Co-authored-by: tig <585482+tig@users.noreply.github.com>

* Add CreateFakeDriver helper to ParallelizableBase and migrate 4 TextFormatterTests

Co-authored-by: tig <585482+tig@users.noreply.github.com>

* Remove proof-of-concept test from AutocompleteTests

Co-authored-by: tig <585482+tig@users.noreply.github.com>

* Move Scheme-accessing tests back to UnitTests to fix intermittent failures

Co-authored-by: tig <585482+tig@users.noreply.github.com>

* Update parallel tests README to document ConfigurationManager/SchemeManager restrictions

Co-authored-by: tig <585482+tig@users.noreply.github.com>

* Document static member restriction in parallel tests README

Co-authored-by: tig <585482+tig@users.noreply.github.com>

* Restore accidentally deleted ButtonTests.Accept_Cancel_Event_OnAccept_Returns_True test

Co-authored-by: tig <585482+tig@users.noreply.github.com>

* Migrate Accept_Cancel_Event_OnAccept_Returns_True test to Parallelizable

Co-authored-by: tig <585482+tig@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: tig <585482+tig@users.noreply.github.com>
2025-10-20 08:56:11 -06:00

31 lines
1.2 KiB
C#

using TerminalGuiFluentTesting;
namespace UnitTests.Parallelizable;
/// <summary>
/// Base class for parallelizable tests. Ensures that tests can run in parallel without interference
/// by setting various Terminal.Gui static properties to their default values. E.g. View.EnableDebugIDisposableAsserts.
/// </summary>
[Collection ("Global Test Setup")]
public abstract class ParallelizableBase
{
// Common setup or utilities for all tests can go here
/// <summary>
/// Creates a new FakeDriver instance with the specified buffer size.
/// This is a convenience method for tests that need to use Draw() and DriverAssert
/// without relying on Application.Driver.
/// </summary>
/// <param name="width">Width of the driver buffer</param>
/// <param name="height">Height of the driver buffer</param>
/// <returns>A configured IFakeConsoleDriver instance</returns>
protected static IFakeConsoleDriver CreateFakeDriver (int width = 25, int height = 25)
{
var factory = new FakeDriverFactory ();
IFakeConsoleDriver driver = factory.Create ();
driver.SetBufferSize (width, height);
return driver;
}
}