企业🤖AI智能体构建引擎,智能编排和调试,一键部署,支持私有化部署方案 广告
[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 ```