Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow to disable test expansion on implementations of ITestDataSource #4269

Merged
merged 15 commits into from
Dec 11, 2024

Conversation

Evangelink
Copy link
Member

Fixes #4255

Note that I decided to not allow [DataRow] to disable test expansion because AFAIK we don't have issue there but that's arbitrary call and I don't mind changing it.

Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Copilot reviewed 5 out of 10 changed files in this pull request and generated 1 suggestion.

Files not reviewed (5)
  • src/TestFramework/TestFramework/PublicAPI/PublicAPI.Unshipped.txt: Language not supported
  • src/TestFramework/TestFramework/Attributes/DataSource/DataRowAttribute.cs: Evaluated as low risk
  • src/TestFramework/TestFramework/Attributes/DataSource/DynamicDataAttribute.cs: Evaluated as low risk
  • test/IntegrationTests/TestAssets/FxExtensibilityTestProject/TestDataSourceExTests.cs: Evaluated as low risk
  • src/Adapter/MSTest.TestAdapter/Discovery/AssemblyEnumerator.cs: Evaluated as low risk
Comments skipped due to low confidence (1)

src/TestFramework/TestFramework/Attributes/DataSource/TestDataSourceDiscoveryAttribute.cs:31

  • [nitpick] The parameter name 'expandDataSource' is ambiguous. It should be renamed to 'shouldExpandDataSource' or 'isExpandDataSourceEnabled' to clearly indicate its boolean nature.
public TestDataSourceDiscoveryAttribute(bool expandDataSource)

@Youssef1313
Copy link
Member

Youssef1313 commented Dec 8, 2024

Note that I decided to not allow [DataRow] to disable test expansion because AFAIK we don't have issue there but that's arbitrary call and I don't mind changing it.

There are issues with DataRow currently. If you do this:

[DataRow(new object[] { (byte)0 })]
[DataRow(new object[] { (short)0 })]

the types byte and short are lost IIRC and you end up with int. This happens even though we have:

EmitTypeInformation = System.Runtime.Serialization.EmitTypeInformation.Always,

(on .NET runtime, this behavior is by-design I think - there is something around primitive types specifically there)

@Evangelink Evangelink requested a review from Copilot December 10, 2024 15:41

Choose a reason for hiding this comment

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

Copilot reviewed 5 out of 17 changed files in this pull request and generated no suggestions.

Files not reviewed (12)
  • src/TestFramework/TestFramework/PublicAPI/PublicAPI.Unshipped.txt: Language not supported
  • src/Adapter/MSTest.TestAdapter/Discovery/AssemblyEnumerator.cs: Evaluated as low risk
  • src/Adapter/MSTest.TestAdapter/Discovery/TypeEnumerator.cs: Evaluated as low risk
  • src/Adapter/MSTest.TestAdapter/Execution/TypeCache.cs: Evaluated as low risk
  • src/Adapter/MSTest.TestAdapter/Helpers/ReflectHelper.cs: Evaluated as low risk
  • src/TestFramework/TestFramework/Attributes/DataSource/DataRowAttribute.cs: Evaluated as low risk
  • src/TestFramework/TestFramework/Attributes/DataSource/DynamicDataAttribute.cs: Evaluated as low risk
  • src/TestFramework/TestFramework/Attributes/DataSource/TestDataSourceDiscoveryAttribute.cs: Evaluated as low risk
  • src/TestFramework/TestFramework/Attributes/DataSource/TestDataSourceDiscoveryOption.cs: Evaluated as low risk
  • src/TestFramework/TestFramework/Attributes/DataSource/TestDataSourceOptionsAttribute.cs: Evaluated as low risk
  • src/TestFramework/TestFramework/Interfaces/ITestDataSourceUnfoldingCapability.cs: Evaluated as low risk
  • test/IntegrationTests/MSTest.IntegrationTests/Parameterized tests/DataExtensibilityTests.cs: Evaluated as low risk
Comments skipped due to low confidence (1)

test/IntegrationTests/TestAssets/DynamicDataTestProject/DisableExpansionTests.cs:36

  • [nitpick] The method name 'TestPropertyWithTwoSourcesButOnlyOneDisablingExpansion' is quite long and could be more concise.
[DynamicData(nameof(PropertySource), UnfoldingStrategy = TestDataSourceUnfoldingStrategy.Fold)]
@Evangelink
Copy link
Member Author

/azp run

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

# Conflicts:
#	src/Adapter/MSTest.TestAdapter/Discovery/AssemblyEnumerator.cs
Youssef1313
Youssef1313 previously approved these changes Dec 11, 2024
@Evangelink Evangelink disabled auto-merge December 11, 2024 15:44
@Evangelink Evangelink merged commit 33f94f8 into microsoft:main Dec 11, 2024
10 checks passed
@Evangelink Evangelink deleted the expand-tests branch December 11, 2024 15:44
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.

Add ability to disable expansion on [DynamicData]
2 participants