Google 测试开发几个测试套件

Google Test develop several Test Suites

我想用Google测试框架开发几个测试套件。

所有这些测试套件应共享相同的测试夹具。

我希望每个测试套件都有一个 une .cpp 文件。 cpp 文件之一,包含夹具和测试套件编号 1.

您能否暗示这样做的正确架构?

我为每个 cpp 文件创建了一个测试套件,每个测试套件有一个夹具。代码重复最少。

一个测试夹具旨在为多个测试提供通用代码,这些测试在相同的数据和相同的上下文中运行...如果一个测试套件的特征是给定的上下文,那么每个测试套件一个夹具似乎是相关的。

If you find yourself writing two or more tests that operate on similar data, you can use a test fixture. It allows you to reuse the same configuration of objects for several different tests.