We have a large .NET solution which now contains a mix of .NET core + .NET Framework + .NET standard projects + Test projects. All use NUnit.
I am attempting to configure our CI pipeline (TeamCity) to run all the tests in the solution (a mix of .NET framework 4.7.2 + .NET Core 2.0 projects).
We currently have a step in TeamCity that uses the NUnit console runner to run all tests that match:
**\Release*.Tests.dll
I have tried to include the .NET Core projects by adding another wildcard:
**\Release\netcoreapp2.0\*.Tests.dll
However that doesn't work - as .NET core projects are not supported by NUnit console runner https://github.com/nunit/nunit-console/issues/364
The suggested fix was to use "dotnet test" for my .NET core projects - however this requires a csproj file to be present. The way our Build is configured, we only include the compiled files in our build artifacts (.dll, .json files from the /Release folder).
After doing some more research - I found that you can use "dotnet vstest" to test binaries.
This is now working well - we use the NUnit console to run 4.7.2 projects and "dotnet vstest" to run our netcoreapp2.0 test projects.
However I want to tidy our process up more - I would prefer to have a single "tests" step for .NET framework + core projects. Also currently we need to manually reference each specific netcore2.0 test dll to run in the .net core tests step. Which means whenever a co-worker adds a new .net core test project they have to remember to edit the settings in teamcity.
I thought that maybe I could just replace the NUnit console step to use "dotnet vstest" for ALL test projects (.NET Framework + .NET Core). However after trying this locally for a .NET framework test project I get the error:
No test is available in C:\Users\****\Documents\dev\***\***\src/Agents/Agents.****.Tests/bin/Release/Agents.*****.Tests.dll. Make sure that test discoverer & executors are registered and platform & framework version settings are appropriate and try again.
I am assuming maybe I need to add test adapters to all of my .NET framework test projects? We currently have 50+ test projects that this would affect.
Before I go down this track - I want to verify whether this a good solution.
I am assuming once NUnit console runner supports .NET core projects, I would want to shift to using that?
What is the best practice for testing an enterprise solution which contains .NET Framework + .NET Core test projects?
Apologies if this issue doesn't belong here - wasn't sure if to post here, or in the console runner repo.