简体   繁体   English

BOOST.Test中的全局夹具如何工作?

[英]How global fixtures work in BOOST.Test?

I have started using BOOST recently for unit testing. 我最近开始使用BOOST进行单元测试。 Just need one clarification on global fixtures. 只需对全局装置进行澄清。

When it got executed? 它何时执行? ... for each test module, or each test suite or each test case? ...对于每个测试模块,每个测试套件或每个测试用例? Will it be the first before any thing else got executed? 这会是其他事情执行之前的第一个吗?

I am using the BOOST_AUTO_TEST_CASE for writing my tests. 我正在使用BOOST_AUTO_TEST_CASE编写测试。

global fixtures are executed once per module since they are defined at file scope . 全局固定装置每个模块执行一次,因为它们是在文件范围内定义的。 Typically I use them to initialize logging or a database connection should my unit tests need them. 通常,如果我的单元测试需要它们,我会使用它们来初始化日志记录或数据库连接。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM