Reputation: 1332
I created a project in Visual Studio for unit testing using the nuget package of nunit. The test runs well in Visual Studio using the test explorer, but i Need to run them using the nunit3 console.
My project is very simple I:
I create a class called MyMath.cs with the next code:
namespace NunitDemo
{
class MyMath
{
public int add(int a, int b)
{
return a + b;
}
public int sub(int a, int b)
{
return a - b;
}
}
}
I create a MyTestCase Class with the following code to test MyMath methods:
using NUnit.Framework;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace NunitDemo
{
[TestFixture]
class MyTestCase
{
[TestCase]
public void Add()
{
MyMath math = new MyMath();
Assert.AreEqual(31, math.add(20, 11));
}
[TestCase]
public void Sub()
{
MyMath math = new MyMath();
Assert.AreEqual(9, math.sub(20, 11));
}
}
}
I rebuild my solution and using The test explorer panel I can run my test in Visual Studio without problems.
But I need to run my test using the nunit3-console prompt, So, How Can I generate (Or Where Is) a DLL file to run test from the console o using nunit-gui?
I search inside C:\Users\Manuel\source\repos\ConsoleAppForNunit\ConsoleAppForNunit\bin\Debug but there is not a suitable .DLL
There is a Screenshot of that path:
Upvotes: 1
Views: 2201
Reputation: 13736
From what you describe, you have never installed the NUnit Console application. You can find it in various places...
If you use chocolatey, use the choco command-line utility to install nunit-consolerunner.
If you prefer to have it installed in a project directory, install NUnit.ConsoleRunner from nuget.org. You can do this within visual studio.
You can download the files from the project site at https://github.com/nunit/nunit-console
Upvotes: 1