Resharper problem with unit tests - visual-studio

I'm having a little annoying problem with resharper trying to run my unit tests, using mstest. I can select an individual unit test and run/debug it fine but when I select the parent node to run a bunch of tests, the tests don't run; it just displays pending for a few seconds and then the test goes grey. If I set breakpoints in the tests and try again with the debugger, I get the same result and no breakpoints are hit. Has anyone else experienced this before?

For anyone using VS2012 update 2 (Charlie obviously wasn't when he asked the question, but for anyone else...), then make sure you have R# version 7.1.3 or later. At the time of this writing, the official release is 7.1.2 so you'll have to follow this link to go download it:
http://download.jetbrains.com/resharper/ReSharperSetup.7.1.3000.1964.msi
(as referenced from http://youtrack.jetbrains.com/issue/RSRP-339987)

Try to rebuild your test project/entire solution.
I sometimes have similar problems where the resharper shows tests that I have removed, or doesn't execute tests for new methods in the SUT project. After a rebuild it gets back in sync.

Ran into this problem aswell with ReSharper 5.0.1659 and VS2010. Turns out that the problem lies somewhere in the testrun config files that VS creates when running test the regular VS way. Removed them from both disc as well as references in solution file which solved the problem and I was able to run the tests with ReSharper again.

Related

Visual Studio NUnit tests are not running

We have an issue with our unit tests. At some point, hitting "Run All" started giving us a truncated subset of tests that ran. The others were simply not run, and we have been having to manually run groups and individual tests.
Any recommendations from anyone out there?
Update:
Partial Solve!
So, my first question was early on in my investigation. I had looked for previous solutions and hadn't found anything that worked out.
Some additional details...
This is an Android project using Xamarin and MvvmCross. The problem was a call to .Clear() on an MvxObservableCollection. Apparently the test just wasn't set up properly, and the IoC provider wasn't able to resolve an interface. I solved it temporarily by removing the call to the offending method.
My question now is how to set this up properly. We have a base test class that we are inheriting from MvxIoCSupportingTest, and the required components seem to have been set up correctly, but we were still experiencing this issue. How do we set up our tests so we can use the .Clear and other MvxObservableCollection methods?

How to setup a Jasmine / Chutzpah unit tests project running TypeScript files?

I have tried setting up a unit-tests project to cover front-end code in TypeScript with Jasmine and Chutzpah, but have a hard time figuring out what I'm doing wrong.
I have created a sample ASP.NET projet in which I have extracted and included the default jasmine tests. Pressing F5 opens a browser and makes the tests pass.
I have then converted all the tests to TypeScript and included its definitely typed definitions. Pressing F5 opens a browser and makes the tests pass.
I have finally installed Chutzpah with its Visual Studio extension, but I'm not able to either make the tests pass using the Visual Studio/Resharper Unit Tests window or the default chutzpah console. At this stage, pressing F5 still opens a browser and makes the tests pass.
That's the last step I'm struggling with. For clarity of the discussion, I have setup a sample projet on GitHub to reproduce my problem. I'm sure it must be something really simple but I just cannnot figure it out.
The project can be found at the following location:
https://github.com/springcomp/TypeScript.Jasmine.Chutzpah.Sample
This doesn't really answer the 'Why', I'm still trying to get my head round this myself. However it might get you a bit further forward..
I saw the same behavior when I pulled down your project. If I put the below reference paths in at the top of the PlayerSpec.ts :
///<reference path="../src/Player.ts"/>
///<reference path="../src/Song.ts"/>
///<reference path="../spec/SpecHelper.ts"/>
///<reference path="../Scripts/typings/jasmine/jasmine.d.ts"/>
After this Resharper runs the tests successfully with them passing.
I can't explain why - maybe resharper doesn't use the SpecRunner file for picking up references?

Can ReSharper run unit tests automatically

Is it possible to automatically run unit tests while you work without compiling or running them manually? I am aware that NDepend allows you to do so, but I would prefer to use the ReSharper suite.
This has been available since dotCover 10. See the dotCover documentation for details.
This adds a new panel "Continuous Testing Session" as well as a new status icon in the gutter.
Note that Visual Studio also has this feature, known as Live Unit Testing.
Not possible with Resharper at the moment, you will need something like NCrunch that runs your unit tests continuously in the background, highlighting code that breaks them as you write it and fails your tests.
Edit: At the time of my response it wasn't possible to do this with ReSharper but now in Version 10 it is, see Drew Noakes's answer. You could still give NCrunch a try as it continuously runs your tests in the background even without doing an explicit save.

vs2010 unit tests aborting for no reason

We recently had our TFS 2008 server go down. It was rebuilt with TFS 2010 server. Now, when I selected VS unit tests and run, the first few are marked as "Aborted" and the others are "Not Executed"...
This happens without any input from me.
The unit tests were working fine before the crash.
What could be causing that?
Thanks.
I'm not sure but I have similar problem but on my local machine and with VS 2008. I cannot run some tests and have their status aborted with no reason. In the test run results I only have message "Test host process exited unexpectedly." Seems like with no reason. But I found more info on connect.microsoft.com site. The problem is my code rises StackOverflowException and it prevents the test from running. So fixing this problem heals my tests. Hope somebody it helps.
Unit test result only shows "aborted"/"test run error" for unrecoverable errors
I was getting this same issue, however in my case ALL tests were being skipped, and the error was reproducible on an empty test project, so code was ruled out.
Checking the EventViewer led me to the cause in my case; somehow the C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\QTAgent32.exe.config file had been removed from my machine?!? I copied one from another machine here and I'm back in action.
Same thing happened to me and as Mike said it was because I had a stack overflow exception somewhere in my code. As soon as I fixed the SO exception the problem went away. Finding the SO exception was quite hard, but I just had to step through the code until I finally found a recursive call that would cause an SO.
I suffered a similar problem which stopped me completely.
To get round it, firstly I ran the NUnit test via debug (TEST --> Debug --> All Tests) which allowed me to step through.
The error was related to the use of Entity Framework. If your project under test uses Entity Framework then the NUnit project needs a reference to EntityFramework and EntityFramework.SqlServer (or whichever provider you're using).

easiest way to get continual unit tests running locally with visual alerts, with xUnit for C#/VS2008?

I'm currently using MSTest in VS2008 for unit tests, but I am looking at going to xUnit.net.
Question - What would be the easiest way to get my unit tests running continually locally (on my PC) and with some sort of visual alert of pass / # of fails.
i.e. similar to what we do in Ruby on Rails with autospec.
THanks
PS Intersested in hearing of the simplest open source option too.
You should also ask this on http://xunit.codeplex.com/Thread/List.aspx
There's an xUnit GUI runner and it has an auto-reload when DLLs get touched.
The missing bit is the auto-rerun of the last of executed tests when that happens. The minute we have that, you're just a Shift F6 (compile current project) away from waht you want.
The xunit.net guys are normally quite responsive, and avote on [my] http://xunit.codeplex.com/WorkItem/View.aspx?WorkItemId=8832 would help.
Regarding your other comment - I really believe xUnit.net is worth your effort using. You won't look back.
Resharper's test runner runs within VS, can run just a single test or a whole suite, and appears to support xUnit with a plugin.

Resources