简体   繁体   中英

How to run .net core 2 windows compiled NUnit test cases on Linux?

I have recently created a .Net Core 2 based project on Windows 10 using Visual Studio 2017. I have two class library project, one is for source code and another project is for NUnit test cases of the source code. I built these projects using Visual Studio 2017 and I am able to run test cases using Test Explorer (After installing NUnit Adaptor NuGet package for my test project). Now, I want to test my source code on Linux so, I am finding a way to execute test cases on Linux. I don't want to build the project on Linux again. Can anyone please let me know how to run NUnit test cases on Linux? Can I copy generated DLLs in Linux machine?

Assuming this is a .NET Core test project, you can publish the test project and run the tests on a target system like this:

  • Run dotnet publish -o ..\\tests and copy the contents of the ..\\tests project to the target machine.
  • Run dotnet vstest yourtestproject.dll on the machine to execute the tests.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM