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

chore(deps): update mstest monorepo to v3 (major) #12

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

renovate[bot]
Copy link

@renovate renovate bot commented Jan 14, 2024

This PR contains the following updates:

Package Change Age Adoption Passing Confidence
MSTest.TestAdapter 2.2.8 -> 3.6.4 age adoption passing confidence
MSTest.TestFramework 2.2.8 -> 3.6.4 age adoption passing confidence

Release Notes

microsoft/testfx (MSTest.TestAdapter)

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:

image

The other analyzers added in this release:

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:

image

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.".

image

image

(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.

See MSTestRunnerWinUI example

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:

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.

v3.0.4

See the release notes here.

v3.0.3

See the release notes here.

v3.0.2

See the release notes here.

v3.0.1

See the release notes here.

v3.0.0

See the release notes here.

v2.2.10

See release notes here.

v2.2.9

Parallel output

🙇 Shout out to @​SimonCropp, for bringing this functionality to XUnit in his https://github.com/SimonCropp/XunitContext project. And being an inspiration for implementing this.

MSTest 2.2.9 captures all Console output and attaches it to the correct test, even if you are running tests in parallel. This output is captured from your test code as well as from the tested code. And it requires no special setup.

Before

In 2.2.8, test output is scattered among tests, in our example, one unlucky test gets all the output of other tests just mixed together:

image

After

With 2.2.9, each output is correctly attached to the test that produced it:

image
image

Also notice that we are also capturing debug, trace and error. And we are not awaiting the FastChild method, and the output is still assigned correctly. Souce code.

Limitations

Due to the way that class and assembly initialize, and cleanup are invoked, their output will end up in the first test that run (or last for cleanup). This is unfortunately not easily fixable.

See release notes here.


Configuration

📅 Schedule: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.

Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 Ignore: Close this PR and you won't be reminded about these updates again.


  • If you want to rebase/retry this PR, check this box

This PR was generated by Mend Renovate. View the repository job log.

@renovate renovate bot force-pushed the renovate/major-mstest-monorepo branch from 683c961 to 94b07d7 Compare January 25, 2024 08:34
@renovate renovate bot force-pushed the renovate/major-mstest-monorepo branch from 94b07d7 to b71a001 Compare February 14, 2024 08:02
@renovate renovate bot force-pushed the renovate/major-mstest-monorepo branch from b71a001 to 31608a8 Compare February 23, 2024 02:16
@renovate renovate bot force-pushed the renovate/major-mstest-monorepo branch 2 times, most recently from 5b78b6f to f8d0440 Compare April 6, 2024 20:57
@renovate renovate bot force-pushed the renovate/major-mstest-monorepo branch 2 times, most recently from 245411e to 4682e95 Compare May 28, 2024 02:53
@renovate renovate bot force-pushed the renovate/major-mstest-monorepo branch from 4682e95 to f5b009a Compare June 1, 2024 05:33
@renovate renovate bot force-pushed the renovate/major-mstest-monorepo branch from f5b009a to 70b7982 Compare July 19, 2024 05:55
@renovate renovate bot force-pushed the renovate/major-mstest-monorepo branch 2 times, most recently from 975f3d0 to 3e7ac4c Compare August 13, 2024 17:55
@renovate renovate bot force-pushed the renovate/major-mstest-monorepo branch from 3e7ac4c to 32cb57a Compare September 13, 2024 02:59
@renovate renovate bot force-pushed the renovate/major-mstest-monorepo branch from 32cb57a to 924797e Compare October 4, 2024 02:37
@renovate renovate bot force-pushed the renovate/major-mstest-monorepo branch from 924797e to f0ead46 Compare November 1, 2024 02:59
@renovate renovate bot force-pushed the renovate/major-mstest-monorepo branch from f0ead46 to 5eb4421 Compare November 13, 2024 23:55
@renovate renovate bot force-pushed the renovate/major-mstest-monorepo branch from 5eb4421 to 0b54089 Compare December 4, 2024 02:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

0 participants