MIGRATION_STATUS.md 6.1 KB

Test Migration to UnitTests.Parallelizable - Status Report

Executive Summary

Current Status (Commit d4fd965):

  • 119 tests successfully migrated to UnitTests.Parallelizable
  • 9,476 tests passing in Parallelizable (up from 9,357 baseline)
  • Migration rate: 8.2% of original 1,446 tests in UnitTests
  • check-duplicates workflow: ✅ Passing
  • All tests: ✅ Passing

Migration Breakdown

Successfully Migrated (119 tests)

Pure Unit Tests (26 tests - No driver needed)

  1. StackExtensionsTests.cs - 10 tests for Stack extensions
  2. TabTests.cs - 1 constructor test
  3. AnsiMouseParserTests.cs - 14 ANSI mouse parsing tests
  4. Dim.FillTests.cs - 1 test (merged with existing)
  5. Refactored Tests (93 tests - Using local FakeDriver)

    TextFormatterTests.cs - 10 Draw methods refactored:

    1. Draw_Horizontal_Centered - 11 test cases
    2. Draw_Horizontal_Justified - 11 test cases
    3. Draw_Horizontal_Left - 9 test cases
    4. Draw_Horizontal_Right - 8 test cases
    5. Draw_Horizontal_RightLeft_BottomTop - 11 test cases
    6. Draw_Horizontal_RightLeft_TopBottom - 11 test cases
    7. Draw_Vertical_BottomTop_LeftRight - 11 test cases
    8. Draw_Vertical_BottomTop_RightLeft - 11 test cases
    9. Draw_Vertical_TopBottom_LeftRight - 3 test cases
    10. Draw_Vertical_TopBottom_LeftRight_Top - 8 test cases

    Refactoring Pattern Used:

    public void TestMethod (params)
    {
        // Create local driver instance
        var factory = new FakeDriverFactory ();
        var driver = factory.Create ();
        driver.SetBufferSize (width, height);
        
        // Pass driver explicitly to methods
        textFormatter.Draw (rect, attr1, attr2, driver: driver);
        
        // Extract and assert results
        string actual = GetDriverContents (driver, width, height);
        Assert.Equal (expected, actual);
    }
    

    Remaining Work

    TextFormatterTests.cs (8 tests remaining)

    Status Analysis:

    1. Draw_Vertical_TopBottom_LeftRight_Middle

      • Can migrate: Yes, with helper enhancement
      • Complexity: Returns Rectangle, validates Y position
      • Action needed: Enhance helper to return position info
    2. Draw_Vertical_Bottom_Horizontal_Right

      • Can migrate: Yes, with helper enhancement
      • Complexity: Returns Rectangle, validates Y position
      • Action needed: Same as above
    3. Draw_Text_Justification

      • Can migrate: Yes
      • Complexity: Multi-parameter test
      • Action needed: Standard refactoring pattern
    4. Justify_Horizontal

      • Can migrate: Yes
      • Complexity: Standard Draw test
      • Action needed: Standard refactoring pattern
    5. FillRemaining_True_False

      • Can migrate: Need investigation
      • Complexity: May modify state beyond driver
      • Action needed: Review implementation
    6. UICatalog_AboutBox_Text

      • Can migrate: Need investigation
      • Complexity: May load external resources
      • Action needed: Review dependencies
    7. FormatAndGetSize_Returns_Correct_Size

      • Can migrate: Need investigation
      • Complexity: May require specific driver capabilities
      • Action needed: Review method signature
    8. FormatAndGetSize_WordWrap_False_Returns_Correct_Size

      • Can migrate: Need investigation
      • Complexity: May require specific driver capabilities
      • Action needed: Review method signature

    Other Files with SetupFakeDriver (34 files)

    Files requiring systematic review:

    1. CursorTests.cs
    2. FakeDriverTests.cs
    3. LineCanvasTests.cs
    4. RulerTests.cs
    5. AdornmentTests.cs
    6. BorderTests.cs
    7. MarginTests.cs
    8. PaddingTests.cs
    9. ShadowStyleTests.cs
    10. AllViewsDrawTests.cs
    11. ClearViewportTests.cs
    12. ClipTests.cs
    13. DrawTests.cs
    14. TransparentTests.cs
    15. LayoutTests.cs
    16. Pos.CombineTests.cs
    17. NavigationTests.cs
    18. TextTests.cs
    19. AllViewsTests.cs
    20. ButtonTests.cs
    21. CheckBoxTests.cs
    22. ColorPickerTests.cs
    23. DateFieldTests.cs
    24. LabelTests.cs
    25. RadioGroupTests.cs
    26. ScrollBarTests.cs
    27. ScrollSliderTests.cs
    28. TabViewTests.cs
    29. TableViewTests.cs
    30. TextFieldTests.cs
    31. ToplevelTests.cs
    32. TreeTableSourceTests.cs
    33. TreeViewTests.cs
    34. SetupFakeDriverAttribute.cs (infrastructure)

    For each file, need to determine:

    • Which tests use methods that accept driver parameters → Migratable
    • Which tests require View hierarchy/Application context → Likely non-migratable
    • Which tests modify global state → Non-migratable

    Non-Migratable Tests (TBD - Requires detailed analysis)

    Common reasons tests CANNOT be migrated:

    1. Requires Application.Init() - Tests that need event loop, application context
    2. Tests View hierarchy - Tests that rely on View parent/child relationships requiring Application
    3. Modifies ConfigurationManager - Tests that change global configuration state
    4. Requires specific driver features - Tests that depend on platform-specific driver behavior
    5. Integration tests - Tests validating multiple components together with Application context

    Recommendations

    1. Complete TextFormatterTests migration - 4-6 tests clearly migratable
    2. Systematic file-by-file review - Categorize each of the 34 remaining files
    3. Document non-migratable - For each test that cannot be migrated, document specific reason
    4. Consider test refactoring - Some integration tests could be split into unit + integration parts
    5. Update guidelines - Document patterns for writing parallelizable tests

    Technical Notes

    Why Some Tests Must Remain in UnitTests

    Many tests in UnitTests are correctly placed integration tests that should NOT be parallelized:

    • They test View behavior within Application context
    • They validate event handling through Application.MainLoop
    • They test ConfigurationManager integration
    • They verify driver-specific platform behavior
    • They test complex component interactions

    These are valuable integration tests and should remain in UnitTests.

    Pattern for Future Test Development

    New tests should default to UnitTests.Parallelizable unless they:

    1. Require Application.Init()
    2. Test View hierarchy interactions
    3. Modify global state (ConfigurationManager, Application properties)
    4. Are explicitly integration tests