c++ - 运行单元测试,不包括 Catch2 中的特定标签
问题描述
我可以根据Catch2中的特定标签“不匹配”运行测试用例吗?
TEST_CASE("Check the data validity","[Working]"){
REQUIRE(true);
}
TEST_CASE("Check the input","[InProgress]"){
REQUIRE(true);
}
TEST_CASE("Validate the response","[NotWorking]"){
REQUIRE(false);
}
[NotWorking]
在我完成实现该功能之前,我想调用不属于标记的测试用例。
解决方案
来源:https ://github.com/catchorg/Catch2/blob/master/docs/command-line.md#specifying-which-tests-to-run
测试用例示例:
thisTestOnly Matches the test case called, 'thisTestOnly'
"this test only" Matches the test case called, 'this test only'
these* Matches all cases starting with 'these'
exclude:notThis Matches all tests except, 'notThis'
~notThis Matches all tests except, 'notThis'
~*private* Matches all tests except those that contain 'private'
a* ~ab* abc Matches all tests that start with 'a', except those that
start with 'ab', except 'abc', which is included
所以在你的情况下添加到命令行:
exclude:NotWorking
或者
~NotWorking
推荐阅读
- visual-studio - Visual Studio 在键盘上运行缓慢、键盘滞后以及从键盘输入中随机复制击键
- linux - 如何使用 bash 写入除现有常规文件之外的任何文件?
- javascript - 如何使用本机元素访问嵌套的 shadow-dom Ionic 角度
- java - 计算字符串中字符的频率(Java,Performance)
- java - 如何识别 GUI 应用程序中的 java swing 按钮并在 eclipse 中使用另一个 Java 代码单击该按钮?
- node.js - NodeJS - 不同模式的 JSON 源数据文件
- pandas - 如何从熊猫数据框中删除特定的重复列,只留下一个实例
- python - 使用 Pycharm 错误设置 Anaconda
- java - 尝试在另一个类中使用 Paint 方法时出现 NullPointerException
- css - 父级的 100% 宽度不采用边框宽度