Overview
The file src/Platform/Microsoft.Testing.Platform/Messages/TestNodeProperties.cs has grown to 1295 lines, making it harder to navigate and maintain. This task involves refactoring it into smaller, more focused files.
Current State
- File:
src/Platform/Microsoft.Testing.Platform/Messages/TestNodeProperties.cs
- Size: 1295 lines
- Language: C#
Structural Analysis
The file defines many independent types all sharing the same namespace Microsoft.Testing.Platform.Extensions.Messages. They fall into distinct logical groups:
| Group |
Types |
| Base interface |
IProperty |
| State properties |
TestNodeStateProperty (abstract base), DiscoveredTestNodeStateProperty, InProgressTestNodeStateProperty, PassedTestNodeStateProperty, SkippedTestNodeStateProperty, FailedTestNodeStateProperty, ErrorTestNodeStateProperty, TimeoutTestNodeStateProperty, CancelledTestNodeStateProperty |
| Timing properties |
TimingInfo, StepTimingInfo, TimingProperty |
| Location properties |
LinePosition, LinePositionSpan, FileLocationProperty (abstract), TestFileLocationProperty |
| Identity/metadata |
TestMethodIdentifierProperty, TestMetadataProperty |
| Output/artifact |
StandardOutputProperty, StandardErrorProperty, FileArtifactProperty |
| Internal |
SerializableKeyValuePairStringProperty |
Refactoring Strategy
Proposed File Splits
Based on the file's structure, split it into the following focused files inside src/Platform/Microsoft.Testing.Platform/Messages/:
-
IProperty.cs
- Contents:
IProperty interface
- Responsibility: Base contract for all test node properties
-
TestNodeStateProperties.cs
- Contents:
TestNodeStateProperty, DiscoveredTestNodeStateProperty, InProgressTestNodeStateProperty, PassedTestNodeStateProperty, SkippedTestNodeStateProperty, FailedTestNodeStateProperty, ErrorTestNodeStateProperty, TimeoutTestNodeStateProperty, CancelledTestNodeStateProperty
- Responsibility: All test execution state properties (pass/fail/skip/timeout/etc.)
-
TimingProperties.cs
- Contents:
TimingInfo, StepTimingInfo, TimingProperty
- Responsibility: Elapsed-time and per-step timing data attached to test nodes
-
FileLocationProperties.cs
- Contents:
LinePosition, LinePositionSpan, FileLocationProperty, TestFileLocationProperty
- Responsibility: Source file location metadata for test nodes
-
TestMethodIdentifierProperty.cs
- Contents:
TestMethodIdentifierProperty
- Responsibility: Strongly-typed identity of the test method (assembly, namespace, type, method, parameters)
-
TestMetadataProperty.cs
- Contents:
TestMetadataProperty
- Responsibility: Arbitrary key/value metadata attached to a test node
-
OutputProperties.cs
- Contents:
StandardOutputProperty, StandardErrorProperty
- Responsibility: Captured stdout/stderr output produced during a test run
-
FileArtifactProperty.cs
- Contents:
FileArtifactProperty
- Responsibility: File artifacts (attachments) produced by a test
-
SerializableKeyValuePairStringProperty.cs (internal)
- Contents:
SerializableKeyValuePairStringProperty
- Responsibility: Internal serialization helper property
Implementation Guidelines
- Preserve Behavior: All existing functionality must work identically after the split
- Maintain Public API: Keep all public symbols in the same namespace (
Microsoft.Testing.Platform.Extensions.Messages) — no namespace changes needed
- PublicAPI.Unshipped.txt: No changes needed as this is pure restructuring of existing public API
- Test After Each Split: Run the test suite (
./build.sh) after each incremental file move
- One File at a Time: Split one logical group at a time to make review easier
- Check
PublicAPI.Shipped.txt: Confirm the API surface is unchanged — no entries should be added or removed
Acceptance Criteria
Priority: Medium
Effort: Small (purely mechanical file splits — no logic changes required)
Expected Impact: Improved code navigability, easier per-type Git history, reduced merge conflicts on this file
Generated by Daily File Diet · ● 234.4K · ◷
Overview
The file
src/Platform/Microsoft.Testing.Platform/Messages/TestNodeProperties.cshas grown to 1295 lines, making it harder to navigate and maintain. This task involves refactoring it into smaller, more focused files.Current State
src/Platform/Microsoft.Testing.Platform/Messages/TestNodeProperties.csStructural Analysis
The file defines many independent types all sharing the same namespace
Microsoft.Testing.Platform.Extensions.Messages. They fall into distinct logical groups:IPropertyTestNodeStateProperty(abstract base),DiscoveredTestNodeStateProperty,InProgressTestNodeStateProperty,PassedTestNodeStateProperty,SkippedTestNodeStateProperty,FailedTestNodeStateProperty,ErrorTestNodeStateProperty,TimeoutTestNodeStateProperty,CancelledTestNodeStatePropertyTimingInfo,StepTimingInfo,TimingPropertyLinePosition,LinePositionSpan,FileLocationProperty(abstract),TestFileLocationPropertyTestMethodIdentifierProperty,TestMetadataPropertyStandardOutputProperty,StandardErrorProperty,FileArtifactPropertySerializableKeyValuePairStringPropertyRefactoring Strategy
Proposed File Splits
Based on the file's structure, split it into the following focused files inside
src/Platform/Microsoft.Testing.Platform/Messages/:IProperty.csIPropertyinterfaceTestNodeStateProperties.csTestNodeStateProperty,DiscoveredTestNodeStateProperty,InProgressTestNodeStateProperty,PassedTestNodeStateProperty,SkippedTestNodeStateProperty,FailedTestNodeStateProperty,ErrorTestNodeStateProperty,TimeoutTestNodeStateProperty,CancelledTestNodeStatePropertyTimingProperties.csTimingInfo,StepTimingInfo,TimingPropertyFileLocationProperties.csLinePosition,LinePositionSpan,FileLocationProperty,TestFileLocationPropertyTestMethodIdentifierProperty.csTestMethodIdentifierPropertyTestMetadataProperty.csTestMetadataPropertyOutputProperties.csStandardOutputProperty,StandardErrorPropertyFileArtifactProperty.csFileArtifactPropertySerializableKeyValuePairStringProperty.cs(internal)SerializableKeyValuePairStringPropertyImplementation Guidelines
Microsoft.Testing.Platform.Extensions.Messages) — no namespace changes needed./build.sh) after each incremental file movePublicAPI.Shipped.txt: Confirm the API surface is unchanged — no entries should be added or removedAcceptance Criteria
TestNodeProperties.csis replaced by the focused files listed abovePublicAPI.Shipped.txt/PublicAPI.Unshipped.txtare unchangedPriority: Medium
Effort: Small (purely mechanical file splits — no logic changes required)
Expected Impact: Improved code navigability, easier per-type Git history, reduced merge conflicts on this file