Skip to content

Conversation

Youssef1313
Copy link
Member

Closes #5693

Related to #1285

@Youssef1313 Youssef1313 linked an issue Jun 23, 2025 that may be closed by this pull request
@codecov-commenter
Copy link

codecov-commenter commented Jun 23, 2025

Codecov Report

Attention: Patch coverage is 15.78947% with 16 lines in your changes missing coverage. Please review.

Project coverage is 63.18%. Comparing base (fea80f0) to head (ed95d50).
Report is 19 commits behind head on dev/v4.

Files with missing lines Patch % Lines
...ter.PlatformServices/Execution/TestMethodRunner.cs 18.75% 13 Missing ⚠️
...rk/Attributes/TestMethod/STATestMethodAttribute.cs 0.00% 3 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           dev/v4    #5856      +/-   ##
==========================================
- Coverage   63.21%   63.18%   -0.04%     
==========================================
  Files         584      584              
  Lines       31808    31808              
==========================================
- Hits        20107    20097      -10     
- Misses      11701    11711      +10     
Flag Coverage Δ
Debug 63.18% <15.78%> (-0.04%) ⬇️
integration 63.19% <15.78%> (-0.06%) ⬇️
production 63.18% <15.78%> (-0.04%) ⬇️
unit 63.21% <15.78%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
...mework/Attributes/TestMethod/TestClassAttribute.cs 100.00% <ø> (ø)
...rk/Attributes/TestMethod/STATestMethodAttribute.cs 0.00% <0.00%> (ø)
...ter.PlatformServices/Execution/TestMethodRunner.cs 47.10% <18.75%> (ø)

... and 6 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Member

@Evangelink Evangelink left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you want to also simplify logic from

private async Task RunTestsFromRightContextAsync(IFrameworkHandle frameworkHandle, Func<TestRunCancellationToken, Task> runTestsAction)
?

@Youssef1313
Copy link
Member Author

Do you want to also simplify logic from

Hmm, I'm not sure exactly what to simplify there as this is more of a global setting unrelated to the attributes.

@Evangelink
Copy link
Member

Do you want to also simplify logic from

Hmm, I'm not sure exactly what to simplify there as this is more of a global setting unrelated to the attributes.

True, if we don't care much about perf, we could force STATEstMethod on all test methods in such context. This is obviously less performant than having a single STA move.

@Youssef1313
Copy link
Member Author

Do you want to also simplify logic from

Hmm, I'm not sure exactly what to simplify there as this is more of a global setting unrelated to the attributes.

True, if we don't care much about perf, we could force STATEstMethod on all test methods in such context. This is obviously less performant than having a single STA move.

The logic in the attribute checks if we are already in STA thread, and in that case we don't create a thread and we run directly.
So, if the option is globally enabled, it doesn't matter much whether or not the attribute is used as it will almost do nothing special.

@Youssef1313 Youssef1313 requested a review from Evangelink June 24, 2025 17:50
@Youssef1313 Youssef1313 added this to the 4.0.0 milestone Jun 25, 2025
@Youssef1313
Copy link
Member Author

@Evangelink I changed a bit the signature of the wrapping constructor of STATestMethodAttribute

@Evangelink Evangelink merged commit 9da262e into dev/v4 Jun 25, 2025
7 of 8 checks passed
@Evangelink Evangelink deleted the dev/ygerges/sta branch June 25, 2025 09:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[MSTest][v4] STAThreadAttribute should be sealed
3 participants