Go 语言各种测试库(框架)比较

channel · · 4189 次点击 · 开始浏览    置顶
这是一个创建于 的主题,其中的信息可能已经有所发展或是发生改变。

比较的库包括: 1. testing(标准库) 2. [GoConvey](https://github.com/smartystreets/goconvey/) 3. [testify](https://github.com/stretchr/testify/) 4. [gocheck](http://labix.org/gocheck) 5. [prettytest](https://github.com/remogatto/prettytest) 6. [go-spec](https://github.com/bmatsuo/go-spec) 7. [gospec](https://github.com/orfjackal/gospec) 8. [mao](https://github.com/azer/mao) 9. [zen](https://github.com/pranavraja/zen) 10. [Ginkgo](https://github.com/onsi/ginkgo),依赖 [Gomega](https://github.com/onsi/gomega) ## Assertions/Matchers <table> <tbody> <tr> <th>Name</th> <th>testing</th> <th>Ginkgo</th> <th>GoConvey</th> <th>testify</th> <th>gocheck</th> <th>prettytest</th> <th>go-spec</th> <th>gospec</th> <th>mao/zen</th> </tr> <tr> <td>License</td> <td>BSD</td> <td>MIT</td> <td>MIT</td> <td>MIT</td> <td>BSD</td> <td>MIT</td> <td>BSD</td> <td>Apache</td> <td>MIT/Apache</td> </tr> <tr> <td>Assertions</td> <td></td> <td><a href="http://onsi.github.io/gomega/#provided_matchers">Gomega</a></td> <td></td> <td></td> <td></td> <td>uses gocheck</td> <td></td> <td></td> <td></td> </tr> <tr> <td>Style</td> <td>make your own</td> <td>spec</td> <td>spec</td> <td>assert</td> <td>spec</td> <td>spec</td> <td>spec</td> <td>spec</td> <td>spec</td> </tr> <tr> <td>Equal</td> <td></td> <td>✓</td> <td>✓</td> <td>✓</td> <td>✓</td> <td>✓</td> <td>✓</td> <td>✓</td> <td>✓</td> </tr> <tr> <td>IsSame</td> <td></td> <td>✓</td> <td>✓</td> <td></td> <td></td> <td></td> <td></td> <td>✓</td> <td></td> </tr> <tr> <td>DeepEqual</td> <td></td> <td>✓</td> <td>✓</td> <td></td> <td>✓</td> <td>✓</td> <td></td> <td></td> <td></td> </tr> <tr> <td>True</td> <td></td> <td>✓</td> <td>✓</td> <td>✓</td> <td></td> <td></td> <td></td> <td>✓</td> <td></td> </tr> <tr> <td>False</td> <td></td> <td>✓</td> <td>✓</td> <td>✓</td> <td></td> <td></td> <td></td> <td>✓</td> <td></td> </tr> <tr> <td>Nil</td> <td></td> <td>✓</td> <td>✓</td> <td>✓</td> <td>✓</td> <td>✓</td> <td></td> <td>✓</td> <td>✓</td> </tr> <tr> <td>Empty</td> <td></td> <td>✓</td> <td>✓</td> <td>✓</td> <td></td> <td></td> <td></td> <td></td> <td></td> </tr> <tr> <td>Error</td> <td></td> <td>✓</td> <td></td> <td>✓</td> <td>✓</td> <td>✓</td> <td>✓</td> <td>✓</td> <td></td> </tr> <tr> <td>Implements</td> <td></td> <td></td> <td></td> <td>✓</td> <td>✓</td> <td>✓</td> <td></td> <td></td> <td></td> </tr> <tr> <td>IsType</td> <td></td> <td>✓</td> <td>✓</td> <td>✓</td> <td>✓</td> <td>✓</td> <td></td> <td></td> <td></td> </tr> <tr> <td>StringContains</td> <td></td> <td>✓</td> <td>✓</td> <td>✓</td> <td></td> <td></td> <td></td> <td></td> <td></td> </tr> <tr> <td>StringMatches</td> <td></td> <td>✓</td> <td></td> <td></td> <td>✓</td> <td>✓</td> <td></td> <td></td> <td></td> </tr> <tr> <td>Collection</td> <td></td> <td>✓</td> <td>✓</td> <td></td> <td></td> <td></td> <td></td> <td>✓</td> <td></td> </tr> <tr> <td>Panics</td> <td></td> <td>✓</td> <td>✓</td> <td>✓</td> <td>✓</td> <td>✓</td> <td>✓</td> <td></td> <td></td> </tr> <tr> <td>HasLen</td> <td></td> <td>✓</td> <td></td> <td></td> <td>✓</td> <td>✓</td> <td></td> <td></td> <td></td> </tr> <tr> <td>Matches</td> <td></td> <td>✓</td> <td></td> <td></td> <td>✓</td> <td>✓</td> <td></td> <td></td> <td></td> </tr> <tr> <td>Satisfy</td> <td></td> <td></td> <td></td> <td></td> <td></td> <td>✓</td> <td>✓</td> <td></td> <td></td> </tr> <tr> <td>Within</td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td>✓</td> <td></td> <td></td> </tr> </tbody> </table> https://github.com/shageman/gotestit

有疑问加站长微信联系(非本文作者)

入群交流(和以上内容无关):加入Go大咖交流群,或添加微信:liuxiaoyan-s 备注:入群;或加QQ群:692541889

4189 次点击  
加入收藏 微博
暂无回复
添加一条新回复 (您需要 登录 后才能回复 没有账号 ?)
  • 请尽量让自己的回复能够对别人有帮助
  • 支持 Markdown 格式, **粗体**、~~删除线~~、`单行代码`
  • 支持 @ 本站用户;支持表情(输入 : 提示),见 Emoji cheat sheet
  • 图片支持拖拽、截图粘贴等方式上传