在项目中组织 JUnit 测试 [英] Organization of JUnit tests in projects
本文介绍了在项目中组织 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.
- 它以与应用程序代码相同的方式组织测试.
- 我可以轻松构建应用程序文件以进行分发.
- 测试代码仍然可以访问我的应用程序代码.
- 它不像将测试代码与应用程序代码混合那样混乱.
- It keeps tests organized the same way as the application code.
- I can easily build just the application files for distribution.
- Test code still has access to my application code.
- It's not as cluttered as having test code mixed with application code.
这篇关于在项目中组织 JUnit 测试的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文