VS11 Dev Preview Unit Test Explorer doesn’t show Unit Tests - visual-studio

I wonder has anyone come across with this issue where the MSTest Unit Test doesn’t show up in the new Unit Test Explorer.
I’m running Windows 7 (32bit). I downloaded the VS11 Developer Preview from the link below. http://www.microsoft.com/download/en/details.aspx?id=27543
I created a sample C# Console App, and add the Test Library from the MSTest project template. Then I created a sample Unit Test, and rebuild the solution. When I open the Test Explorer (View->OtherWindows->UnitTest Explorer) I do not see any tests loaded.
I only see a message saying…
“No test discovered. Please build your project and ensure the appropriate test framework adapter is installed”.
I assume the MSTest adapter is automatically installed. If not I’m not even sure how to install an adapter.
I could be missing something here but I cannot figure it out. Has anyone experiencing this issue?

Found out that at this only works with Windows8. (At this stage)
More info
http://jerssoft.blogspot.com/2011/09/vs11-unit-test-explorer-acercamientos.html#more
(you need to translate to English)
"Of course, all this work the right way if we have properly configured and in the final version , since according to understand, if you want to try this plugin, you need to be working with Windows 8 :) "
http://geekswithblogs.net/lbugnion/archive/2011/09/24/running-unit-tests-in-visual-studio-2011-and-windows-8.aspx

If you are using VS Ultimate version of VS 11 developer preview, then it support MStest based unittesting for Windows7 style apps/projects if that is what you were trying out. It is possible that you are hitting a bug. Will it possible for you to share your repro steps?
Thanks,
Abhishek Agrawal
Program Manager, Visual Studio,
Microsoft Corp

This wasn't working for me using Visual Studio Express 2012 Web RC, but I got it going eventually.
I added the reference to Microsoft.VisualStudio.QualityTools.UnitTestFramework which I found in C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\PublicAssemblies
I made sure this was set to Copy Local but probably not required.
Then I tried cleaning and rebuilding but with no effect. I made sure I didn't have any testsettings selected (Test Menu > Test Settings > Untick the testrunconfig if selected), then changed my Test > Test Settings > Default Processor Architecture to x64 (my machine is x64).
Then I cleaned and rebuilt the solution and my Test Explorer was populated when I click Run All.

Related

Why will Visual Studio 2019 will not run my unit tests?

I am seeing some very strange behavior for NUnit tests in VS2019, where the same solution works fine in VS2017. There are several NUnit test projects in my soultion.
In VS2017 with the NUnit Runner extension installed, I can see all of my tests in the Test Explorer window and the "run all" button will work and run all tests. Some developers in my organization use Resharper instead of the NUnit extension and this works too.
I have stopped using Resharper because as VS introduces more features, Resharper has made it so slow that VS is unusable.
In VS2019 the Test Explorer window will show all of my unit tests (even without the NUnit extension installed). If I click "run all" it will not run any tests and the Output window will say 0 tests discovered. Coworkers have said that Resharper will run all tests without issue. If I right click a single test project and run just those tests, some projects will run tests, but not all.
For some projects I have tried installing the NUnit3TestAdapater nuget package and this will let VS2019 run that project's test if only that project is selected. This does not work for all projects and it still does not work for "run all".
Does anyone know what might be causing this and what could fix it? I have updated to the latest version of NUnit (3.12) and latest TestAdapter (3.16) for all of these projects.
This has been a real pain for about a year, because I need to keep VS2017 and 2019 both installed, and I need to train new developers on how to work around this weird issue.
I stumbled upon the same problem. It seems to me that I have to install more and more with each release.
In my case (Visual Studio 2019 community edition, version 16.6.1), I now also had to obtain the Microsoft.NET.Test.Sdk via NuGet.
So in the end, I have installed three packages in my test project:
NUnit (3.12.0)
NUnit3TestAdapter (3.17.0)
Microsoft.NET.Test.Sdk (16.7.1)
Turning the automated test discovery on or off did not change anything for me though.
Hope this helps anyone.
The solution turned out to be a combination of two things.
On the top menu, navigating to Test > Options and disabling "Discover tests in real time from C# and Visual Basic .NET source files". This option appears to be incompatible with parameterized tests. The problem is that parameterized tests do not "exist" in source code but are generated by the test adapter at runtime. This also fixed an issue I've seen where the "base" test of the parameterized test shows up in the Test Explorer as a not-run test, even though only the specific test cases are real tests. (In my opinion, this should not be enabled by default because parameterized tests are extremely useful, whereas seeing new tests in the Test Explorer without compiling is a trivial convenience since you must compile to run them anyway.)
Using the NuGet package for the test adapter instead of using the VSIX extension. It seems that for this piece, all that is required is that at least one project in your solution references this. If at least one project references it, all test projects can be run. (This makes sense to me, as it is more compatible with build tools outside of Visual Studio.)
Hooray for breaking changes!
I had the same issue and solved by checking the logging.
In Tools->Options->Test->General setting the Logging Level to Diagnostic. This will produce additional output in the Tests Output Pane of the output window.
In my case the issue was linked to missing version of ".NET Core 3.1 Desktop Runtime"
You can download the last version in https://dotnet.microsoft.com/download/dotnet/thank-you/runtime-desktop-3.1.14-windows-x86-installer
In my case I had to install also the Microsoft.NET.Test.Sdk nuget pack.
After none of the above worked for me.
I just installed xunit.runner.visualstudio nuget and everything is working fine now.

