运行 来自 Nunit3 的个人测试-console.exe

Run Individual Test from Nunit3-console.exe

当我运行

nunit3-console.exe (myfilepath)\dll file

Console Runner 运行我的所有测试。

我需要 运行 什么命令才能 运行 单独测试?我试过了

nunit3-console.exe  /run:namespace.class.method (myfilepath)\dll file

它说我使用的参数无效。有人可以为我提供正确的语法吗?

谢谢

你想看看 --where command line option to run individual tests or filter your tests. It is new for NUnit 3. The --where option uses the test selection language 有点像 SQL 的测试。

nunit-console --where "method =~ /Source.*Test/ && class =~ 'My.Namespace.Classname'" test.dll

对于简单的过滤器,您还可以使用 --test=NAMES 选项和一个用逗号分隔的简单测试名称列表。

nunit3-console.exe --test=namespace.class.method test.dll

对于 TestCase 和其他数据驱动测试,单个测试的测试名称可能难以确定。如果是这种情况,您可以使用 --explore 选项。