ReSharper and NUnit's multiple domains - nunit

I recently had to enable this option in ReSharper:
Use separate AppDomain for each assembly with tests
Looking at the NUnit documentation, I suspect the option above executes NUnit with the parameter "domain/multiple", for which "a separate test domain is created for each assembly".
Could you please confirm me that is true?

Yes, this option corresponds to the /domain=Multiple command line parameter.
Note that ReSharper doesn't use the console runner. Instead it directly links the NUnit assemblies.

Related

Can NUnit console runner pass some command line arguments to nunit-agent?

We use the NUnit console to run our tests in Jenkins and we have many projects that share some tests. We want to be able to run the tests concurrently and to do that we need the tests to look at different databases.
I would like to pass in the project name to the nunit-agent which wouldn't know how to use it, but we would be able to fetch that from the command line arguments running the test and decide which database to look at.
I am open to suggestions.
We currently use "C:\Program Files (x86)\NUnit.org\nunit-console\nunit3-console.exe" Path\Tests.dll --result=nunit-result1.xml to run the tests
nunit-agent uses arguments to pass information that NUnit needs. For passing information to the test, the standard way is to use the --params command-line option and then access the values from your tests by means of TestContext.Parameters.

Using sln.DotSettings in TeamCity dotcover runner

I am using an NUnit 3 runner in a TeamCity 9.1.6 step. I've chosen "JetBrains dotCover" as the .NET Coverage tool, and now I'd like this step to use the xxx.sln.DotSettings file that we've put in source control and that we're sharing across devs in Visual Studio, rather than to duplicate settings to TeamCity Filters, Attribute Filters etc. Is this possible in TeamCity?
It is not possible from the box now. It is a great idea, could you create an issue here https://youtrack.jetbrains.com/
But there is a simple workaround:
you could parse dotSettins manually on the first step
publish configuration parameters using ##teamcity[setParameter name='ddd' value='fff'] TeamCity service message (see for details https://confluence.jetbrains.com/display/TCD9/Build+Script+Interaction+with+TeamCity)
use those configuration parameters in the appropriate fields for dotCover like %ddd%

Does the XML Report Processing work for NUnit3?

I'm currently moving one of our projects to DNX (.NET Core now) and I was forced to update to nunit3. Because of other considerations, we run compile the test project as a console app with its own entry point, basically self-hosting the NUnit runner.
I now need to report the results to TeamCity via the XML Reporter, which doesn't seem to parse Nunit3 TestResults.xml files.
Any advice on how to work around this?
The NUnit 3 console has the option to produce results formatted in the NUnit 2 style.
Use the option:
--result=[filename];format=nunit2
Docs: https://github.com/nunit/nunit/wiki/Console-Command-Line
To add to the answer above:
NUnitLite inherits the --result CLI parameter which seems to do the trick.
Another option, which I went for in the end is using the --teamcity CLI parameter:
dotnetbuild --project:<path to project directory> -- --teamcity
which will integrate with TC's service messages. This will also do real-time updates.

Can I group by full class name my tests on NUnit or MSTest using command line?

The most of my tests uses database integration with NDbUnit and the isolation mode I use is grouping by them full class name.
Now, I need this config runs on command line 'cause I'll use Jenkins CI.
Is there any way to do this?
You can do this on the mstest.exe commandline using /test
mstest /testcontainer:TestProject1.dll /test:TestProject1.Unittest2
This will execute all the tests within the UnitTest2 class.
If you are using nunit-console.exe, then you can by Category. There is documentation on what you can send to the runner here (http://www.nunit.org/index.php?p=consoleCommandLine&r=2.2). You will likely want to use the /include and /exclude flags.

Multiple NUnit test assemblies, each requiring different config. How can I get NUnit to run them all at once?

I have 13 separate but related architecture assemblies, and 13 separate NUnit test assemblies, each one containing all the test fixtures for its matching architecture assembly. I am using NUnit 2.5.2 (latest version currently).
I can run each test assembly separately in the NUnit GUI and all the tests pass. However, when I come to combine them into a single NUnit project file, NUnit insists on applying a single config file to the whole test run. This won't work because each test assembly requires different config. I can't merge them into one "uber-config" file because some of the sections are mutually exclusive. I have tried running each assembly in the project in separate AppDomains, and also separate processes, but in both cases it fails to use the DLL-specific config file, so all the tests crash and burn.
I have done a Google search but so far I have not found any indication that NUnit supports this scenario. Am I right, or have I missed something?
I have tried my hardest to re-architecture the tests so that they could share the same config file, but I've had to admit defeat on that front.
NUnit 2.5 has as setting where you can enable each assembly to run in a separate AppDomain. By doing this, NUnit will load the config for the assembly and not the one for the .nunit project.
For more info, see here:
http://nunit.org/index.php?p=settingsDialog&r=2.5
In the past I've done this with a batch file running each assembly through the nunit console independently. At one point I had something that merged the xml output together. It might be in the CruiseControl.Net code.
I haven't worked on the NUnit project for a while. I only have the older code in my head. But the issue is that you get one config per AppDomain and NUnit loads all the test assemblies into one AppDomain.
You might want to try alternate runners such as Resharper or TestDriven.net