Using the MSTest Framework to Test Applications Targeting .NET Standard 1.6 and Above

I am transferring my project from .NETFramework 4.5.1 to .NET Standard 1.6

The project uses the MSTest environment, and I would like to save it this way and not rewrite the tests in another environment (XUnit, NUnit, etc.)

Currently, only support for the MSTest platform has been announced only for .NET Core, and of course, dotnet-test-mstest 1.1.2-preview available in NuGet does not support .NET Standard, so I can not use the target standard .NET test projects.

However, according to the compatibility matrix , .NET Standard 1.6 is compatible with .NET Core 1.0.
So I have test builds oriented to .NET Core 1.0, and links to my system test builds that target .NET Standard 1.6 - and that works fine.

Question is a good decision in the future?

I have not found a roadmap for MSTest, and I wonder if this trick will work when I upgrade to .NET Standard 2.0?
Should I change my test environment to something else, do you have more modern support like XUnit?

Even the Microsoft documentation points to XUnit , do they refuse MSTest?

Please note that this is not a duplicate , since my question is about the future prospects, and not just the current state of affairs.

+6
source share
1 answer

→ The project uses the MSTest structure, and I would like to save it that way and not rewrite the tests in another environment (XUnit, NUnit or te like)

Sounds reasonable.

→ I can not use target standard .NET test projects

You can.

Please refer to this post for reference: https://blogs.msdn.microsoft.com/visualstudioalm/2016/11/29/evolving-the-test-platform-part-3-net-core-convergence-and-cross -plat / Note that you no longer need the dotnet-test-mstest package. Use the MSTest.TestAdapter instead.

→ Even Microsoft documentation points to XUnit

In this case, yes. But there are other projects that also use MSTest.

We work with both the MSTest test environment and the VS test platform. As a test platform, we take a pluralistic approach and would like to leave the sample of the test platform to the developer (as opposed to the parties in favor of any one structure). You can learn more about this approach: https://blogs.msdn.microsoft.com/visualstudioalm/2016/07/25/evolving-the-visual-studio-test-platform-part-1/ .

→ do they refuse MSTest?

Not at all.

Please see here: https://blogs.msdn.microsoft.com/bharry/2017/01/20/open-sourcing-the-vs-test-platform/ , and here: https://visualstudio.uservoice.com / forums / 121579-visual-studio-ide / suggestions / 13399980-make-ms-test-framework-opensouce to get a glimpse of the future. In the near future we will announce more - especially in terms of the roadmap.

→ Question: is this a good decision in the future?

Yes (based on the foregoing).

+4
source

Source: https://habr.com/ru/post/1014235/


All Articles