[英]Should i put unit tests in a separate library? Separate subdirectory?
I have a large library of code which has a few (much too few) unit tests; 我有一个庞大的代码库,它有一些(太少)单元测试; i am adding code to the library, trying to make unit tests for the new code (i also want to add unit tests for old code in future, when i get more experienced). 我正在向库中添加代码,尝试对新代码进行单元测试(我还希望将来为旧代码添加单元测试,当我获得更多经验时)。
We currently use a custom (not very elaborate) unit-testing framework; 我们目前使用自定义(非常精细)的单元测试框架; i would like to switch to boost.test
. 我想切换到boost.test
。
My library layout is: 我的图书馆布局是:
mylib1 (300 files, 70000 lines of code) mylib1(300个文件,70000行代码)
mylib
? UnitTests - 我应该把它移到mylib
外面吗?
mylib2 (70 files, 7000 lines of code) mylib2(70个文件,7000行代码)
UnitTestFramework UnitTestFramework
boost.test
will replace it Asserter.cpp - boost.test
将取代它 boost.test
will replace it TestFixture.cpp - boost.test
将取代它 boost.test
will replace it Asserter.h - boost.test
将取代它 boost.test
will replace it TestFixture.h - boost.test
将取代它 I am asking the following questions here: 我在这里问以下问题:
mylib
DLL? 单元测试应该是mylib
DLL的一部分吗? (I link mylib1
and mylib2
into one DLL) (我将mylib1
和mylib2
链接到一个DLL中) mylib1
directory? 单元测试的源代码应该位于mylib1
目录下吗? mylib1
and mylib2
, how should the corresponding unit-tests be located - in sibling directories, together, etc? 由于我有mylib1
和mylib2
,如何定位相应的单元测试 - 兄弟目录,一起等? mylib1
and mylib2
) (它们同时服务于mylib1
和mylib2
) Actually, I would simplify it even further : 实际上,我会进一步简化它:
+ mylib1 (300 files, 70000 lines of code)
+ unit_tests
+ test_foo.cpp
+ test_bar.cpp
+ mocks
+ mock_foo.hpp
+ mock_bar.hpp
+ foo.cpp
+ foo.hpp
+ bar.cpp
+ bar.hpp
+ mylib2
similar as for mylib1
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.