测试自动化 2011/06/11 - 3 GTest Samples

0. 杂问杂记

 

1. Sample 3

* Fixture

// The tests share the test fixture in the sense of code sharing, not
// data sharing.  Each test is given its own fresh copy of the
// fixture.  You cannot expect the data modified by one test to be
// passed on to another test, which is a bad idea.

 

test-independency!

 

* SetUp() / TearDown()

All "virtual"

 

Q: Why ?

 

 

* Questions

// The macros for indicating the success/failure of a test
// (EXPECT_TRUE, FAIL, etc) need to know what the current test is
// (when Google Test prints the test result, it tells you which test
// each failure belongs to).  Technically, these macros invoke a
// member function of the Test class.  Therefore, you cannot use them
// in a global function.  That's why you should put test sub-routines
// in a test fixture.

 

What does this mean ?

 

2. Sample 4

3. Sample 5

fixtues for multiple test cases: super Fixture !

 

make错误如下:

 

[root@localhost make]# make -f Makefile-4 clean
rm -f sample4_unittest *.o
[root@localhost make]# make -f Makefile-4
g++ -I../include -g -Wall -Wextra -c ../samples/sample4_unittest.cc ../samples/sample1.h ../samples/sample3-inl.h
g++ -I../include -I.. -g -Wall -Wextra -c /
            ../src/gtest-all.cc
在包含自 ../src/gtest-all.cc:42 的文件中:
../src/gtest.cc:34:25: 错误:calling fdopen:错误的文件描述符
在包含自 ../src/gtest.cc:132 的文件中,
                 从 ../src/gtest-all.cc:42:
../src/gtest-internal-inl.h:65:36: 错误:calling fdopen:错误的文件描述符
在包含自 ../src/gtest-all.cc:48 的文件中:
../src/gtest-typed-test.cc:33:25: 错误:calling fdopen:错误的文件描述符
make: *** [gtest-all.o] 错误 1

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
Base path: /home/dama/demo02_ws Source space: /home/dama/demo02_ws/src Build space: /home/dama/demo02_ws/build Devel space: /home/dama/demo02_ws/devel Install space: /home/dama/demo02_ws/install #### #### Running command: "make cmake_check_build_system" in "/home/dama/demo02_ws/build" #### -- Using CATKIN_DEVEL_PREFIX: /home/dama/demo02_ws/devel -- Using CMAKE_PREFIX_PATH: /home/dama/demo02_ws/devel;/home/dama/demo01_ws/devel;/opt/ros/noetic -- This workspace overlays: /home/dama/demo02_ws/devel;/home/dama/demo01_ws/devel;/opt/ros/noetic -- Found PythonInterp: /usr/bin/python3 (found suitable version "3.8.10", minimum required is "3") -- Using PYTHON_EXECUTABLE: /usr/bin/python3 -- Using Debian Python package layout -- Using empy: /usr/lib/python3/dist-packages/em.py -- Using CATKIN_ENABLE_TESTING: ON -- Call enable_testing() -- Using CATKIN_TEST_RESULTS_DIR: /home/dama/demo02_ws/build/test_results -- Forcing gtest/gmock from source, though one was otherwise available. -- Found gtest sources under '/usr/src/googletest': gtests will be built -- Found gmock sources under '/usr/src/googletest': gmock will be built -- Found PythonInterp: /usr/bin/python3 (found version "3.8.10") -- Using Python nosetests: /usr/bin/nosetests3 -- catkin 0.8.10 -- BUILD_SHARED_LIBS is on -- BUILD_SHARED_LIBS is on -- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -- ~~ traversing 1 packages in topological order: -- ~~ - hello_vscode -- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -- +++ processing catkin package: 'hello_vscode' -- ==> add_subdirectory(hello_vscode) CMake Error at /opt/ros/noetic/share/catkin/cmake/catkin_install_python.cmake:86 (message): catkin_install_python() called with non-existing file '/home/dama/demo02_ws/src/hello_vscode/scripts/hello_vscode_p.py'. Call Stack (most recent call first): hello_vscode/CMakeLists.txt:162 (catkin_install_python) -- Configuring incomplete, errors occurred! See also "/home/dama/demo02_ws/build/CMakeFiles/CMakeOutput.log". See also "/home/dama/demo02_ws/build/CMakeFiles/CMakeError.log". make: *** [Makefile:544:cmake_check_build_system] 错误 1 Invoking "make cmake_check_build_system" failed
最新发布
06-11
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值