Unit test example in golang ========================== We would like to test user.User.Use(), that method calls an interface Doer. Use gomock to generage mock interface. Besides, there's a lib function call, us gostub to stub that method. There are 2 packages: user and user1, the test cases are wrote with differents test framework. GoMock ====== Use Gomock to Mock interface Convey ====== Use convey to do BDD testing gostub ====== Use gostub to stub variable/function ... But we need to define function as a variable. see lib/lib.go github.com/prashantv/gostub ginko + gomega ============== http://onsi.github.io/ginkgo/#integrating_with_gomock