比较的库包括:
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
有疑问加站长微信联系(非本文作者)