We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
我看了一下代码,每个controller里代码都是直接调models.XXX(),例如models.GetMerchantByPhone(userName)。请问用Golang开发的项目是不是基本的单元测试都不用写?controller层的代码直接依赖models.XXX()方法,UT时如何对models.XXX()进行Mock呢?
The text was updated successfully, but these errors were encountered:
按照正规的系统开发流程,单元测试是需要的,特别是一些核心的函数模块。很多时候开发,特别不是很庞大的系统,看开发团队的习惯和项目leader的要求。有些是直接用业务来测试,我这个是业余时间写的,没有那么多充足的时间,但是大部分都是经过了业务测试的。
Sorry, something went wrong.
感谢回复!没时间写单元测是可以理解的,但controller层代码直接调用models.XXX()方法,如果以后想写单元测试的话,models.XXX()不方便mock。可以考虑把models.XXX()通过interface来解耦。
好的,谢谢指导
No branches or pull requests
我看了一下代码,每个controller里代码都是直接调models.XXX(),例如models.GetMerchantByPhone(userName)。请问用Golang开发的项目是不是基本的单元测试都不用写?controller层的代码直接依赖models.XXX()方法,UT时如何对models.XXX()进行Mock呢?
The text was updated successfully, but these errors were encountered: