android源代码中的测试有什么用?
如果您下载了任何 Android 源代码,您将看到几乎所有应用程序和基本框架都存在一个测试文件夹。
我想知道我们在从源代码构建sdk的同时是否也构建了测试代码,或者仅供我们参考。
如果是后者,最好的使用方法是什么?请向我发布 Android 源代码中存在的测试的确切用途。
If you have downloaded any android source code, you would see a test folder present for almost all applications and base framework.
I wanted to know whether we build the test code too while building the sdk from source code, or is it just for our reference.
If it is for the latter, what is the best way to use it? Please post me the exact use of tests present in android source code.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
当您构建源代码时运行测试时,测试不会自动运行。但是,如果需要,您可以手动运行它们。
如果您想执行此操作,命令应该是:
请参阅此线程以获取更多信息:
http://groups.google.com/group/android-platform/ browser_thread/线程/a0eec9692f5072ba
The tests don't get automatically run when you run when you build the source. However, you can run them manually if you want.
If you want to do this, the commands should be:
See this thread for a bit more information on this:
http://groups.google.com/group/android-platform/browse_thread/thread/a0eec9692f5072ba
(单元)测试可能只是为了让扩展源代码的任何人都可以确保更改不会引入意外行为。它还传达了这样的信息:谷歌遵循良好的软件开发实践并测试他们的代码,而不仅仅是最终结果。
以上所有内容都没有下载源代码,只是分析了您所看到的内容的描述。
编辑:当然,删除测试当然没有意义,因为它们同样是开源的。如果文档不清楚,它们还可以帮助开发人员了解预期的行为是什么。
The (unit)tests are probably there simply to make it possible for anyone extending the source to make sure the changes don't introduce unexpected behavior. It also sends the message that Google follows good software development practices and test their code and not just the end result.
All of the above said without having downloaded the source but just analyzed your description of what you see.
Edit: Of course, there is of course no point in removing the tests as they are equally open source. They could also help developers understand what the expected behavior is if the documentation isn't clear.