NUnit 控制台命令行正则表达式不区分大小写?
NUnit Console command line regex case insensitive?
我在 运行 Jenkins/Mono 上进行 NUnit 测试,这就是我的命令:
mono /opt/NUnit-3.8.0/nunit3-console.exe $WORKSPACE/ProjectName/bin/$CONFIG/ProjectName.dll --where="test~=$TEST_NAME" --config=$CONFIG
我们的想法是能够 select 使用正则表达式进行测试。现在,我想 select 使用正则表达式进行测试但忽略大小写。我试过这样的事情:
TEST_NAME = ^.*(?i)something(?-i).*$
也尝试过:
TEST_NAME = ^.*something.*$/i
但是我遇到了 "unexpected token '('" 和 "unexpected token '/'" 错误。有没有办法使用不区分大小写的修饰符?
NUnit console runner --where=EXPRESSION
uses a specific test selection language (TSL)
an expression indicating which tests to run. It may specify test
names, classes, methods, categories or properties comparing them to
actual values with the operators ==, !=, =~ and !~.
For matching regular expressions, NUnit users .NET's Regex.IsMatch
method... as described here.
像这样尝试并查看上面链接的 TSL 文档中的示例。
--where "test =~ /(?i).*mytest/"
但是,如果您使用的是 NUnit V2,您可能就不走运了:
The driver for NUnit V2 supports a subset of TSL. Because the V2 NUnit
framework only allowed filtering on test names and categories, you may
only use the cat and test keywords in comparisons. In addition, the
regular expression operators =~ and !~ are not supported.
我在 运行 Jenkins/Mono 上进行 NUnit 测试,这就是我的命令:
mono /opt/NUnit-3.8.0/nunit3-console.exe $WORKSPACE/ProjectName/bin/$CONFIG/ProjectName.dll --where="test~=$TEST_NAME" --config=$CONFIG
我们的想法是能够 select 使用正则表达式进行测试。现在,我想 select 使用正则表达式进行测试但忽略大小写。我试过这样的事情:
TEST_NAME = ^.*(?i)something(?-i).*$
也尝试过:
TEST_NAME = ^.*something.*$/i
但是我遇到了 "unexpected token '('" 和 "unexpected token '/'" 错误。有没有办法使用不区分大小写的修饰符?
NUnit console runner --where=EXPRESSION
uses a specific test selection language (TSL)
an expression indicating which tests to run. It may specify test names, classes, methods, categories or properties comparing them to actual values with the operators ==, !=, =~ and !~.
For matching regular expressions, NUnit users .NET's Regex.IsMatch method... as described here.
像这样尝试并查看上面链接的 TSL 文档中的示例。
--where "test =~ /(?i).*mytest/"
但是,如果您使用的是 NUnit V2,您可能就不走运了:
The driver for NUnit V2 supports a subset of TSL. Because the V2 NUnit framework only allowed filtering on test names and categories, you may only use the cat and test keywords in comparisons. In addition, the regular expression operators =~ and !~ are not supported.