测试自动化 2011/06/12 - 4 GTest Advanced Guide
来源:互联网 发布:合并财务报表软件 编辑:程序博客网 时间:2024/06/05 14:14
0. 杂问杂记
Unlike TestNG, GoogleTest does not use Exception to report failure/success of a test.
1. More assertions
Focus: to make the error message more readable.
* Exception Assertions
ASSERT_THROW( statement , exception_type );
^ What's this ?
* Predicate assertion
ASSERT_PRED1(pred1, val1);
ASSERT_PRED2(pred2, val1, val2);
* ActionResult
例:
::testing::AssertionResult IsEven(int n)
Q:似乎把测试的写进了生产代码???
* Floating-point comparison(略)
* Type Assertions
2. Assertions placement
You can use assertions in any C++ function. In particular, it doesn't
have to be a method of the test fixture class. The one constraint is
that assertions that generate a fatal failure (FAIL* and ASSERT_*) can only be used in void-returning functions.
Note
: Constructors and destructors are not considered
void-returning functions, according to the C++ language specification,
and so you may not use fatal assertions in them.
3. 输出信息定制
operator << (::std::ostream &os, const T &t);
void PrintTo(const T &t, ::std::ostream *os);
- 测试自动化 2011/06/12 - 4 GTest Advanced Guide
- 测试自动化 2011/06/11 - 3 GTest Primer
- 测试自动化 2011/06/11 - 3 GTest Samples
- 测试自动化 2011-01-04 GTest
- 自动化测试框架GTest安装
- Gtest自动化框架
- TIB自动化测试快讯 -- 自动化测试空间一周精选(2011-12-4)
- Advanced Bash-Scripting Guide:
- Advanced Bash-Scripting Guide
- Advanced Bash-Scripting Guide
- gtest测试MFC项目
- 测试框架之GTest
- gtest 测试框架
- Gtest各种测试示例
- 测试框架之GTest
- GTest测试私有函数
- 《Advanced Bash-scripting Guide》学习(二):测试脚本调用的参数是否正确
- 测试自动化 2011/06/04 - 1
- Gnome3 --failed to load session "gnome-fallback"
- DTD详解
- ssh2 整合 org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in Servl
- 语言(思维导图)
- 快速清除STL::vector的内存
- 测试自动化 2011/06/12 - 4 GTest Advanced Guide
- WAP开发规范1
- display:none和visibility:hidden的区别
- META http-equiv 大全
- 大学男生的魅力养成计划(对体格、内涵、能力、心态的培养)
- 大学男生的魅力养成计划(对体格、内涵、能力、心态的培养)
- JAVA List to Array,Array to List
- 大学男生的魅力养成计划(对体格、内涵、能力、心态的培养)
- WaitForSingleObject函数