Neither the integrated test environment nor Resharper won't run any unit tests.
When starting Visual Studio the Test Output Pane shows 10+ lines stating:
An exception was thrown while initializing part "Microsoft.VisualStudio.TestWindow.Controller.TestPlatformProvider".
This is what I've tried so far:
Clear folder %LocalAppData%\Microsoft\VisualStudio\14.0\ComponentModelCache
Create a simple test project with one class library, one class and one test library containing one unit test for that class
Uninstallation and new installation of Visual Studio 2015
All actions didn't fix the problem. Even the simple test won't run.
Running tests from command line using MSTest does work.
Ensure that your anti-virus programs are not quarantining Visual Studio components.
I had this problem when our corporate IT department changed our Sophos Protection Quarantine policy. VS2015 Unit testing stopped working for everyone, with a similar error.
Related
I'm working on a suite of application that interact with many websites and api's. I have created unit tests that test this code.
As it's beyond my control, I want to know as soon as sites / api's change and the code stops working so I can fix and would like to run the tests periodically against the assemblies running. How can I run the tests outside of VS?
I'd like the option of testing on Linux mono too.
You can use MsTest from the command line:
Example:
"C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\mstest" /testcontainer:C:\MyTestProject\bin\debug\MyTestProject.dll /resultsfile:C:\TestResults\results.trx
(Full list of command line switches on the link above)
This is set to Visual Studio 2015, for 2017 just make sure you have the right version number, I believe 15.0
MSTest has been deprecated, you'll want to invoke VSTest from the command line
I've got a really annoying problem with Visual Studio 2013 Professional - I've got two Unit Tests projects - one of them written in C#, and another written in C++. Both of them are standard Visual Studio Unit Tests projects. When I build both of them and turn on Test Explorer window, only C# test methods appears.
Test Explorer doesn't see any of native C++ test method.
First - I tried to rebuild specific project - didn't work. Then I tried to clean 'n rebuild entire solution - also didn't work.
Do you have any ideas how to solve that problem?
UPDATE (SOLUTION) - 03/03/2016
The problem was caused by C++\CLI project in Unit Tests references.
When I remove that project's reference and rebuild unit tests project, everything works fine and Test Explorer detects all of test methods.
Conclusion - something creepy happens when you are trying to test C++\CLI project in native Unit Tests using Visual Studio 2013 default unit tests template project, which is pretty amazing, because it should works - in normal C++ console application works completely fine.
I migrated from Visual Studio 2010 to Visual Studio 2013 Express. In VS2010, the MSTest.exe used to run the tests with NAnt. As in VS2013 no longer has the MSTeste.exe, I'm using VSTest.Console.exe.
The problem is that in a test project, the VSTest.Console.exe reports that test run successfully, but does not terminate or continue the process. It seems that is locked.
In another test project works perfectly. Have rode by NAnt inside VS2013 Express and MS-Dos and got the same error. Because one ends and the other not?
VSTest not working:
vstest.console.exe C:\Daniel\DriveD\dotnet\IntegradorWS\Integrador.Senior.Tests\bin\x86\Release\Integrador.Senior.Tests.dll /Logger:trx
Image for MS-Dos:
VSTest working:
vstest.console.exe C:\Daniel\DriveD\dotnet\IntegradorWS\Integrador.Modelo.Tests\bin\x86\Release\Integrador.Modelo.Tests.dll /Logger:trx
Image for MS-Dos:
Are these Tests also Testing a GUI? Is there a MessageBox or another controll that requires a user interaktion? If yes, you should abstract the Controll, i.e. the MessageBox, into one MessageBox-Adapter thas is easy to be Mocked into your corresponding test.
This question is very similar to this one, but I'm experiencing it in Visual Studio 2010 SP1. I am running my tests locally (there is no remote test controller).
I recently started working on a client's .NET 4.0 project. It has a suite of Visual Studio Unit Testing Framework unit tests. When I launch the unit tests, IIS Express automatically starts. I can run the unit tests dozens of times without any issues to see whether they pass or fail. However, when I attempt to debug the unit tests (by right-clicking on a test in Test View and clicking Debug Selection), it almost always fails with the following error message:
Error 3/19/2014 2:42:44 PM Failed to queue test run 'ThoughtProcess#HOSTNAME 2014-03-19-14:42:40': Process with an Id of [12345] is not running.
I say "almost" because every 20 or so clean starts of VS, it will successfully attach the debugger. But I haven't been able to consistently reproduce this behavior.
I tried the suggestions from the Visual Studio 2012 post, but those didn't work in my situation. Has anyone else encountered this issue?
In the spirit of this xkcd comic, I did find a solution to this issue by installing ReSharper and using its test runner instead of the built-in Visual Studio test runner.
The ReSharper runner consistently and repeatably lets me run and debug unit tests without any issues. I'm still not sure that I understand the underlying cause of why the VS runner can't debug, but hopefully this will save someone else future frustration.
I hope some one has an idea why Ctrl+R, T is not working in VS2013 anymore.
Previously (VS2012) when I hit the shortcut, and I had my cursor in a test, it only runs the test.
At the website of Microsoft it says exactly how I should expect it should work.
It says:
Ctrl + R, then press T
This runs the tests in the current scope. That is, it runs the
current test method, all the tests in the current test class, or
all the tests in the namespace, respectively.
Source: http://msdn.microsoft.com/en-us/library/vstudio/ms182470.aspx#RunTestsFromTestProject
However in VS2013 it runs all the tests in the current file.
When I use the Test Explorer it runs correctly the only selected test...
I have the following extensions installed:
Productivity Power Tools 2013
Xunit.net runner for Visual Studio 2012 and 2013
Chutzpah Test Adapter for the Test Explorer
Chutzpah Test Runner Context Menu Extension
Ok, its a bug in the xUnit testrunner.
I tested with NUnit and it works as expected.
On xUnit.net is a bugreport.
Link: http://xunit.codeplex.com/workitem/9901
Edit:
Issue is solved in version 0.99.2