C++/CLI, NUnit and Resharper - nunit

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.

Related

Visual Studio code run Junit from UI?

I have a maven project (archtype quicksetup).
And I have a testcases annotated with #Test.
Is it possible to run the unit test from the Visual Studio Code UI ?
Microsoft finally released an extension for this exact purpose. However the documentation at this point is definitly lacking. I myself did not get it to work up to this point.
https://blogs.msdn.microsoft.com/visualstudio/2017/12/01/announcing-junit-support-for-visual-studio-code/

How to run NUnit tests from inside Visual Studio?

I have downloaded the source for NHiberate 4.0.4 and want to run some of the unit tests. Not sure how to go about doing this. I played around with NUnit several years ago and seem to remember there was a addin for visual studio but couldn't find it. Is there a way to run the NUnit tests from within Visual Studio, similar to the way JUnit works in eclipse?
It's an old question but still deserves a step-by-step, how-to answer with reference to the latest versions of VS (2019) and NUnit (4.0) since NUnit tests won't run in VS 2019 out-of-the-box.
Here's how to set it up:
Install the NUnit 3 Test Adapter extension to VS by selecting Extensions > Manage Extensions from the main menu. Restart VS to complete the installation.
Add a Class Library project to your solution. Right click on the project and select Manage NuGet Packages menu option. Browse for NUnit and install it.
Add a public, non-static class to the project to host your tests. Mark the class with the [TestFixture] attribute. Also, don't forget to add the required using NUnit.Framework directive.
Add a public method to the class and mark it with the [Test] attribute. Repeat with as many methods as necessary.
Build the project and then select Test > Run All Tests from VS main menu. The Test Explorer will pop up and show you the progress and outcomes.
If you are using Visual Studio 2012 or higher, then yes, you can run NUnit tests directly from Visual Studio. I think NUnit Test Adapter
may be what you need. For VS 2013 and higher this may not be necessary - if NUnit Framework is installed and the project references it, anything declared as [TestFixture]/[Test] has a Click to Run icon on the left.
Hope this helps!

Cannot run tests using NUnit Test Runner from SpecFlow feature files

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.

GWT Post build command in Eclipse

I am starting getting used to Eclipse, but I have much more experience with Visual Studio. In Visual Studio it is possible to run auto commands after the build has finished.
Now I am creating a GWT project and several other projects at once in one solution (or workspace) in Eclipse. Some files which are compiled with the GWT project needs to be copied to another location when they have been compiled. I am currently doing this manually and would like to do it automatically. I am not doing it often, since the project works fine in debug mode (...?gwt.codesvr=localhost:9997).
But where is the location for executing a post build command for a GWT project in eclipse? Is it possible?
Just open project properties, choose 'Builders' item and click on 'New...' button.
Good question! I'm using Eclipse since about 2003, and I remember that I also wanted a functionality like that back then. However, I got so used to using ant for any serious build, that I completely forgot about it.
There is some useful ant integration in Eclipse (e.g. the ant view), and if you create your GWT project with webAppCreator you already get a few good ant targets you can build upon.
It would still be nice sometimes to have something more GUI-like to do simple multi-step builds with Eclipse. I haven't found anything like that yet, but it's absolutely possible that it exists, especially as a plugin.

How to run Eclipse launch configurations programmatically?

I'm finding it difficult to phrase this question well, as there are quite a few generic terms (run, configuration, launch, etc.). Here goes:
You can save run configurations in a .launch file. (in the Run Configuration Dialog, under the Common tab, Save as a shared file.
We check these in to SVN. The developers can pass them around, and it helps getting new devs running a working application quicker.
I'd like to check these out as part of our build and use them to programatically run the application, the tests, etc, without spinning up the whole IDE.
What would be the best way to run a .launch file outside of the UI?
Edit: I am trying to unify the tests run on the build server and the IDE. I do not
particularly want to give up integrated debugging, which would be the case with an ant script to run the tests .
This is probably more a problem for integration testing with multiple bundles, or unit testing a whole bundle, where you'd like to mock up extensions.
there is an eclipse plugin built over JUnit, called TPTP. It provides an automation client which can be used to launch the test from eclipse with no gui. maybe it helps
Ant4Eclipse may provide a good starting point on how to do this.
Unfortunately, this is limited to Java Applications and JUnit configurations; I am more interested in PDE applications and Plugin JUnit tests.
I have recently had alot of success building an Eclipse RCP app inside a Hudson CI server using Eclipse Buckminster. It took a bit of doing, but once I setup both features, made my RCP product be based on features, and added the Buckminster query files and the like, it worked. There is a Hudson/Jenkins Buckminster plugin that allowed me to have hudson build the application.
After saving the launch configurations for each test fragment, I created hudson commands to invoke them (yes one line per test fragment unfortunately), but after that I got the automated CI build that I wanted.
You could also use the shell command Eclipse uses. To get it:
Run your program in Eclipse
Go to the "Debug" view
Right-click on the process (probably the second item in the tree) and select "Properties"
Copy shell command and delete the agentlib flag to run in bash
I think you don't need to use the .launch configurations to run the tests. If you build an application using the Eclipse Build System, then you can use the AntRunner application from Eclipse to run your units tests. This doesn't start the whole IDE.
This article describes how to run the tests during your build process. With this process, you use a special "Test" Eclipse and load the plugins you want to test.
Perhaps running the configurations the way you would run your own custom run configurations would help here. It is described in this article.