多应用+插件架构,代码干净,二开方便,首家独创一键云编译技术,文档视频完善,免费商用码云13.8K 广告
[TOC] > https://github.com/smartystreets/goconvey ## 概述 ![](https://img.kancloud.cn/c8/6f/c86f6799ab699b7ff8dac257d9097020_2874x1446.png) ## 安装 1. 安装命令行 ``` go install github.com/smartystreets/goconvey ``` 2. 项目中安装 ``` go get github.com/smartystreets/goconvey ``` ## 示例 ``` package package_name import ( "testing" . "github.com/smartystreets/goconvey/convey" ) func TestSpec(t *testing.T) { // Only pass t into top-level Convey calls Convey("Given some integer with a starting value", t, func() { x := 1 Convey("When the integer is incremented", func() { x++ Convey("The value should be greater by one", func() { So(x, ShouldEqual, 2) }) }) }) } ``` 在项目中执行,执行结果就可以在网页中查看 ``` $GOPATH/bin/goconvey ```