Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
languagebash
go get github.com/smartystreets/goconvey
$


示例

Code Block
languagepycpp
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)
            })
        })
    })
}

然后运行:

...

然后运行:

Code Block
languagebash
goconvey

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

...