My organization has a large number of legacy test code that is all set up to run on MSTest V1. And until they all have been migrated to MSTest V2, nobody is allowed to MSTest V2.
Now I have run into an unexpected problem. I need to create a new test project, but I can not find a way how to create a new MSTest V1 project in Visual Studio 2017.
In both .NET Core and .NET Framework, it creates a project with MSTest V2. And when I manually try to uninstall the MSTest V2 NuGet Packages and add a reference to Microsoft.VisualStudio.QualityTools.UnitTestFramework.dll it seems that that DLL is actually missing.
Is there a way to get MSTest V1 functionality working like this? Because the existing projects work perfectly fine.
Thank You!
So I am not sure myself why I couldn't find the DLL on the first attempt. When creating another project from scratch, the Quality Tools DLL was snuggly available. Once I picked that one and removed MSTest v2 it worked just fine!
Related
I recently created a unit test project(.net framework) in my project(.net framework 4.8).
I run my tests with visual studio enter image description here.
now wanna add a stage to my ci/cd on gitlab to run my tests.
I know how to do that in .net (dotnet test) but I don't know how to run my tests for .net framework with command line
I'll be happy to know your solutions.
Tnx
The VSTest.Console.exe tool can be used to run unit tests. This is equivalent to using the Visual Studio Test Explorer window.
VSTest.Console.exe is installed with Visual Studio. It is also available in the Microsoft.TestPlatform NuGet package.
(As a note for the benefit of users of Azure DevOps, Azure DevOps pipelines has a Visual Studio Test Platform Installer task that will install the test runner. The Azure DevOps task uses the NuGet package.)
For .net framework you should get familiar with MSBuild. If you are using MSTest you also need to know VSTestConsole. Not too hard!
Here is a minimal GitLab CI config for a .Net framework solution.
Also check here for more detials.
I tried find and use a open source framework for start BI project with TDD .
I choose SSISUNIT for step one. ssisUnit is a unit testing framework for SQL Server Integration Services. It is loosely based on the xUnit family of unit testing frameworks, but is tailored to better support the SSIS environment.
Download SSISUNIT project and run solution 2017 in VS. But I've error when sln open.
Problem :
I tried :
Install the latest version of SSDT recommendation (in this question)
I have SQL Server Integration Services Project, Microsoft reporting service project, Microsoft analysis service project
Read same question but not worked for me in vs 2019.
I tried changed the Project platform to x86,x64 and AnyCPU.
We use SQL-SERVER 2019 SSIS SSAS(MDX), Visual Studio 2019, Power BI
You'll need to remove or unload that project from the solution. Microsoft deprecated support for the setup projects.
I'm trying to use NSubstitute in my Unity project (Unity version 2019.2.2f1). No matter how to import it, my IDE, both Visual Studio and JetBrains Rider, would give an error when I try using NSubstitute saying NSubstitute is undefined.
I have tried many options and versions of NSubstitute packages (4.2.1 and 2.0.3). I also import the dll file from net35 folder of the package into a Plugins folder in my Unity project. I also tried to install the same version of NSubstitute using Nuget in the IDE.
I added NSubstitute 4.2.1 (.NET Standard 2.0) in a Unity project, but I needed to include 3 more dependencies for it to work:
system.threading.tasks.extensions.4.5.3
system.runtime.compilerservices.unsafe.4.6.0
castle.core.4.4.0
Update 2020
If you read this in 2020 or later, check the answer from Rodrigo Eleuterio how to make this work with the latest version of NSubstitute.
/end update
I was able to make the 2.0.3 version work with Unity. The newer versions have additional dependencies which I could not make work in Unity, so it seems for now we're stuck with 2.0.3. So here is how I did it:
Download 2.0.3 from the NuGet Website.
Unzip the file and move the lib/net35/NSubstitute.dll into the Plugins folder of your project.
In your test assembly definition, don't forget to reference it, otherwise it will not be found.
When you now reopen the project in Rider it should be found. Sometimes Unity acts up a little and doesn't seem to find the DLL. In this case re-importing the project can help.
I'm converting some existing C# projects to be defined in CMake -- moving from the previous include_external_msproject() directive to the newer full support for C#.
But I'm not seeing how to convert projects of the Visual C# Unit Test Project type. I'm able to build them as libraries, and compile them successfully -- but Visual Studio doesn't show them as unit test projects, just as regular libraries. Most crucially, the tests aren't visible to the Test Explorer.
Things I've already tried include:
Adding TestProjectType=UnitTest as a target property:
<TestProjectType>UnitTest</TestProjectType>
Adding a reference path, as follows, as a target property:
<ReferencePath>$(ProgramFiles)/Common Files/microsoft shared/VSTT/$(VisualStudioVersion)/UITestExtensionPackages</ReferencePath>
Adding Microsoft.VisualStudio.QualityTools.UnitTestFramework as a project reference (using CMake's VS_DOTNET_REFERENCES property).
I'm using Microsoft Visual Studio Professional 2015, CMake 3.13.2, .NET Framework 4.5.2 (but I suspect the issue isn't specific to my particular version combination).
Manually adding <TestProjectType>UnitTest</TestProjectType>, made my unit test project show up as unit test. Trying to figure out how to do that using cmake.
Update: the following shows the project as unittest
set_target_properties(${target_name}
PROPERTIES
VS_GLOBAL_PROJECT_TYPES "{3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}"
)
Documentation for VS_GLOBAL_PROJECT_TYPES is here.
I found this documentation for Project Guid: Visual Studio project type guids
Thanks #bhardwajs, your answer helped me.
You can also add TestProjectType to global properties:
set_target_properties(${target_name} PROPERTIES
VS_GLOBAL_TestProjectType "UnitTest"
VS_GLOBAL_PROJECT_TYPES "{3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}")
I noticed a change in one of our solutions in VS 2015 today.
It seems the test projects that are generated for the solution use a different namespace than the existing test projects in the same solution.
Only the test projects that reference
Microsoft.VisualStudio.QualityTools.UnitTestFramework
are recognized as test projects within Visual Studio 2015.
However there are now some test projects referencing
Microsoft.VisualStudio.TestPlatform.TestFramework
Microsoft.VisualStudio.TestPlatform.TestFramework.Extensions
It's possible that these test project where generated from VS 2017 RC. This would explain the different namespace. I didn't find any docs about backward compatibility.
Question is, which namespace to use? As we can't use both namespaces at the same time.
What are the differences between the two namespaces?
VisualStudio 2015 is able to build the test projects with either reference. To switch the newer namespace back to the older namespace only because of the test project generation is not reason enough I think.
MSTest has been released as a new NuGet package solution that is no longer tightly coupled to the Visual Studio version. Your new projects are using MSTest 2.0.
MSTest V2 release annoucement: https://devblogs.microsoft.com/devops/taking-the-mstest-framework-forward-with-mstest-v2/