我有一个NUnit项目创建一个控制台应用程序来运行测试。入口点是这样的:指定NUnit测试运行
class Program
{
[STAThread]
static void Main(string[] args)
{
string[] my_args = { Assembly.GetExecutingAssembly().Location };
int returnCode = NUnit.ConsoleRunner.Runner.Main(my_args);
if (returnCode != 0)
Console.Beep();
}
}
我能传递作为参数,如果我想只运行这个测试:
[TestFixture]
public class EmailNotificationTest
{
[Test]
public void MailerDefaultTest()
{
Assert.IsTrue(false);
}
}
这显然是支持的,同样清楚我有不知道该怎么做。
UPDATE
它看起来像V3 +,这是可能的--test
选项,每the documentation。
我没有使用ConsoleRunner,但它可能会尊重'[Explicit]'和'[Category]'属性。 – jrummell
对于那些寻找'nunit3-console.exe'请参阅http://stackoverflow.com/questions/37297838/run-individual-test-from-nunit3-console-exe – KCD