ReSharper failing to run NUnit tests - visual-studio-2010

I am trying to get NUnit working within Visual Studio 2010, using ReSharper's test runner. NUnit version is 2.5.10, and ReSharper's version is 5.1.3000.12.
When I try to run my tests, it throws the following error:
Unit Test Runner failed to load test assembly:
JetBrains.ReSharper.TaskRunnerFramework.TaskException: Could not load file or assembly 'file:///C:\Documents and Settings\Administrator\Local Settings\Temp\jwgjsyeb.0ui' or one of its dependencies. The system cannot find the file specified.
Anybody know if these versions are incompatible? According to this discussion, it they may be incompatible. If so, should I drop my version of NUnit? If so, to what version, and what will I be missing out on? If there's that big a difference, I may consider running my tests outside VS2010.
Or, if they should be compatible, then what other issue may be causing this?
Thanks in advance.

I hit this one sometime last month & got the response below from jet brains. As you can see, the support tech says the last official supported nunit is 2.5.8.
I am actually using r#'s runner with v2.5.9.10348, although I would dearly love to see the it treated as a 1st class citizen and actually maintained to keep in synch with Nunit. I'd go off on a rant again about jet brains greedy release policy, as I did here but ... it probably wouldn't help!
2.5.9 is worth a shot, like I said I use it. 2.5.8, while ancient, is actually 'officially supported' in any event.
Cheers,
Berryl
I'm afraid that ReSharper 5.1.3 doesn't support NUnit 2.5.10 (the last
supported version is 2.5.8 for the R#5.1.3).
ReSharper 6 EAP builds should work fine with the latest NUnit release. You
may download the EAP builds from here:
http://confluence.jetbrains.net/display/ReSharper/ReSharper+6.0+Nightly+Builds.
Please let me know if it helps.
Thank you.
________________________
Alex Berezoutsky,
Support Engineer
JetBrains, Inc.
http://www.jetbrains.com
"Develop with pleasure!"

After some trial and error, the latest version of NUnit I can get to work with ReSharper 5.1.3000.12, is NUnit 2.5.7.
Here is the list of revisions made, starting at the latest stable build, 2.5.10.

Related

How to Configure Specflow 3.0.199 with NUnit 3.11?

I have done this a couple of times before, but it's not working today. Am I missing something?
I want to configure Specflow from the scract, using NUnit and to execute inside Visual Studio.
I've seen many tutorials but they are not working to me :P. I'm trying to use the latest versions.
These are the steps I'm doing on Visual Studio 2017:
Create a test project (.NET Framework)
Install Specflow plugin for Visual Studio (Tools > Extensions and Updates)
Delete reference of MSTests from the nuget packages.
Install SpecFlow 3.0.199
Install NUnit 3.11
Install SpecRun.Runner 3.0.284
After creating a default feature file and generate its steps, when I compile the solution I get this error on CalculatorFeature.feature.cs (the generated file):
It's like those configurations are not compatible. What's going on?
If you have another step by step list, let me know how to configure Specflow with NUnit to run on Visual Studio 2017, please.
For SpecFlow 3 you have to use the MSBuild generation.
To this, follow these two steps:
Add the NuGet package SpecFlow.Tools.MsBuild.Generation with the same version as SpecFlow to your project
Remove all SpecFlowSingleFileGenerator custom tool entries from your feature files.
From https://specflow.org/2019/generating-code-behind-files-using-msbuild/
Background what is happening:
The VS Extension has sometimes problems to find the used SpecFlow version. In that case, it falls back to the SpecFlow version shipped with the extension (which is really old). This version is generating code with now not existing NUnit attributes.
TestFixtureSetUp and TestFixtureTearDown attributes were deprecated for quite some time and were finally removed. They are replaced by OneTimeSetUp and OneTimeTearDown.
Your choices are probably...
Go back to an NUnit version that supports the old attributes.
Get a version of SpecFlow that uses the new attributes.
Find a way to configure SpecFlow and tell it to use the new attributes. Sorry, but this option, which is no doubt the best, is out of my wheelhouse.

An exception occurred while invoking executor 'executor://mstestadapter/v1': Object reference not set to an instance of an object

We are using Visual Studio 2012 and Team Foundation Server 2010 in our project. Since, we are using Microsoft Fakes, we could have not used the started Test functionality of our Team Build 2010, I have created a build activity which invokes VSTest.Console.exe passing the test assemblies. This approach has been working well for us. However, after a recent check-in we are getting the following error when executing Vstest.console.exe
Error: An exception occurred while invoking executor 'executor://mstestadapter/v1': Object reference not set to an instance of an object.
I copied the binary files to my local machine and was able to get the error again. Interestingly, we run a dev build before check-in which runs the same vstest.console.exe with the same parameters and that works correctly. I have got two folders on my machine, for one the call works fine and for other it doesn't. The compiled assemblies look same size and there aren't much differences to suggest.
I tried using Process Monitor but couldn't find anything obvious other than that the process returns with an exit code 1. Does anybody know much about this error? Is there any way I can find out more information from my test run?
Regards,
Hamid
We got to the bottom of the problem. We are using Entity Framework 5.0 and we also have a situation where some of our test assemblies are targeting .Net 4.0 and some are targeting .Net 4.5.
When we are trying to run the tests such that assemblies targeting different versions of .Net framework and using Entity Framework 5.0 are run in the same Test (vstest.console.exe) process, we get this error.
I think this has to do with the way Entity Framework 5.0 ships with two versions (net40 and net45). Once one version of the library is loaded in the process, the other version cannot be loaded and this caused the error.
I had the same error message just now with Visual Studio 2017 using the new MSTest.Framework and MSTest.TestAdapter (to be able to use Live Unit Testing). It turned out I was using multiple versions of those packages in my solution. Consolidating them to the latest version solved the problem.
This is what worked for me:
In Visual Studio, Test -> Test Settings -> Default Processor Architecture -> X64.
Though it might not solve everyone's issue, hope it helps some of you out there.
I have the same error specified in the subject when in the AssemblyInfo of the project is specified the AssemblyAttribute:
[assembly: AssemblyCulture("en")]
If this attribute is present, the run of the unit tests fails.
If I remove this line of code or I remove the en language, the run of the unit tests success.
An exception occurred while invoking executor 'executor://mstestadapter/v2'
I had multiple TestAdapter's and TestFramework's in my BuildAgents Folder, deleting the v1.1.11 versions fixed the issue:
This happened to me recently in VS 2019. Using NuGet to update to the latest versions of MSTest.TestAdapter and MSTest.TestFramework solved the problem for me.
I tried everything on the web to solve this exception. Finally I solved this issue by installing the Update v4 of Visual Studio 2013 (which is that I'm using currently). Hope it helps!
Deleting app.config and packages.config, if exists, and reinstalling Entity framework via nuGet packages works for me.

How change target framework for unit test under VS2010?

In my solution (under VS2008) I have few web projects, few class libraries, unit test project.
It seems like during solution conversion to VS 2010 the target framework for UnitTest projects was changed to .NET 4.0
When I try to change it back (I need to check how system works in .NET 3.5 and compare with current behavior) I am receiving the following error:
Attempted re-targeting of the project has been canceled. You cannot change the specified .NET framework version or profile for a test project.
Why I can't change it? How can I do?
Thanks a lot!
Unfortunately, found a negative answer:
http://connect.microsoft.com/VisualStudio/feedback/details/483939/unable-to-change-target-framework-version-on-unit-test-projects
closed as "Won't fix"
http://connect.microsoft.com/VisualStudio/feedback/details/514130/visual-studio-2010-beta-2-silently-upgrades-mstest-test-projects-to-net-4-0
clase as "by design"
:(
P.S. I like one of the suggested workarounds: don't use MS Test :)

Logging VS2010 unit test results in TFS 2008 not working

The tests appear to run fine after compliation, but the results don't go anywhere. A .trx file is written and indicates all tests passing. Team Build thinks no tests have been executed and gives the dreaded "Partial Success" result. I suspect that TFS cannot publish the trx to the database for some reason...possibly because the VS2010 version of the test results is not backwards compatible with TFS 2008...?
I'm running the build with MSBUILD 4.0 and using version 10 of MSTEST.
I've read that using the previous version of MSTEST (version 9 with VS 2008) could help. I tried this...MSTEST rightly complained that the test assembly was built against a more recent version of the .NET framework.
Anyone else had success with this? What should I try next?
Turns out I didn't have the right Microsoft.TeamSystem assemblies in the GAC. The version 9 assemblies were there but not version 10. This likely is due to VS2010 being uninstalled / reinstalled out of order w/ VS2008 (or something, who knows). A "Repair Installation" setup step solved the problem.
So, it looks like MSTEST 10 can indeed post results to a TFS 2008 datastore. Wee!

Planning to upgrade VS 2005 to VS 2010

I have installed VS 2010 and want to migrate all code written in VS 2005 to VS 2010.
Please note that we do not have VS 2008, all code are in C# 2.0 and Asp.net 2.0 only.
Can anyone please tell me now what all points need to be considered while migrating.
Update:
I have set target framework to 2.0 for all of my Libraries and web projects. It complies without any error!
However, when site opens in IE (Set to default.aspx), it gives me error as below:
InternalXmlHelper.vb(9) : error BC30560: 'ExtensionAttribute' is
ambiguous in the namespace 'System.Runtime.CompilerServices'.
<Global.System.Runtime.CompilerServices.ExtensionAttribute()> _
Keep all the target framework settings to .NET 2.0. This way, there should be no compilation problem at all.
The changes that you should see are the solution and project files only.
Start with known good solutions in source control (and label—you shouldn't need to go back, but easy to add an extra safety net).
Open each solution in VS2010, allow the conversion wizard to do the conversion.
Resolve any issues.
Honestly, if you're just upgrading VS 2010 you don't really need to consider much. Just keep backups (any real SCM product will do) and you're good. You don't have to upgrade your applications' runtime targets at all if you don't want to.
If you're building with CAS policy, you might run into issues with using MSBuild 4.0 to build you 2.0 applications. If you don't know what I'm talking about, never mind.
My advice is to make sure everyone's "checked in" to your source code provider, and run the conversion wizard and see how it goes.

Resources