Update dependency MSTest.TestAdapter to v4
This MR contains the following updates:
| Package | Type | Update | Change |
|---|---|---|---|
| MSTest.TestAdapter | nuget | major |
3.0.4 -> 4.0.2
|
Release Notes
microsoft/testfx (MSTest.TestAdapter)
v4.0.2
See the release notes here
v4.0.1
See the release notes here
v4.0.0
What is new?
Assert.That
MSTest v4 adds a new type of assertion, that allows you to write any expression, and it will inspect the result to give you more information on failure. Providing a very flexible way to assert complicated expressions. Here a simple example:
[TestClass]
public sealed class Test1
{
[TestMethod]
public void TestMethod1()
{
var animal = "Tiger";
var zoo = new Zoo();
Assert.That(() => zoo.GetAnimal() == animal);
}
}
public class Zoo
{
public string GetAnimal()
{
return "Giraffe";
}
}
Assert.That(() => zoo.GetAnimal() == animal) failed.
Details:
animal = "Tiger"
zoo.GetAnimal() = "Giraffe"
CallerArgumentExpression
CallerArgumentExpression is consumed by all assertions, to make them aware of the expressions used in the assertion. In the example below, we now know what both the expected and actual values are. But also what value they come from, giving us opportunity to provide better error messages:
[TestClass]
public sealed class Test1
{
[TestMethod]
public void TestMethod1()
{
string animal = null;
Assert.AreEqual("Giraffe", animal);
}
}
Error Message: Assert.AreEqual failed. Expected:<Giraffe>. Actual:<>.
'expected' expression: '"Giraffe"', 'actual' expression: 'animal'.
Breaking changes
We hidden many types that should have never been public in the first place. We believe that most of the changes won't have any real user impact. For the changes where we expect user impact migration guide from v3 is provided: https://learn.microsoft.com/dotnet/core/testing/unit-testing-mstest-migration-v3-v4
See the MSTest changelog here: https://github.com/microsoft/testfx/blob/main/docs/Changelog.md#4.0.0 See the Microsoft.Testing.Platform changelog here: https://github.com/microsoft/testfx/blob/main/docs/Changelog-Platform.md#2.0.0
Full changelog here: https://github.com/microsoft/testfx/compare/v3.11.0...v4.0.0
v3.11.1
See the release notes here
v3.11.0
See the release notes here
v3.10.5
See the release notes here
v3.10.4
See the release notes here
v3.10.3
See the release notes here
v3.10.2
See the release notes here
v3.10.1
See the release notes here
v3.10.0
See the release notes here
v3.9.3
What's Changed
- Simpler fix for dotnet test when using retry by @Youssef1313 in #5732. Note that this MR targets rel/3.9 branch. For 3.10, we did a different fix: https://github.com/microsoft/testfx/pull/5717
See the MSTest changelog here: https://github.com/microsoft/testfx/blob/main/docs/Changelog.md#3.9.3 See the Microsoft.Testing.Platform changelog here: https://github.com/microsoft/testfx/blob/main/docs/Changelog-Platform.md#1.7.3
Full Changelog: https://github.com/microsoft/testfx/compare/v3.9.2...v3.9.3
v3.9.2
What's Changed
- Fix MSTEST0042 (duplicate data row) false positive with Zero/NegativeZero by @Youssef1313 in #5684
- Allow framework authors to use TestCase.FullyQualifiedName as the TestNodeUid by @Youssef1313 in #5658
- Ensure TestMethodAttribute.Execute is run on the correct execution context by @Youssef1313 in #5688
- Avoid loading System.Threading.Tasks.Extensions when not needed by @Youssef1313 in #5694
- Fix UseAsync property in TestMethodAttribute derived classes to use type checks by @Youssef1313 and @Copilot in #5708
- Fix UnitTestRunner leaking some test class instances by @Youssef1313 in #5715
See the MSTest changelog here: https://github.com/microsoft/testfx/blob/main/docs/Changelog.md#3.9.2 See the Microsoft.Testing.Platform changelog here: https://github.com/microsoft/testfx/blob/main/docs/Changelog-Platform.md#1.7.2
Full Changelog: https://github.com/microsoft/testfx/compare/v3.9.1...v3.9.2
v3.9.1
What's Changed
- Make ConditionBaseAttribute.Mode public by @youssef-backport-bot in https://github.com/microsoft/testfx/pull/5597
- Add missing overload for Assert.Throws by @youssef-backport-bot in https://github.com/microsoft/testfx/pull/5620
- Fix System.MissingMethodException for KeyValuePair Deconstruction by @youssef-backport-bot in https://github.com/microsoft/testfx/pull/5635
- Run the whole ExecuteInternal logic under the right execution context by @youssef-backport-bot in https://github.com/microsoft/testfx/pull/5646
- VSTestBridge: Handle TestPropertyAttributes.Trait instead of special casing specific properties by @youssef-backport-bot in https://github.com/microsoft/testfx/pull/5648
See the MSTest changelog here: https://github.com/microsoft/testfx/blob/main/docs/Changelog.md#3.9.1 See the Microsoft.Testing.Platform changelog here: https://github.com/microsoft/testfx/blob/main/docs/Changelog-Platform.md#1.7.1
Full Changelog: https://github.com/microsoft/testfx/compare/v3.9.0...v3.9.1
v3.9.0
In this release we focused a lot on providing fixes for MSTest and Microsoft.Testing.Platform. The most notable new features and fixes are:
MSTest
- Allow async test methods for UITestMethod on UWP and WinUI by @Youssef1313 in https://github.com/microsoft/testfx/pull/5297
- Add analyzer for duplicate data row by @Youssef1313 in https://github.com/microsoft/testfx/pull/5144
- Fix ClassCleanup not called when the first test in class is ignored by @Youssef1313 in https://github.com/microsoft/testfx/pull/5070
- Fix writing warnings outside of appdomain by @nohwnd in https://github.com/microsoft/testfx/pull/5371
Microsoft.Testing.Platform
- Add (alpha) Azure DevOps extension to report errors by @nohwnd in https://github.com/microsoft/testfx/pull/5260
- Kill testhost if writing hang dump fails by @Youssef1313 in https://github.com/microsoft/testfx/pull/5538
We've also improved the dotnet test experience in dotnet SDK, especially around Retry plugin experience, and started dogfooding the experience in our own repository. Please check out how to enable the new dotnet test experience for Microsoft.Testing.Platform in net10 by following this link, and help us dogfood it.
New Contributors
- @stan-sz made their first contribution in https://github.com/microsoft/testfx/pull/5214
- @YoshiRulz made their first contribution in https://github.com/microsoft/testfx/pull/5281
- @bjornhellander made their first contribution in https://github.com/microsoft/testfx/pull/5300
See the MSTest changelog here: https://github.com/microsoft/testfx/blob/main/docs/Changelog.md#3.9.0 See the Microsoft.Testing.Platform changelog here: https://github.com/microsoft/testfx/blob/main/docs/Changelog-Platform.md#1.7.0
Full Changelog: https://github.com/microsoft/testfx/compare/v3.8.3...v3.9.0
v3.8.3
See the release notes here
v3.8.2
See the release notes here
v3.8.1
See the release notes here
v3.8.0
See the release notes here
Announcements
- This release adds new Assert APIs related to throwing exceptions, collections, and strings. Refer to the changelog for more information.
- This release adds support for generic test methods.
- This release adds few new analyzers.
- We added
MSTestAnalysisMode. We encourage you to set this property to at leastRecommended. - This release adds
RetryAttribute - Microsoft.Testing.Extensions.TrxReport and Microsoft.Testing.Extensions.CodeCoverage are now a dependency of MSTest metapackage
v3.7.3
See the release notes here
v3.7.2
See the release notes here
v3.7.1
See the release notes here
v3.7.0
See the release notes here
Announcements
MSTest.Analyzers is now a transitive dependency of MSTest.TestFramework and thus no longer needs to be manually installed.
Note: The only rules enabled by default as warnings, which could potentially cause build errors when updating MSTest, have been carefully selected and thoroughly validated. These rules specifically address real runtime issues related to the usage of MSTest, ensuring that no purely stylistic or low-impact analyzers are enforced by default.
v3.6.4
See the release notes here
v3.6.3
See the release notes here
v3.6.2
See the release notes here
v3.6.1
See the release notes here
v3.6.0
See the release notes here
Special shoutout to @SimonCropp for his exceptional contribution in improving the quality of the repository.
v3.5.2
See the release notes here
v3.5.1
See the release notes here
v3.5.0
See the release notes here
v3.4.3
See the release notes here
v3.4.2: v.3.4.2
See the release notes here
v3.4.1
See the release notes here
v3.4.0
Here are the highlights of the current release, full change log is available below:
MSTest
New and improved analyzers
We've added more code analyzers to help you prevent mistakes, and to ensure a consistent code style of your tests.
One example of a new analyzer that was added in 3.4.0 is MSTEST0024: Do not store TestContext in static members. This analyzer has info severity by default, and will show a message, when you store TestContext in a static member in your class. This is not recommended, and you should be using a TestContext property instead:
The other analyzers added in this release:
- MSTEST0017: Assertion arguments should be passed in the correct order by @Evangelink in #2256
- MSTEST0019: Prefer TestInitialize over ctor by @Evangelink in #2580
- MSTEST0020: Prefer ctors over TestInitialize methods by @Evangelink in #2582
- MSTEST0021: Prefer Dispose over TestCleanup methods by @Evangelink in #2585
- MSTEST0022: Prefer 'TestCleanup' methods over Dispose by @Evangelink in #2586
- MSTEST0023: Do not negate boolean assertions by @Evangelink in #2594
- MSTEST0024: Do not store TestContext in static members by @Evangelink in #2597
- Add PreferAssertFailOverAlwaysFalseConditionsAnalyzer by @Youssef1313 in #2799
If you've just learned about MSTest analyzers, please also check out the analyzers that were added in previous releases. They will help you ensure that your test classes and test methods are recognized by MSTest and are not accidentally ignored.
The analyzers are automatically installed with the MSTest NuGet meta-package. But can also be installed separately using the MSTest.Analyzers NuGet package.
More timeout options
Timeout can now be specified on all fixture methods, including ClassCleanup, AssemblyCleanup, TestCleanup and TestInitalize. In this case I want my [ClassCleanup] to time out after 1 second:
Alternatively timeouts can be specified through runsettings. For example like this:
<RunSettings>
<MSTest>
<ClassCleanupTimeout>1000</ClassCleanupTimeout>
</MSTest>
</RunSettings>
Better errors on data mismatch
When you provide data that don't match your test method signature, the test will fail with an informative message, rather than just "Parameter count mismatch.".
(There is also an analyzer that helps with the same while you are writing the code.)
MSTest SDK updates
We've introduced MSTest project SDK in this .NET Blog post.
Choosing version in global.json
In this release we are promoting a way to define the MSTest.Sdk version in global.json. This makes it easier to specify the version in a single place, instead of in every project.
{
"msbuild-sdks": {
"MSTest.Sdk": "3.4.0"
}
}
<Project Sdk="MSTest.Sdk">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
</PropertyGroup>
</Project>
Playwright support
We've added a property to enable Playwright, to simplify creating web tests:
<Project Sdk="MSTest.Sdk">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<EnablePlaywright>true</EnablePlaywright>
</PropertyGroup>
</Project>
Aspire testing support
Similarly we've added a property to enable Aspire testing:
<Project Sdk="MSTest.Sdk">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<EnabledAspireTesting>true</EnabledAspireTesting>
</PropertyGroup>
</Project>
Central package management
NuGet central package management can now be used together with MSTest.Sdk.
More examples of SDK projects
To see more examples of projects using MSTest.Sdk: https://github.com/microsoft/testfx/tree/rel/3.4/samples/public/DemoMSTestSdk
MSTest runner
Simpler banner
We've took inspiration from MSBuild and simplified the runner banner, to show the information, on a single line:
.NET Testing Platform v1.2.0+3abae95b6 (UTC 2024/05/03) [win-x64 - .NET 8.0.4]
STA support and WinUI support
The runner can be configured to run in STA (Single Thread Apartment) mode, which is required for running UI tests. And it also supports WinUI workloads.
And more
And much more, see the complete change log here: https://github.com/microsoft/testfx/blob/main/docs/Changelog.md#3.4.0
New Contributors
A special thank you to all our new contributors:
- @mariam-abdulla made their first contribution in #2564
- @Varorbc made their first contribution in #2696
- @skanda890 made their first contribution in #2706
- @SimonCropp made their first contribution in #2714
- @Mrxx99 made their first contribution in #2717
- @dansiegel made their first contribution in #2727
- @thomhurst made their first contribution in #2749
- @Youssef1313 made their first contribution in #2799
v3.3.1
See the release notes here
v3.3.0
See the release notes here.
v3.2.2
See the release notes here.
v3.2.1
See the release notes here.
v3.1.1
See the release notes here.
Configuration
-
If you want to rebase/retry this MR, check this box
This MR has been generated by Renovate Bot.