从 Nunit3-console.exe 运行单个测试 [英] Run Individual Test from Nunit3-console.exe
问题描述
当我跑步时
nunit3-console.exe (myfilepath)\dll file
控制台运行程序运行我所有的测试.
The Console Runner Runs all my tests.
我需要运行什么命令才能运行单个测试?我试过了
what command do i need to run in order to run individual tests? i tried
nunit3-console.exe /run:namespace.class.method (myfilepath)\dll file
它说我使用了一个无效的参数.有人能给我提供正确的语法吗?
it says that I am using an invalid argument. can someone provide me with the correct syntax?
谢谢
推荐答案
你想看看 --where 命令行选项 运行单独的测试或过滤你的测试.它是 NUnit 3 的新功能. --where
选项使用 测试选择语言 有点像用于测试的 SQL.
You want to look at the --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 which is a little bit like SQL for tests.
nunit-console --where "method =~ /Source.*Test/ && class =~ 'My.Namespace.Classname'" test.dll
对于简单的过滤器,您还可以使用 --test=NAMES
选项,其中包含以逗号分隔的简单测试名称列表.
For simple filters, you can also use the --test=NAMES
option with a simple list of test names separated by commas.
nunit3-console.exe --test=namespace.class.method test.dll
对于TestCase
和其他数据驱动的测试,单个测试的测试名称可能难以确定.如果是这种情况,您可以使用 --explore
选项.
With TestCase
and other data driven tests, the test name for individual tests can be difficult to determine. If that is the case, you can use the --explore
option.
这篇关于从 Nunit3-console.exe 运行单个测试的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!