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.
Related
using Visual studio 2017 community 15.6.4
Resharper 2018.2 with dotcover 2018.2.3
What I did :
Create a Universal Window UnitTestProject App.
Reference in there, via nuget, the following packages :
Nunit
Nunit3TestAdapter
Then I create a NUnit Test function in the TestClass :
[Test]
public void NunitTest()
{
}
I compile the sln And then ask Resharper to list my tests.
It returns nothing, and there is no Test-shortcut icon in front of my test function.
How can I have Resharper discover the NUnit tests in a UWP Application or library ?
Note : visual studio Test explorer finds and runs the sample MStest function that was created in the Test App. It also displays my NUnit test, but can't run it (error : No test is available in entrypoint\UnitTestProject1.exe. Make sure that test discoverer & executors are registered and platform & framework version settings are appropriate and try again.)
According to the issue on the NUnit repo on GitHub, NUnit does not support UWP.
I use in my project SpecFlow to provide automation testing of web-site(with Selenium). I want create end-to-end test suite for provide full checking of project according to BDD. When I create tests playlist in test explorer in Visual Studio and start all tests in playlist all my tests launch according to their alphabetic name. But when I restart project and start this playlist newly all my tests launch in the wrong order. I think, that this problem may be because of rebuild playlist file, but I'm not sure. Could You help me, please?
TestRunner - MSTest
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.
I have a Silverlight client project Project.Client employing strong use of MVVM with Caliburn Micro, however there's lots of calculations in the ViewModels that I see fit to unit test.
I would like to create a Project.Client.Test unit test project which references Project.Client and have its test results appear in Test Explorer (and not test results showing in a web page).
I installed NUnit 3 with the runners and adapters however I cannot see unit tests in Visual Studio 2013's Test Explorer. Is there a way to do that?
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.