regex - NUnit 控制台命令行正则表达式不区分大小写?

标签 regex jenkins mono nunit nunit-3.0

我正在 Jenkins/Mono 上运行 NUnit 测试,这就是我的命令:

mono /opt/NUnit-3.8.0/nunit3-console.exe $WORKSPACE/ProjectName/bin/$CONFIG/ProjectName.dll --where="test~=$TEST_NAME" --config=$CONFIG

这个想法是能够使用正则表达式选择测试。现在,我想使用正则表达式选择测试但忽略大小写。我尝试过这样的事情:

TEST_NAME = ^.*(?i)something(?-i).*$

也尝试过:

TEST_NAME = ^.*something.*$/i

但是我收到了“意外标记 '('” 和 “意外标记 '/'” 错误。有没有办法使用不区分大小写的修饰符?

最佳答案

NUnit console runner --where=EXPRESSION 使用特定的 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.

关于regex - NUnit 控制台命令行正则表达式不区分大小写?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51014185/

相关文章:

c# - Mono 上的简单 HttpClient 测试失败

javascript - 使用JS从icalendar文件中读取参数

php - preg_match 名字/姓氏匹配组

python:正则表达式匹配字符串的数字范围

jenkins - launcher.gcr.io/google/jenkins2不会绘制图表

java - Jenkins 使用了错误的 Java 版本

java - 将java字符串转换为键值对

java - Jenkins 生成错误 java.lang.ClassNotFoundException : hudson. remoting.Launcher

C# 单声道 : TypeLoadException when trying to use a DLL reference

c# - 如何在不使用 Unity 协程的情况下在主线程上运行函数