Is it possible to open code of specflow scenario (scenario outline) from test explorer in Visual Studio 2013?

I have a specflow scenario, which is a scenario outline with two examples. In Test Explorer window of Visual Studio 2013 I can see it as two separate tests (which is ok), but "Open test" command from context menu doesn't work for them, while it does work for simple specflow scenarios (not "outline" scenarios). Is it somehow possible to quickly open code for such outline scenarios from Test Explorer window in Visual Studio 2013? Or does any other way exist to do that?
P.S. I use SpecFlow integration for Visual Studio 2013
The current version of specflow has some issues mapping code lines for scenario outlines. This pull request has a fix for this and was merged (via this PR) in the vNext branch. I have a version with this fix in it installed and I have just checked and when I choose 'Open Test' or double click on a test in the test explorer I get taken to the scenario line in the test explorer.
In order to use it you'll need to build a version of specflow yourself I thin from the 'v2' branch, at least until a beta version is published on nuget.
In order to use the v2 branch you need to checkout the code and build it. As a result of this you should end up with a nuget package in \SpecFlow\Installer\NuGetPackages\bin\. You will probably want to update the version number in the specflow.nuspec so that you get a proper version number. Once that's done you need to put the nuget package in a folder and then tell visual studio the that folder is a nuget source. Then you can install the nuget package (after uninstalling the old one) and you should be good to go. If it doesn't work then it might be because the extension needs to be updated. Searching the machine for the specflow dlls and replacing them with the newly built versions is probably the best way to go, as the ide integration is a separate package now.
Any other problems let me know, I'll do what I can to help.

Visual Studio 2012 Professional - unit tests not working

After building my application I get in the test output:
------ Discover test started ------
Exception has been thrown by the target of an invocation.
========== Discover test finished: 1 found (0:00:01,457) ==========
I'm using Visual Studio 2012 Professional on win7 32bit.
Tried:
repairing vs2012
reinstalling vs2012
changing configurations
changing path to
Microsoft.VisualStudio.QualityTools.UnitTestFramework.dll
Nothing worked...
Any ideas?
Previously I worked with Visual Studio 2010 Express edition.
Application is correct - I made just simple class library and test project just to be sure it works. And it doesn't. The same project works with my student premium version.
Ok
I looked again in http://connect.microsoft.com/visualstudio and tried also:
moving project files to another location than default
changing security rights in files and folders properties
run vs as administrator
Nothing really worked until i found by chance vs2012 update 1
(under the "Additional Software" category)
After download and installation everything works fine.
In my case, right clicking and selecting "Debug Tests" on a test method would not do anything. It was an existing test project. The issue was that the test project was not even included in the solution's build list. Somebody took it out from the solutions build list. Anytime I would select "Debug Tests", the projects were built but nothing happened.
Confirm that the test project is going to be built with the solution by right clicking on solution in the solution explorer, and then configuration manager. Ensure that the test project is checked-on for build. Those minor things that cause big problems!

