Re: Test/Mock Tools in Go

Smith, Nick A <Nick.a.Smith@...>

FWIW internally we’ve had great success with Testify for mocking and asserts. The test code is generally clean and easy to read.




Nick Smith
Technology Strategist
Tel: +44 1223 703485

Thales eSecurity
One Station Square
Cambridge CB1 2GA
United Kingdom

From: EdgeX-GoLang@... [mailto:EdgeX-GoLang@...] On Behalf Of Trevor.Conn@...
Sent: 07 August 2018 16:49
To: edgex-golang@...
Subject: [Edgex-golang] Test/Mock Tools in Go


Dell Customer Communication

Hi all – I assigned myself an issue yesterday for taking a small piece of the EdgeX core services and refactoring toward greater unit test coverage. I believe that some of the techniques I first introduced to the codebase in the holding repo will be of benefit in this regard. However in order to accomplish that, I need help from mocking tools. At the time I created that holding repo project, I evaluated several tools in the Go ecosystem and the ones I settled on are:


Mockery – Used for creating mock types from interfaces, eliminates writing of boilerplate code.

Testify – Used for implementing test conditions and evaluations within mocked methods


I chose these because they were flexible and seemed to have the least overhead for integration. One of the other ones I looked at was Ginkgo but it seemed like overkill.


I am asking to see if anyone has strong feelings in this area about a particular package. If so, please call it out and I’ll take a look. Otherwise, does anyone have issues with using the above packages?


Trevor Conn

Senior Principal Software Engineer

Dell Technologies | IoT DellTech


Round Rock, TX USA


Join to automatically receive all group messages.