stretchr/testify

Add command to autogenerate mocks from interfaces

Open

#273 aberto em 12 de fev. de 2016

Ver no GitHub
 (14 comments) (1 reaction) (0 assignees)Go (1.704 forks)batch import
enhancementhelp wantedmockery

Métricas do repositório

Stars
 (25.958 stars)
Métricas de merge de PR
 (Mesclagem média 6d 15h) (2 fundiu PRs em 30d)

Description

The best way to use mock is with a program that will automatically generate the code for the mocks based on the interfaces.

mockery pioneered this approach but has some current limitations such as being unable to generate mocks from interfaces from other packages and incomplete mocks from composed interfaces.

goautocomplete addresses these issues but lacks documentation and reviewing the default behaviour to have less verbose go generate declarations.

Whichever implementation we use as a base, requirements would be:

  • Backwards compatibility once released with testify
  • Support for composed interfaces
  • Hability to generate mocks from the stdlib and other packages
  • Simplicity of use with go generate
  • Default arguments generating mocks follow conventions + arguments to override defaults
  • Generated mocks should have documentation for team mates who don't know much about mock
  • Quick way for packages to generate a package with mocks for their exported interfaces

Will follow up with an initial proposal

Guia do colaborador