NUnit Test Adapter 2 assembly not found - visual-studio-2012

I'm facing with a strange issue with Visual Studio 2012 Update 5.
I have to add Unit tests to an existing project and I have installed NUnit 2 Test Adapter via Tools->Extension Manager.
The intallation works fine and Visual studio is restarted but I cannot find the NUnit assembly to add to my test project.
Where I'm wrong?
Thanks

The adapter is... well, an adapter... It allows you to run NUnit tests within Visual Studio by making them look like tests that VS understands.
In order to write NUnit tests, you have to actually install NUnit. Probably, the simplest way to do that is to use the NUnit nuget package, which will install it into your test project and add the necessary reference.

Related

Dotcover does not resolve dependencies when Resharper does

I have a seperate MSTest project that runs tests against two other c# projects within the same solution. The tests are all MSTests and run succesfully in both the Visual Studio Test Explorer and Resharper (with MSTest set). Both are using my *.testsettings file that specifies the dependencies. Trying to get dotCover to generate coverage results gives me a FileNotFoundException on both the ddls from the referenced projects. This is similar to the exception I got with VS Test Explorer before adding dependencies in the testsettings file. Both dotCover and Resharper have the same test settings in options. Any ideas why dotCover cannot resolve the dependencies when Resharper can?
I've come across the same problem and had to do the following to get Resharper running dotCover again correctly for my solution:
Delete the resharper cache for your solution. It will be located something like :
%LOCALAPPDATA%\JetBrains\Transient\ReSharperPlatformVs14\v09\SolutionCaches\{folder with solution name in it}
Numbers may be different based on which version of Resharper you have (I have 2017.2 Ultimate).
Delete the visual studio solution cache:
{solutionfolder}\.vs\{solutionname}\v14\*.suo
Again, numbers depend on which version of visual studio you have (I have VS2015)
Finally, you may have to give a hint in the test project files to run the correct version of the .net framework. Insert the following into the <configuration> node of your app.config file in your test project(s):
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2"/>
</startup>
Again, your supported runtime depends on which version of the .net framework your project is configured to use (in my case, .net 4.5.2).

Testing.Fakes Exception: Failed to resolve profiler path from COR_PROFILER_PATH and COR_PROFILER environment variables

Test which use Microsoft Fakes Framework fail with exception:
Microsoft.QualityTools.Testing.Fakes.UnitTestIsolation.UnitTestIsolationException: Failed to resolve profiler path from COR_PROFILER_PATH and COR_PROFILER environment variables
VS solution and builds were originally created in VS 2012 and run fine under TFS 2012 build/ controller, but not under TFS 2013. I do have Ultimate VS 2012 and Ultimate VS 2013 installed on TFS 2013 build server. While troubleshooting this issue, I changed test setting in the build definition from using "Visual Studio Test Runner" to "MSTest.exe Test Runner (VS 2010 Compatible)", and now not able to change it back as "Visual Studio Test Runner" is no longer an option in the drop-down of choices. I even replaced build template in TFS 2013 with the one in TFS 2012 but "Visual Studio Test Runner" is still not an option in the drop-down of choices in the build definition Process\Automated Tests section while editing Test Run.
How to solve the problem and get the tests which use Microsoft Fakes to run in TFS 2013 build?
I was having this exact same problem and it turned out that I had a .testsettings file created in my solution and was telling the test runner in the IDE to use it. If you are getting this error in the Visual Studio IDE, verify that you do not have a .testsettings file specified by going under the Test menu -- if there is a .testsettings file specified with a checkmark next to it, click it to remove the checkmark. I suspect the presence of the .testsettings file causes Visual Studio to initialize the test runner differently.
If this is happening on the build server, verify that your build definition does not have a .testsettings file specified; ideally, perhaps remove the file altogether from source control and/or your solution. The presence of this file can trip up a TFS build.
I got the exact same error, but in my case it was a bug in ReSharper 2017.3.1:
https://youtrack.jetbrains.com/issue/RSRP-467796
Already fixed in ReSharper 2018.1

Debugging WatiN UI tests in Visual Studio 2012