the application for project is not installed

I'm opening a solution that was apparently built on Visual Studio 2003 (not sure, I don't know anything about it) and trying to migrate to 2010. When trying to migrate I get the message:
the application for project '' is not installed make sure the application for the project type (.csproj) is installed.
If I open each one of the single projects of the solution they migrate fine but not the solution itself.
Right-click on the project file, then "Reload"
If your solution opens, but your project is showing as "incompatible", it may need to just reload. This worked for me when running an update from VS, and it did not recognize my njsproj
I know this is an old question, but it is still occurring in VS 2013.
I had an old VS 2003 web application. I opened it in VS 2013 (Ultimate) and had the error message:
Could not find the server on the local machine.
Creating a virtual directory is only supported on the local IIS server
along with
The application for project is not installed.
Yes, I am upgrading, and yes, I don't have some other elements ready. Giving me errors is fine - but why are you not completing the migration/load of the project. I can't fix the other issues if you don't LOAD ANYTHING! You loaded the subprojects, and then you told me that I should choose a later .NET Framework. Great, I did that. So why didn't you just finish loading the main project and let me fix the errors?
Lots of attempts to fix this failed. My final solution, just to get the project loaded was {arrow pierces chest, dies with Arghhhhhh on his lips}...
I located the {project}.csproj file. I found the <Reference> sections. The paths to the .NET Framework components were no longer valid and referred to old versions no longer installed (yeah, upgrading, remember?). I manually changed the paths to refer to .NET Framework 4.5 components. The project still didn't load.
Then I located the {project}.csproj.webinfo file. It referred to http://localhost/{stuff}/{project}.csproj, so I just set it to {project}.csproj. No luck. Then I just renamed the webinfo file to hide it. Eureka, the project was hot!
The project loaded, I got the "You have completed the first step in converting your Visual Studio .NET 2003 web project. To complete the conversion, please select your project in the Solution Explorer and choose the 'Convert to Web Application' context menu item." Which, of course, is not present, but is present as the very last item in the Project menu. Then I got the "This action will add designer and code behind files required for converting Web site projects to Web application projects. Do you want to continue?" You bet your posterior I want to continue! And now I have a project I can actually start to fix. Thanks, Microsoft, for the informative error messages.
If your projects individually migrate fine, then create a new blank visual studio 2010 solution, and add new projects individually (right click on solution->add->existing project)
But I'm not sure that your projects will load fine individually. There are project types that require some additional software to be installed in order to be supported. The most frequent problems I face are old projects built with old versions of asp.net mvc (1 or 2) and I have asp.net mvc 3 installed...or really old projects built with asp.net ajax...In those cases, you have to install that additional software and then import project, or find a tool to upgrade that project type to a newer version.
I found a solution that worked for Visual Studio 2017.
In Visual Studio, go to Tools > Extensions and updates. At the upper-right search box, search for "integration". It should come up with Analysis or Diagnostic Tools (or similar). Click Disable, then Enable. Exit the dialog, and close Visual Studio. Relaunch and open your solution again. Your projects will still complain they can't be loaded because of incompatibilities, but now you can right-click them individually and select "Reload Project" and they should load fine.
Credit goes to Paul Potter and Paul Shaughnessy at https://developercommunity.visualstudio.com/content/problem/216061/project-incompatible-application-not-installed.html - I just did the verification work, condensing the information, and delivery :)
Adding this answer as reference for people who landed here for missing ".smproj" file.
This issue can arise due to various project files missing. For me, it was because of ".smproj" file missing which is Project file for SQL Server Analysis Services(SSAS). I re-installed SQL Server Data Tools (SSDT) and restarted the Visual studio.
Originally Answered here
Sometimes the SSIS or SSAS Extension in "Manage Extension" is disabled in the settings and must be Enabled manually. And then restart Visual Studio
It happened to me as wel.
You usualy do really need only to reload project in the solution. But in some cases you maybe:
didn't install SQL Server Data Tools (SSDT) for VS
have to enable SQL Server Data Tools manualy in the Extensions
If you have both things settled then try to reload project again. This happened to me when I moved from VS2019 to VS2022 and extension was somehow disabled.
I am using visual studio 2019 and I was faced with this issue when I reopened my ASP.Net webform App in visual studio after modifying for install SSDT.
this problem happens when Visual studio packages will modify (Especially when SSDT will be installed).
To solve this problem you have to go to you project folder and looking for the folder that named '.vs', this folder is hidden.
Deleting these folder will solve the problem because after that when you will open your project with visual studio, it will create the folder again.
Adding this for those who face issues for SSRS projects in VS2017 from earlier version as this comes up in google search.
In Visual Studio, go to Tools > Extensions and updates. Download the below :
Microsoft Reporting Services Projects
Microsoft RDLC Report Designer
In SSIS 2017, t the upper-right search box, search Microsoft Integration Services Projects.
go to Tools > Extensions and updates.
Enable -"Microsoft Integration Services Projects"
This will help to resolve the issue re-launch the SSIS
For my case, I disabled this extension and turns out, it is needed.
Enabling it resolved my problem.
In VS2019 Before you try any of the above right click the solution and click "Resolve Errors" no kidding that made my tabular model solution being available again.
For me what worked was a variation of #vapcguy solution.
Go to #vapcguy link for Paul Potter and Paul Shaughnessy solution: https://developercommunity.visualstudio.com/content/problem/216061/project-incompatible-application-not-installed.html - I
Follow comment on Paul Potter's post by Albert Romeo
Integration Services Plugin was disabled(as explained before: Goto Tools > Extensions and updates > and search for integration/analysis/reporting and enable application
I had to enable integration services, then reload project. I don't know why since I've been using the same SSIS project several times a week for months.

nunit locking dll

I have been using nunit with visual studio 2010 on a windows 7 64-bit pc.
I am able to open the nunit gui and run my unit tests. If I then change one of the unit tests and try to rebuild, I am getting a file locking error as follows -
Error 1 Unable to copy file "obj\Debug\myProject.Tests.dll" to
"bin\Debug\myProject.Tests.dll". The process cannot access the file
'bin\Debug\myProject.Tests.dll' because it is being used by another
process. myProject.Tests
I have used process explorer to verify that it is the nunit-agent.exe that is locking the dll.
I have noticed via tools > test assemblies that the nunit.exe is running under clr version Net 2.0 and nunit-agent.exe is running under clr version Net 4.0. could that have something to do with the problem? If so, how can I fix it? If not, does anyone have any idea what else may be going on?
Thanks for any thoughts.
I think this has to do with the placement of my test project. Initially, I was putting the nunit test project in a seperate directory from my dll files. I was thinking that I would keep all of my test projects in one centralized location.
I them moved my test project into the same location as my test dlls under my visual studio projects. After that, it seems to be working correctly.
I think this has to do the shadow copy. I read in the nunit group on google that the .net framework will only shadow copy assemblies in the application base or it's subdirectories.
This led me to try creating the nunit test project within my application base and that seemed to work.
Hope that makes sense.
Thanks
I also faced the exact issue, however czuroski's answer did not work for me (although I think that we are in effect talking about the same thing).
What did work for me was to ensure that in NUnit I set the Project Path and Project Base were pointing to the same root application folder under Project -> Edit. I re-saved my existing Nunit project to the same directory as my VS sln file.
Another thing to check is to make sure that Shadow Copy is enabled in Nunit -> Tools -> Settings -> TestLoader -> Advanced -> Enable Shadow Copy
try this, Tools > Settings > Test Loader > Assembly Isolation > Default Process Model > Run tests in a separate process per Assembly.

Resources