-
Notifications
You must be signed in to change notification settings - Fork 262
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow to disable test expansion on implementations of ITestDataSource (…
- Loading branch information
1 parent
88286f6
commit 33f94f8
Showing
19 changed files
with
462 additions
and
191 deletions.
There are no files selected for viewing
248 changes: 131 additions & 117 deletions
248
src/Adapter/MSTest.TestAdapter/Discovery/AssemblyEnumerator.cs
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletions
27
src/TestFramework/TestFramework/Attributes/DataSource/TestDataSourceOptionsAttribute.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT license. See LICENSE file in the project root for full license information. | ||
|
||
namespace Microsoft.VisualStudio.TestTools.UnitTesting; | ||
|
||
/// <summary> | ||
/// Specifies options for all <see cref="ITestDataSource"/> of the current assembly. | ||
/// </summary> | ||
/// <remarks> | ||
/// These options can be override by individual <see cref="ITestDataSource"/> attribute.</remarks> | ||
[AttributeUsage(AttributeTargets.Assembly, Inherited = false)] | ||
public sealed class TestDataSourceOptionsAttribute : Attribute | ||
{ | ||
/// <summary> | ||
/// Initializes a new instance of the <see cref="TestDataSourceOptionsAttribute"/> class. | ||
/// </summary> | ||
/// <param name="unfoldingStrategy"> | ||
/// The <see cref="UnfoldingStrategy"/> to use when executing parameterized tests. | ||
/// </param> | ||
public TestDataSourceOptionsAttribute(TestDataSourceUnfoldingStrategy unfoldingStrategy) | ||
=> UnfoldingStrategy = unfoldingStrategy; | ||
|
||
/// <summary> | ||
/// Gets the test unfolding strategy. | ||
/// </summary> | ||
public TestDataSourceUnfoldingStrategy UnfoldingStrategy { get; } | ||
} |
38 changes: 38 additions & 0 deletions
38
src/TestFramework/TestFramework/Interfaces/ITestDataSourceUnfoldingCapability.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT license. See LICENSE file in the project root for full license information. | ||
|
||
namespace Microsoft.VisualStudio.TestTools.UnitTesting; | ||
|
||
/// <summary> | ||
/// Specifies the capability of a test data source to define how parameterized tests should be executed, either as | ||
/// individual test cases for each data row or as a single test case. This affects the test results and the UI | ||
/// representation of the tests. | ||
/// </summary> | ||
public interface ITestDataSourceUnfoldingCapability | ||
{ | ||
TestDataSourceUnfoldingStrategy UnfoldingStrategy { get; } | ||
} | ||
|
||
/// <summary> | ||
/// Specifies how parameterized tests should be executed, either as individual test cases for each data row or as a | ||
/// single test case. This affects the test results and the UI representation of the tests. | ||
/// </summary> | ||
public enum TestDataSourceUnfoldingStrategy : byte | ||
{ | ||
/// <summary> | ||
/// MSTest will decide whether to unfold the parameterized test based on value from the assembly level attribute | ||
/// <see cref="TestDataSourceOptionsAttribute" />. If no assembly level attribute is specified, then the default | ||
/// configuration is to unfold. | ||
/// </summary> | ||
Auto, | ||
|
||
/// <summary> | ||
/// Each data row is treated as a separate test case. | ||
/// </summary> | ||
Unfold, | ||
|
||
/// <summary> | ||
/// The parameterized test is not unfolded; all data rows are treated as a single test case. | ||
/// </summary> | ||
Fold, | ||
} |
13 changes: 13 additions & 0 deletions
13
src/TestFramework/TestFramework/PublicAPI/PublicAPI.Unshipped.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,14 @@ | ||
#nullable enable | ||
Microsoft.VisualStudio.TestTools.UnitTesting.DataRowAttribute.UnfoldingStrategy.get -> Microsoft.VisualStudio.TestTools.UnitTesting.TestDataSourceUnfoldingStrategy | ||
Microsoft.VisualStudio.TestTools.UnitTesting.DataRowAttribute.UnfoldingStrategy.set -> void | ||
Microsoft.VisualStudio.TestTools.UnitTesting.DynamicDataAttribute.UnfoldingStrategy.get -> Microsoft.VisualStudio.TestTools.UnitTesting.TestDataSourceUnfoldingStrategy | ||
Microsoft.VisualStudio.TestTools.UnitTesting.DynamicDataAttribute.UnfoldingStrategy.set -> void | ||
Microsoft.VisualStudio.TestTools.UnitTesting.ITestDataSourceUnfoldingCapability | ||
Microsoft.VisualStudio.TestTools.UnitTesting.ITestDataSourceUnfoldingCapability.UnfoldingStrategy.get -> Microsoft.VisualStudio.TestTools.UnitTesting.TestDataSourceUnfoldingStrategy | ||
Microsoft.VisualStudio.TestTools.UnitTesting.TestDataSourceOptionsAttribute | ||
Microsoft.VisualStudio.TestTools.UnitTesting.TestDataSourceOptionsAttribute.TestDataSourceOptionsAttribute(Microsoft.VisualStudio.TestTools.UnitTesting.TestDataSourceUnfoldingStrategy unfoldingStrategy) -> void | ||
Microsoft.VisualStudio.TestTools.UnitTesting.TestDataSourceOptionsAttribute.UnfoldingStrategy.get -> Microsoft.VisualStudio.TestTools.UnitTesting.TestDataSourceUnfoldingStrategy | ||
Microsoft.VisualStudio.TestTools.UnitTesting.TestDataSourceUnfoldingStrategy | ||
Microsoft.VisualStudio.TestTools.UnitTesting.TestDataSourceUnfoldingStrategy.Auto = 0 -> Microsoft.VisualStudio.TestTools.UnitTesting.TestDataSourceUnfoldingStrategy | ||
Microsoft.VisualStudio.TestTools.UnitTesting.TestDataSourceUnfoldingStrategy.Fold = 2 -> Microsoft.VisualStudio.TestTools.UnitTesting.TestDataSourceUnfoldingStrategy | ||
Microsoft.VisualStudio.TestTools.UnitTesting.TestDataSourceUnfoldingStrategy.Unfold = 1 -> Microsoft.VisualStudio.TestTools.UnitTesting.TestDataSourceUnfoldingStrategy |
Oops, something went wrong.