在项目中组织JUnit测试 [英] Organization of JUnit tests in projects

查看:80
本文介绍了在项目中组织JUnit测试的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您认为在项目中组织JUnit测试的最佳实践是什么?为什么?例如,您是否将测试放在他们测试的类旁边?你把它们放在一个单独但平行的包装结构中吗?您是否完全使用不同的组织策略?

What would you consider best practice for organizing JUnit tests in a project, and why? For example, do you keep your tests next to the classes they test? Do you put them in a separate but parallel package structure? Do you use a different organization strategy entirely?

推荐答案

出于多种原因,我使用单独但并行的包结构。

I use a separate but parallel package structure for several reasons.


  1. 它使测试的组织方式与应用程序代码相同。
  2. 我可以轻松构建应用程序文件以进行分发。
  3. 测试代码仍然可以访问我的应用程序代码。
  4. 将测试代码与应用程序代码混合在一起并不是一团糟。
  1. It keeps tests organized the same way as the application code.
  2. I can easily build just the application files for distribution.
  3. Test code still has access to my application code.
  4. It's not as cluttered as having test code mixed with application code.

这篇关于在项目中组织JUnit测试的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