英文: Good unit testing in Go 问题 我一直认为好的单元测试是独立的测试。所谓的“独立”是指当函数'A'使用了函数'B'时,在测试函数'A'时,我们会对函数'B'进行模拟/存根...
Is it possible to have a shared context across unit tests in go test?
英文: Is it possible to have a shared context across unit tests in go test? 问题 我正在使用Go语言实现一个trie树,以此来学...
如何在Go语言中使用反射测试一组函数?
英文: How to test a collection of functions by reflection in Go? 问题 我必须为几个具有相似签名和返回值(一个对象和一个错误)的函数编写单元...
`go test` 文件修改监控用于自动化测试。
英文: `go test` file modification monitoring for automated testing 问题 有没有办法在项目文件被修改时自动运行go test命令? 也许有...
在Go语言中进行测试时,适当的包命名方式是什么?
英文: Proper package naming for testing with the Go language 问题 我看到Go语言中有几种不同的测试包命名策略,想知道每种策略的优缺点,以及应该...
unit testing golang handler
英文: unit testing golang handler 问题 以下是翻译好的内容: 这是我编写的一个处理程序,用于从mongodb中检索文档。 如果找到文档,我们将相应地加载和渲染模板。 如果...
How to run mockgen during build?
英文: How to run mockgen during build? 问题 我开始使用gomock来创建用于单元测试的模拟对象。Gomock要求我使用特定的参数运行mockgen命令,以便为模拟生...
如何对Google App Engine中的Go HTTP处理程序进行单元测试?
英文: How can I unit test Google App Engine Go HTTP handlers? 问题 从Google App Engine Go SDK的1.8.6版本开始,支...
Golang测试在子目录中
英文: Golang tests in sub-directory 问题 你好!你想在Go中创建一个包,并将测试和示例作为子目录放在包中,以保持工作区的整洁。这是可能的,你可以按照以下步骤进行操作: ...
Go中的模拟函数
英文: Mock functions in Go 问题 我对依赖项感到困惑。我想要能够用模拟函数调用来替换一些函数调用。以下是我的代码片段: func get_page(url string) str...
70