c++ - cppunit:setUp() 和 tearDown()

标签 c++ unit-testing methods attributes cppunit

我使用框架 cppunit 来测试我的类,我想知道方法 TestFixture::setUp()TestFixture::tearDown() 是否被调用TEST_SUITE 的时间或为添加到此套件的每个方法调用它们

最佳答案

方法包装每个单独的测试用例。来自docs :

Each test runs in its own fixture so there can be no side effects among test runs.

关于c++ - cppunit:setUp() 和 tearDown(),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10302054/

相关文章:

unit-testing - 使用新的测试库在dart中设置单元测试的最佳方法是什么?

r - 如何从 R 中的特定包中分离所有对象和方法?

javascript - 如何将嵌套在一个方法中的函数调用到另一个方法中

python - 构造函数及使用方法

c++ - 从链表C++中删除节点

Javascript 测试 stub 全局变量函数

C++:32 位到 64 位迁移

c++ - 我如何对工厂进行单元测试?

c++ - 我对值初始化的尝试被解释为函数声明,为什么 A a(());解决这个问题?

c++ - 在 vector 中存储不同维度的数组