Provide a way to opt-out of discovery time expanding of ITestDataSource tests
See original GitHub issueDescription
We recently changed how ITestDataSource
tests are discovered. We need to provide a way to opt-out from this behavior.
Proposal
- Ability to opt-out assembly, type or test case level by using an attribute.
- Ability to opt-out using a command-line parameter or
.runsettings
setting.
Steps to reproduce
protected static readonly Guid _subscriptionId = Guid.NewGuid();
[DynamicData(nameof(GetData), DynamicDataSourceType.Method)]
[DataTestMethod]
public void MyTest1(Guid subscriptionId)
{
}
private static IEnumerable<object[]> GetData()
{
yield return new object[]
{
_subscriptionId
};
}
Expected behavior
Discovered Tests:
- MyTest1
Actual behavior
Discovered Tests:
- MyTest1 (e6a883d7-03b5-4231-a06f-99e5847eb9b0)
Issue Analytics
- State:
- Created 2 years ago
- Comments:9 (3 by maintainers)
Top Results From Across the Web
Test data "disappearing" when using MSTest DynamicData
1 Answer. This is happening due to an undocumented breaking change in MsTest 2.2. 4 which changes the default behavior for discovering ......
Read more >Visual Studio Test Explorer FAQ
How can I discover these tests? Build your project to run assembly-based discovery. Real-time test discovery is source-based test discovery.
Read more >Unit testing - Data-driven tests - DataMiner Dojo
Data-driven testing is about providing a unit test with data that is then used during the execution of the unit test.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
The opt-out is very(!!) much needed and all this new discovery time behavior should actually be an opt-in. How could all of these breaking changes be introduced on a minor version??
Even a DynamicData test as simple as this one, is now only being executed 2-times and the
null
case is simply lostI totally agree that this should be an opt-in rather than an opt-out. These changes caused quite a bit of headache in my org