June 2017
Intermediate to advanced
400 pages
10h 32m
English
This recipe demonstrates how to wire goconvey command into your tests. The Convey keyword basically replaces t.Run and adds additional labels in the goconvey web UI, but it behaves slightly differently. If you have nested convey blocks, they're always re-executed in order, that is, as follows:
Convey("Outer loop", t, func(){ a := 1 Convey("Inner loop", t, func() { a = 2 }) Convey ("Inner loop2", t, func(){ fmt.Println(a) })})
The preceding code, using goconvey command, will print 1. If we would used the built-in t.Run instead, it would instead print 2. In other words, Go t.Run tests are run sequentially and are never repeated. This behavior can be useful for putting the setup code in outer convey blocks, but it's important ...
Read now
Unlock full access