🔥码云GVP开源项目 12k star Uniapp+ElementUI 功能强大 支持多语言、二开方便! 广告
[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 ```