Boost 测试库使用不同的“参数”运行套件两次
我有一套可以在几种不同模式下运行的测试。除了一些全局配置或夹具配置之外,测试用例代码是相同的。
boost 测试库中是否有某种方法可以实现此目的,而无需为所有单独的测试用例编写包装器?
请注意,这不是命令行开关,它应该是同一执行的一部分。
I have a suite of tests that can be run in a few different modes. Other than some global configuration, or a fixture config, the test case code is the same.
Is there some way in the boost test library to achieve this without having to write a wrapper around all the individual test cases?
Note this is not to be a command-line switch, it should be part of the same execution.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
一元函数测试用例可能就是您想要的。唯一的缺点是它似乎不支持自动注册(可能基于某种工厂函数)。
他们还有 测试用例模板并且确实具有自动注册功能,因此如果配置数量不是太多,则可以通过为每个配置定义类型来滥用它。
编辑:测试用例模板可以使用如下所示:
The unary function test case is probably what you want. The only downside is that automatic registration (could be based on some kind of factory function) does not seem to be supported for it.
They also have test case template and that does have automatic registration, so it would be possible to abuse it by defining type for each configuration if there's not too many of them.
Edit: The test case template could be used something like this: