Using the current version of ReSharper (9.1) and NUnit (2.6.4), whenever I right click a feature or step in a feature file and click ReSharper's "Run Unit Tests" it throws an error and says no unit tests found.
I've found if I use the built in MSTest or if use SpecRunner, it works fine, but I lose the features of NUnit.
I can run NUnit tests fine normally, and confirmed that the proper version of NUnit is listed in my SpecFlow config, and ReSharper settings, and everything appears to line up.
Related
I can't find an option to debug xunit Gherkin test in vs code.
using Xunit;
using Xunit.Gherkin.Quick;
When I work with other xunit tests I can run the debugger directly from the test, including step debugging.
But I can't find this option for Gherkin tests.
I am working on a Java application project in NetBeans. I have added JUnit tests, with the #Test annotation. The tests work fine when I run them from the ‘Run Tests’ menu item.
I want to run the same tests from a command-line script. I do not know how NetBeans does this. I want a single command for testing the whole project. How can I achieve this?
Netbeans uses Ant as a build tool, and its default Ant configuration contains a number of useful targets. You can list them with the command ant -projecthelp (executed in your project directory), which should output, amongst other things,
test Run unit tests.
test-single Run single unit test.
test-single-method Run single unit test.
So, simply executing ant test will run all your unit tests on the command line. This will run the tests, write the test results to the standard output, and finish up with a brief summary (including a BUILD SUCCESSFUL message if all the tests passed, or BUILD FAILED if not).
The ant test command will return an appropriate exit code (0 if all tests passed, 1 if any failed), which can be useful -- for example, if you want to add a pre-commit hook to your version control system to forbid commits with failing unit tests.
You should build your project on the command-line with a build tool like Maven, Ant or Gradle and not rely on Netbeans for building it. Please search for this tools.
You should also consider to read a book about software development like Head First Software Development. They explain why and how to us a build tool (e.g. chapter 6 1/2 of Head First Software Development).
I am new to NUnit. When I am run the test cases using NUnit GUI its working perfectly, but when I use Visual NUnit from View->Other Windows->Visual NUnit, only the project is loaded. The Namespace and the Fixture in it are empty. Here is a screenshot:
I had the same issue and manage to resolve it as follows:
Set the NUnit test project as my startup project.
Build the entire solution.
Click the "Run" button without entering a Namespace or Fixture field.
The fields should now become populated.
Hit "Run" again to kick all the tests off.
Say I have an NUnit test project written in C++/CLI, built with the /clr switch. That is, it can reference and use native code, it's not a pure managed assembly.
NUnit can run projects like these, but can this be done from Visual Studio using Resharper? I have R# 5.x, and I can't (can't even see the R# icons by the left edge of the code window to launch the tests). Can the latest version of R# do this?
ReSharper doesn't support C++/CLI, and thus it doesn't show Test icons in the source file. However, it should show tests from output assemblies in Unit Test Explorer (see ReSharper / Windows) and you should be able to right-click project and use Run Tests from context menu.
I'm developing Scala code using Eclipse, often when I run tests I get this error:
No tests found with test runner 'JUnit 3'.
Environment:
Eclipse for Java Developers, 3.5.1
Scala 2.7.7
JUnit 4.7
I'm currently writing my tests as JUnit3 tests, and invoking them by right clicking on a package in the project explorer, choosing Run As -> JUnit Test. (I was writing them as JUnit4 tests but ran into even more problems.)
If I fire up eclipse, the tests may not run unless I first open the source code file for the test. If I do open the source code file for the test, it will run. However, often then when I make any modification to the test file or any other source code file, Eclipse will refuse to run my tests, saying: "No tests found with test runner 'JUnit 3'."
I just repeated this just now:
Open eclipse
Open the .scala file with some tests
Invoke the tests by right clicking on the package for that file in the project explorer and choosing Run As -> JUnit Test
It ran the tests
One failed
I changed a string literal in the failing test to fix it
I then re-launced the test using the same method, and I get the dreaded "No tests found with test runner 'JUnit 3'."
I get this same method using other methods of launching the tests, e.g. JUnit buttons or menus to re-run all or some tests
To get the tests to run again I close and re-open Eclipse... So I end up relaunching Eclipse many many times a day.
Note: I do often use XML literals in my tests, I wonder if that has anything to do with it.
2nd Note: See my answer to this thread: What is the current state of the Scala Eclipse plugin? where I described some of the other problems I'm having with Scala+Eclipse. Most of the problems are just minor annoyances, but this test invocation problem is a real time waster, would love to find a way around it!
This Just works on trunk ... JUnit 3 and 4 unit test are detected and Run As => JUnit test does the right thing.
Oh, and BTW, the best way to get my attention on this sort of thing is to file a bug or enhancement ticket in Trac rather than posting messages to StackOverflow (even though it worked this time ;-)