Groups
Groups
Sign in
Groups
Groups
TopLanguage
Conversations
About
Send feedback
Help
{C++}Google 开源了自己的 C++ 单元测试框架 : googletest
277 views
Skip to first unread message
pongba
unread,
Jul 5, 2008, 12:08:17 PM
7/5/08
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to TopLanguage
via:
http://blog.csdn.net/Solstice/archive/2008/07/05/2615344.aspx
Google 在美国独立日这一天开源了自己的c++测试框架:googletest
http://code.google.com/p/googletest/
这个工具的主要作者是 Zhanyong Wan,他是 Google 测试技术组的软件工程师。
googletest 与 CppUnit 相比,有两个特点:
1. 使用简单,写 test case 不用分成声明和定义两部分,也不用自己注册 test suite。
CppUnit 是从jUnit移植而来,而 C++ 没有 Java 那样的反射机制(和annotation,也没有C#那样的代码元数据 attribute,所以一般需要自己注册各个 test case。虽然 CppUnit 提供了一些宏,但是按照 C++ 成员函数 定义/声明 分离的原则,加一个test case还是得两头改。
而googletest采用了类似CppUnitLite的宏,让写test case就像写一个函数那样简单。
2. ASSERT 种类与信息更丰富。
googletest 中,你写ASSERT_LE(orderAmount, allowedAmount);表明 orderAmount 不大于 allowedAmount。如果这条assert没通过,那么出错信息里不仅有 orderAmount 和 allowedAmount 的值,还会有 "orderAmount" 和 "allowedAmount" 这两个字符串。这是用反射没法做到的,只能用宏实现。
当然,googletest还可以做"死亡测试",即测试那些让程序退出的代码段。googletest 能 fork() 出一个新进程,然后检查新进程的exit status或新进程的死亡原因(kill by signal等)。
另外:Google C++ Coding Standards:
http://code.google.com/p/google-styleguide/
--
刘未鹏(pongba)|C++的罗浮宫
http://blog.csdn.net/pongba
TopLanguage
http://groups.google.com/group/pongba
Lycan. Mao..
unread,
Jul 5, 2008, 8:45:11 PM
7/5/08
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to TopLanguage
太好了,正好不喜欢CppUnit呢,值得一试~~~
On 7月6日, 上午12时08分, pongba <
pon...@gmail.com
> wrote:
> via:
http://blog.csdn.net/Solstice/archive/2008/07/05/2615344.aspx
>
> Google 在美国独立日这一天开源了自己的c++测试框架:googletesthttp://
code.google.com/p/googletest/
pongba
unread,
Jul 6, 2008, 1:13:06 AM
7/6/08
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to pon...@googlegroups.com
2008/7/6 Lycan. Mao.. <
sherl...@gmail.com
>:
太好了,正好不喜欢CppUnit呢,值得一试~~~
Mao兄试完了别忘了写个使用报告啊:)
刘炯
unread,
Jul 6, 2008, 11:06:28 PM
7/6/08
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to pon...@googlegroups.com
不过目前还没有GUI,这点比较可惜……
刘炯(Sharp Mark)
Email:
shar...@gmail.com
Blog:
http://sharpmark.net/
2008/7/6 pongba <
pon...@gmail.com
>:
殷远超
unread,
Jul 7, 2008, 1:27:35 AM
7/7/08
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to pon...@googlegroups.com
GUI不是主要问题,一般来说,自动化测试不需要GUI,即使有人需要,也很容易基于这些接口实现GUI。
问题是现在没有方便VC的工程文件,用configure make 的方式,对win用户不够友好。
殷远超
http://www.yinux.com
2008/7/7 刘炯 <
shar...@gmail.com
>:
zs0723
unread,
Jul 8, 2008, 5:40:24 AM
7/8/08
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to TopLanguage
在Linux GUI中如何标示窗口呢,好像Xwindow没有句柄这个概念吧。
On Jul 7, 1:27 pm, "殷远超" <
yinyuanc...@gmail.com
> wrote:
> GUI不是主要问题,一般来说,自动化测试不需要GUI,即使有人需要,也很容易基于这些接口实现GUI。
> 问题是现在没有方便VC的工程文件,用configure make 的方式,对win用户不够友好。
> 殷远超
http://www.yinux.com
>
> 2008/7/7 刘炯 <
sharpm...@gmail.com
>:
>
>
>
> > 不过目前还没有GUI,这点比较可惜......
>
> > 刘炯(Sharp Mark)
> > Email:
sharpm...@gmail.com
> > Blog:
http://sharpmark.net/
>
> > 2008/7/6 pongba <
pon...@gmail.com
>:
>
> >> 2008/7/6 Lycan. Mao.. <
sherlock...@gmail.com
>:
>
> >>> 太好了,正好不喜欢CppUnit呢,值得一试~~~
>
> >> Mao兄试完了别忘了写个使用报告啊:)
>
> >> --
> >> 刘未鹏(pongba)|C++的罗浮宫
> >>
http://blog.csdn.net/pongba
> >> TopLanguage
>
> >>
http://groups.google.com/group/pongba-
Hide quoted text -
>
> - Show quoted text -
Reply all
Reply to author
Forward
0 new messages