I have a solution in Visual Studio 2010 that includes a test project that uses WatiN. It also has a test project with unit tests. Both use NUnit as the framework. I use Gallio to run/debug the tests.
I'm trying out Visual Studio 2012. My project builds fine. I can use the NUnit GUI to run both sets of tests. The Test Explorer lists all tests (unit and UI). I can run/debug the unit tests from within Visual Studio.
When I run the UI tests from within Visual Studio 2012 I get an error:
The CurrentThread needs to have it's ApartmentState set to
ApartmentState.STA to be able to automate Internet Explorer.
The error occurs on the following line in my TestFixtureSetup function:
browser = new IE(...);
I've Googled the error and seen plenty of suggestions about adding lines to the app.config. The odd thing is that I already have those lines.
<sectionGroup name="NUnit">
<section name="TestRunner"
type="System.Configuration.NameValueSectionHandler"/>
</sectionGroup>
...
<NUnit>
<TestRunner>
<!-- Valid values are STA or MTA (Others are ignored) -->
<add key="ApartmentState" value="STA" />
</TestRunner>
</NUnit>
Has anyone gotten WatiN working with the Test Explorer in Visual Studio 2012? Any suggestions for getting it to work? Are there known compatibility issues?
I also tried installing Gallio with the RC and it broke some things that required a bit of effort to fix. I would prefer to use the integrated Test Explorer.
Found a solution here.
I added the following to my AssemblyInfo.cs file:
[assembly: RequiresSTA]
Still outstanding is why doesn't the test runner see the STA settings in the app.config?

How can I fix the conflict between Coded UI Test and MVC Scaffolding in Visual Studio 2012 RC

I'm running Visual Studio 2012 RC (all the latest updates have been installed as of 7/11/2012. I have an asp.net mvc 4 solution with
a Web Project
a Unit Test Project
a Coded UI Test Project
a Web performance and load Test project
When I first created the solution I could add Coded UI Tests with no problem. However, today I tried to create a Coded UI Test and got the following error
The following package failed to load: C:\Users[File Path Goes
Here]\Microsoft.VisualStudio.TestTools.UITesting.dll. Coded UI Test is
now in an inconsistent state. Remove this package and restart Visual
Studio to work with Coded UI Test.
I had a similar problem before with Visual Studio 2010. I still have that problem for that matter.
However, if I uninstall (via NuGet) MVC Scaffolding and T4Scaffolding and restart Visual Studio I can create Coded UI Tests again, but if I add back in the scaffolding packages and restart Visual Studio I get the error again and cannot create the Coded UI test.
It seems that
there is a conflict between the scaffolding packages and Coded UI Tests in Visual Studio
The original error Visual Studio 2010 error has not been fixed in Visual Studio 2012 - Microsoft has acknowledged that this is a bug.
Can anyone help this fan of scaffolding and Coded UI Tests? It would be great to use both technologies without workarounds.
There is no solution to this. The only real workaround is not to use MVC Scaffolding.

How do I integrate Machine.Specifications with ReSharper 6?

I'm using ReSharper 6 and I'm trying to get it to pick up my MSpec tests in the Resharper test runner. Unfortunately I can't seem to get this to work.
I have copied the MSpec dll files (Machine.Specifications.dll and Machine.Specifications.ReSharperRunner.5.1.dll) to the ReSharper plugin directory but it does not seem to find the plugin. When opening the test runner and refreshing no tests are picked up.
I do realize that the test runner plugin is for version 5.1 but ReSharper should at least find the tests in my solution, even if it is not able to run them using the 5.1 runner?
Any suggestions on how to get this to work?
The resharper team just post (July 20th, 2011) a solution about the integration of MSpec in Resharper 6.
Head over there
I don't use Machine.Specifications but I do know you won't be able to use a 5.x compiled plugin with 6.0 because the DLL's have changed a lot
You can run Visual Studio with "devenv.exe /ReSharper.Internal" flag to enable the internal debug menu in Resharper, that might give you a starting point if you were to download MSpec source and attempt to compile with the Resharper 6.0 DLL's

Resources