Page tree
Skip to end of metadata
Go to start of metadata

介绍

Go convey是go test很不错的一个测试工具,可以直接在浏览器中查看测试结果,也可以查看go coverage等信息。


安装

go get github.com/smartystreets/goconvey


示例

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)
            })
        })
    })
}

然后运行:

goconvey

打开浏览器 http://localhost:8080 ,就可以直接看到测试的结果了.


文档

官方文档,主要看quick-tutorial, Standard Assertions, Custom Assertions.


  • No labels

0 Comments

You are not logged in. Any changes you make will be marked as anonymous. You may want to Log In if you already have an account.