XUnit tests and live unit tests in Visual Studio 2017 - unit-testing

Having Visual Studio 2017 last version. I am unable run XUnit tests from test explorer in asp.net core Solution.
However, "dotnet test" works properly and Live Unit testing work properly as well.
I couldn't find any information how to fix my Visual Studio.
May you all can suggest me something?

Related

Unit tests failing in Visual Studio 2017

I recently "upgraded" from Visual Studio 2012 to 2017, and now a number of tests which pass when run in 2012, fail in 2017. Application-specific Assertions fail and I am also getting the following exceptions:
Microsoft.QualityTools.Testing.Fakes.UnitTestIsolation.UnitTestIsolationException: UnitTestIsolation instrumentation failed to initialize. Please restart Visual Studio and rerun this test (needless to say, a restart does not resolve the issue)
System.InvalidOperationException: Operation is not valid due to the current state of the object.
All code, options, and settings are identical in both environments. I am using Microsoft's testing framework, not NUnit, XUnit, etc. The code is in VB.Net. Any guidance would be appreciated. Thanks.
The option to use Fakes Assemblies isn't available in the Professional version. We will need to upgrade to the Enterprise Edition, or continue using 2012.

Angular (Typescript) Unit Testing - ASP.Net Core MVC SPA

I am developing a project which started life as an ASP.Net Core MVC SPA Template in Visual Studio 2015. I used the Visual Studio Karma Test Adapter with no problems for my Angular (Typescript) unit testing, but no matter what I tried I could not get NUnit to recognise my C# unit tests for the Web API and early Domain Model code. I tried to add a separate Test Project with no success and I also created unit test files within the same, single, project with no success.
At some point I knew I should migrate the code to Visual Studio 2017, as I feel that the new IDE will prove to be beneficial as the project develops, so I thought I would do it now and see if it solves my unit testing problems. Visual Studio's migration process didn't go well so I decided to start from scratch again.
I ran dotnet new angular to create a clean solution which I opened in VS 2017. It appears that the Visual Studio Karma Test Adapter does not work with VS 2017 yet, so for the Typescript (Jasmine) testing that left me with Chutzpah. No matter what I try I cannot write the simplest of Jasmine tests and have the Visual Studio Test Explorer recognise it (let alone run the test). I haven't even begun to look at the C# Unit Testing yet.
Can anyone else get a Jasmine Unit Test to be recognised and run in the VS Test Explorer from a clean dotnet new angular solution, I would be very grateful for some advise.

Why can't I run Nunit tests from Visual Studio when colleague can?

My code has NUnit tests. My colleague is able to run the tests from within Visual Studio on their desktop, however I can't run them on mine. When I try to use Test Explorer and "Run All", it just builds the project. Other options, such as Run Tests and Debug Tests also give the same result.
I have NUnit referenced in my project, why can't I run the tests from within Visual Studio?
Out of the box, Visual Studio doesn't have support for running tests built for the NUnit framework. As has been said in the the comments, your colleague probably has some kind of add-in like Resharper installed which adds in support for running Nunit tests.
If you don't have a license for whatever tool they're using, then you can still have visual studio integrated support for running/debugging NUnit tests by installing the NUnit Test Adapter. This is a free plugin that you can install into your solution via NuGet.
He may also be running the MS test adapter which you can get from the nunit site

How can I get PEX to auto-generate unit tests?

How I can get PEX to auto-generate unit tests in Visual Studio 2013?
I can auto-generate unit tests with PEX in visual studio 2010 and the menu was found by right clicking in the function body.
We did not release a version for Visual Studio 2013.
The good news is that you can now do that same auto-generation of unit tests in Visual Studio 2015 using the "Smart Unit Tests" feature.
For Visual Studio 2013, they do provide PEX framework (lightweight version) named as CodeDigger.
But CodeDigger is limited that it just generates a table of all the possible combinations of inputs and output.
No options to copy that table or Save any of the test suites.
CodeDigger gives a minimal help. Not so great

Gallio: Cannot run tests because the MSTest executable was not found

I installed the newest Gallio release 3.2.603 on a box without Visual Studio that will be our CI server. The NAnt script successfully built the .Net 4.0 projects but when it tries to run MSTest tests the following error occurs.
[gallio] Gallio NAnt Task - Version 3.2 build 601
[gallio] [error] Assembly XXXXXXXXXXXXXX
[gallio] Cannot run tests because the MSTest executable was not found
Am I wrong to expect that Gallio is able to run MSTest tests without the MSTest executable or any other Visual Studio components installed?
Ok, I got an answer from Gallio support that it actually requires MSTest.exe to be present on the box. I'll test the package that Aseem suggested whether it provides enough stuff to run the tests.
Update: I installed Microsoft Visual Studio Test Agent 2010 from the package. I had to add the string value InstallDir to [HKLM\SOFTWARE\Microsoft\VisualStudio\10.0] and set the value to something like
“C:\Program Files\Microsoft Visual Studio 10.0\Common7\IDE”
Now my CI box runs those tests perfectly.
I dont know anything about Gallio, but just wanted to share that with visual studio 2010, you dont really need visual studio to run MSTest tests. You can simply install test agent (a very light-weight sku) which additionally installs MSTest. This test agent installer can be installed from here.
Confirmed this worked for me. Running Sonar on a box with VS2010. Sonar could not find MSTest until I added this registry value.