Skip to content
New issue

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

缺少基于 MockMvc 的 Controller 级单元测试示例 #488

Closed
DevDengChao opened this issue Apr 25, 2024 · 2 comments
Closed

缺少基于 MockMvc 的 Controller 级单元测试示例 #488

DevDengChao opened this issue Apr 25, 2024 · 2 comments
Assignees
Labels
question Further information is requested

Comments

@DevDengChao
Copy link
Contributor

碰到问题,请在 https://github.com/YunaiV/ruoyi-vue-pro/issues 搜索是否存在相似的 issue。

不按照模板提交的 issue,会被系统自动删除。

基本信息

  • ruoyi-vue-pro 版本:6f42da1b master-jdk21
  • 操作系统:win
  • 数据库:MySQL

你猜测可能的原因

不相关

复现步骤

  1. 访问 https://doc.iocoder.cn/unit-test/
  2. 文章中只提到了如何对不依赖 Spring 环境的类进行 Mockito 测试以及如何对 Spring 环境中的 Service 对象进行 Mock 测试, 没有提及如何进行 Controller 对象的 MockMvc 测试.

报错信息

不相关

改进建议

建议补充少量 Controller 的 MockMvc 测试用例, 至少要包含管理员和会员两种身份各访问一个 API 的用例.
以便服务端开发者能站在客户端的角度上对服务进行单元测试.

参考: https://spring.io/guides/gs/testing-web

@YunaiV
Copy link
Owner

YunaiV commented Apr 28, 2024

参考 OAuth2OpenControllerTest

mockmvc 我们不会投入太大精力哈

@YunaiV
Copy link
Owner

YunaiV commented Apr 28, 2024

= = roi 不太高哈。

@YunaiV YunaiV self-assigned this Apr 28, 2024
@YunaiV YunaiV added the question Further information is requested label Apr 28, 2024
@YunaiV YunaiV closed this as completed Apr 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants