[英]how to organize test cases with boost::test library?
I have a project of 50+ .H/.CPP
files/classes. 我有一个50 +
.H/.CPP
文件/类的项目。 I would like to test every class with its own test case, which will include methods for testing of different aspects of every class. 我想用自己的测试用例来测试每个类,其中包括用于测试每个类不同方面的方法。 My classes are located in different directories, like this:
我的班级位于不同的目录中,如下所示:
/project
/include
/SuperModule
Foo.h
Foo.cpp
..
Alpha.h
Alpha.cpp
..
/test // I assume that my tests shall be here
main.cpp
Makefile
I would like to use boost::test as a unit-testing framework. 我想将boost :: test用作单元测试框架。 How should I organize my files, how shall I name them, etc. Some hint or a link or a suggestion will be appreciated.
我应该如何组织我的文件,如何命名它们,等等。一些提示,链接或建议将不胜感激。 Thanks.
谢谢。
We are using boost::test in a similar layout. 我们在类似的布局中使用boost :: test。 Our layout is -
我们的布局是-
/project
/include
/SuperModule
/Foo
foo.c
foo.h
/foo_unittest
foo_unittest.c // note - no separate header file is required
// for boost::test unit test.exe program.
Basic layout rule is to put the unit test for a class in a sub-directory named "foo_unittest" after the class in the same directory as the source code. 基本的布局规则是将类的单元测试放在与源代码位于同一目录中的类之后的名为“ foo_unittest”的子目录中。 The advantage to this naming is
这种命名的优点是
As our projects are not overly complex (30-50 major classes), this system works for us. 由于我们的项目不太复杂(30至50个主要课程),因此该系统对我们有效。 If you are running larger projects, I don't think this would be an optimal solution.
如果您正在运行较大的项目,我认为这不是最佳解决方案。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.