...
Code Block | ||
---|---|---|
| ||
go get github.com/smartystreets/goconvey |
$
示例
Code Block | ||
---|---|---|
| ||
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 | ||
---|---|---|
| ||
goconvey |
打开浏览器 http://localhost:8080 ,就可以直接看到测试的结果了.
...