英文: How to Mock inner methods in GoLang 问题 你好!以下是翻译好的内容: type test struct { // 几个字段 } func (t *test)...
在调用mockgen的Return Method期间,预期值发生了变化。
英文: Expected value is changed in Return Method of mockgen during its call 问题 我是你的中文翻译助手,以下是翻译好的内容: 我...
Gomock无法将类型map[string]*mockFoo用作map[string]foo。
英文: Gomock cannot use type map[string]*mockFoo as map[string]foo 问题 我正在使用gomock,并且我有这段示例代码需要进行测试。 ty...
如何模拟 net.Interface?
英文: How to mock net.Interface 问题 我正在尝试在Go中模拟net.Interface,我使用net.Interfaces(),并且希望有一个固定的返回值。但是net.In...
gomock缺少调用(s)。
英文: gomock missing call(s) 问题 我正在尝试使用gomock来模拟下面的方法: func (w *writer) Publish(vacancies []model.Vaca...
将模拟数据放在哪个目录?
英文: Which directory to put mocks? 问题 我最近一直在尝试使用Go语言官方支持的测试模拟框架GoMock。我想知道将这些模拟文件放在哪个位置最合理。 我的当前目录结构如...
Golang:如何使用gomock模拟…interface{}参数
英文: Golang: how to mock ...interface{} arguents using gomock 问题 我有一个使用标准go Printf 函数签名的 Printer 接口: ...
如何在Go中测试函数调用的期望结果
英文: How to test call expectation in Go 问题 我有一个名为MyClass的类需要测试。 MyClass有一个void方法,该方法调用内部服务器执行某些操作。 fu...
How to run mockgen during build?
英文: How to run mockgen during build? 问题 我开始使用gomock来创建用于单元测试的模拟对象。Gomock要求我使用特定的参数运行mockgen命令,以便为模拟生...
如何设置模拟函数的返回值?
英文: How do you set the return value of a mocked function? 问题 你可以使用gomock的Return方法来指定模拟方法返回特定的值。以下是一个...
2