I'm using VS2013 Professional with Resharper 8.1
I have a project which has all the tests, some of them are made with MSTest and most of them are NUnit tests. However, since I installed Resharper 8.1, the NUnit tests don't run anymore when I click the "Run all tests" button. I have to go to the resharper menu and select Unit Tests -> Run All Tests from Solution. Or if I want to see the coverage, it doesn't work if I click the "Cover all tests with dotCover", I have to go to Resharper -> Unit tests -> Cover all tests from solution.
Here's a screenshot: http://prntscr.com/2bkizm
The BDD folder has 4 SpecFlow scenarios which use MSTest. The Unit Tests folder has NUnit tests, and those aren't run when I click one of those buttons. Do you know why is this happening? I already tried reinstalling an older version of Resharper, but it doesn't work. Thank you!
In Resharper 8.0, the functionality of Run all tests is only to run all tests that are currently in the test session, i.e. the window. If you use Run all tests from solution it creates a new tab with all tests from your solution in it and runs all of those.
Looking at the release notes for 8.1 (http://blogs.jetbrains.com/dotnet/2013/12/resharper-81-goes-rtm-along-with-dotcover-dottrace/) there is no hint that this this functionality will change.
Related
I use ReSharper 10 and NUnit 3.
When I run my tests in Visual Studio all is good. But when I select a single test in ReSharper and run it or debug it then not the selected test is run but all the tests.
The same happens if I select a test in Resharper - Unit Tests - Unit Tests window or if I select it in the code (click on the icon at the left side of the test: http://prntscr.com/a1clt1
All my methods marked with [Test] attribute or [TestCase()] attribute
Is it a bug of ReSharper, of NUnit or maybe it can be set in settings?
Thanks for any help.
Install R# 10.0.2 build (the latest available here), it is fixed there https://youtrack.jetbrains.com/issue/RSRP-450313.
My code has NUnit tests. My colleague is able to run the tests from within Visual Studio on their desktop, however I can't run them on mine. When I try to use Test Explorer and "Run All", it just builds the project. Other options, such as Run Tests and Debug Tests also give the same result.
I have NUnit referenced in my project, why can't I run the tests from within Visual Studio?
Out of the box, Visual Studio doesn't have support for running tests built for the NUnit framework. As has been said in the the comments, your colleague probably has some kind of add-in like Resharper installed which adds in support for running Nunit tests.
If you don't have a license for whatever tool they're using, then you can still have visual studio integrated support for running/debugging NUnit tests by installing the NUnit Test Adapter. This is a free plugin that you can install into your solution via NuGet.
He may also be running the MS test adapter which you can get from the nunit site
I'm trying to create unit tests with resharper, but every time I click "create unit tests" it imports Microsoft.VisualStudio.QualityTools.UnitTestFramework and create MS unit tests. There is no option to use NUnit instead.
I've disabled VisualStudio Testing Support in Resharper
I deleted the MS UnitTest reference, but NUnit does not appear as a reference in the "Add reference" dialog
I've manually added NUnit to my tests project with NuGet
Resharper STILL uses VisualStudio's unit tests and imports the other DLL
Also,
Resharper's website mostly talks about running tests, I do not have any tests yet
I've tried searching but I seem to find information about how to run tests
So, if I have a class library. What are the exact steps I need to take to get Resharper to automatically create NUnit tests? I'm new to NUnit and fairly new to ReSharper so what am I missing?
To use NUnit unit tests do the following:
Add a Visual Studio C# Class Library project (don't use the Unit Test projects as they are designed to work with MSTest)
Add NUnit references via NuGet
An example of the class structure will be:
using NUnit.Framework
namespace MyTest.Tests
{
[TestFixture]
public void MyTests
{
[Test]
UnitUnderTest_Scenario_ExpectedBehaviour()
{
// Test code goes here.
}
}
}
Resharper will decorate your tests with the green and yellow icons, see this and this for more details.
Update: See how Resharper can speed up the creation of unit tests.
I have a project which builds and runs tests in Visual Studio Online. I recently added SpecFlow the the project and wrote a bunch of scenarios, some of which run against a LocalDb database. I was half expecting the tests to fail on VSO, but when I pushed the code up it ran all of my tests and they all passed. When I checked the logs it seems that my Specflow tests were not run.
Is there something I have to do to get the specflow custom tool which generates the actual unit tests to run as part of the build, so that VSO will find the tests after it has built?
Can I run what are effectively integration tests in VSO, creating and destroying databases in my tests?
Ok so this was a bit of a D'oh moment. VSOnline wasn't running my tests because Specflow was building NUnit test. Changing it to build MSTest tests meant that the generated files containing the tests had the correct attributes and VSOnline recognized them and so happily built and ran them.
And using the LocalDb during the tests was fine as well, all worked like a dream.
I've run into a weird problem with Unit Tests in Visual Studio 2010 that I can't solve (is this a bug in Visual Studio?).
If I edit the name of a unit test, it is not updating in the "Test List Editor" view. If I add a unit test using the normal method, it doesn't add it to the list of unit tests.
Any ideas on what might be possibly be causing this, and perhaps brainstorming some method to redo my Unit Test project to fix this problem?
Found the problem: I have ReSharper installed, and it unexpectedly took over the default unit testing framework provided by Visual Studio 2010, when an auto version upgrade took place. I am currently running the unit tests using the ReSharper unit testing plugin, and everything works fine. This is not to say that it's necessarily ReSharper's fault, I did opt in to use the enhanced unit testing framework when I installed it a month ago (and I can opt out by switching it off in options).