简体   繁体   中英

How to run NUnit tests without Visual Studio and Source code?

I am very new to Unit-Testing.

I have a solution with C# project. I added to it a new NUnit project and added some tests.

I can run my tests using Test Explorer of Visual Studio, and even using Command-Line in the developing platform:

D:\Project\GuiTests\bin\Debug\netcoreapp2.1>dotnet test GuiTests.dll

I want to do a similar thing, but on a testing platform, which does not have Visual Studio and the source code.

I want to copy there only the tests folder (ie D:\Project\GuiTests\bin\Debug\netcoreapp2.1) and run the tests using Command-Line.

Is it possible? How can I do that?

Currently, I tried it out and got:

在此处输入图像描述

===

I tried using nunit-console and got this error:

Could not load file or assembly 'nunit.framework, Version=3.10.1.0, Culture=neutral, PublicKeyToken=2638cd05610744eb' or one of its dependencies.

Googling it, seems nunit-console does not support.Net Core.

So I think I should go on with the dotnet test

You can read the documentation of NUnit Console Command Line

The console interface runner is invoked by a command in the form
NUNIT3-CONSOLE [inputfiles] [options]
where inputfiles is one or more assemblies or test projects of a type that NUnit can process and options is zero or more options. Input files and options may be mixed in any order.

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