How do I install NUnit 3 console on Windows and run tests?

后端 未结 4 389
不思量自难忘°
不思量自难忘° 2021-02-02 08:57

I want to run tests from a console like this (being in any directory, the DLL file can be for a different .NET version):

$ nunit3-console test.dll
4条回答
  •  一整个雨季
    2021-02-02 09:25

    I realize this thread is a bit dated, but here is how I run a specific SINGLE test.

    • install nunit-console (https://github.com/nunit/nunit-console/releases/download/v3.10/NUnit.Console-3.10.0.msi)
    • Open a powershell window and run nunit3-console.exe with "--test" option set to reference the specific test you want to run (including namespace and class). and finally, provide the location of the assembly where the test can be found.

    Example (paths need to be adjusted to point to your specific files):

    & "C:\Program Files (x86)\NUnit.org\nunit-console\nunit3-console.exe" --test=MyApp.Mvc.WebTests.CardsControllerTests.TheNameOfYourTestMethod "c:\src\MyApp.Mvc.WebTests\bin\Debug\MyApp.Mvc.WebTests.dll"
    

    Hope this helps someone.

提交回复
热议问题