mono / monodevelop

MonoDevelop is a cross platform .NET IDE
http://www.monodevelop.com
2.84k stars 1.02k forks source link

Define runsettings files #9648

Open LiohAu opened 4 years ago

LiohAu commented 4 years ago

Hello,

I have been searching for a way to provide runsettings file to NUnit tests in VS Mac / MonoDevelop but I could not find any.

I see that in vstest source code that commit handles the "RunSettingsFilePath" csproj parameter : https://github.com/microsoft/vstest/pull/2272/commits/9b6a5f710257ad3c7f385ece5b715d19370ef6c0#diff-47113dd1c77bf6ba6de0bc0ef271845dR34

So I am wondering if vstest is called by MonoDevelop when running NUnit tests...

Any idea or workaround ?

mrward commented 4 years ago

VS Test would be used if your project targets .NET Core. Otherwise it will not be using VS Test.

Also currently the run settings is generated at runtime by MonoDevelop - https://github.com/mono/monodevelop/blob/f3f6dd3b443d7bb57a5f026f128e95385bbff89f/main/src/addins/MonoDevelop.UnitTesting/MonoDevelop.UnitTesting.VsTest/VsTestAdapter.cs#L62

You may be able to workaround this with a custom execution mode, and pass all parameters to vstest directly. Otherwise you would likely just have to fallback to using the command line.

LiohAu commented 4 years ago

If I understood correctly, my .csproj is using the .NET Core syntax with that : <Project Sdk="Microsoft.NET.Sdk"> But I am running with net461 so I use mono instead of .NET Core at runtime and if I follow what you say, VS Test is not used right ?

And so this GetRunSettings() call, is not used in my case since i'm not using .NET core, right ?

mrward commented 4 years ago

It depends. Looking at the code if it finds a PackageReference that contains NUnit, which you likely do have, then it will not use VS Test but uses the built-in NUnit support.