[英]Which test to run when using android studio for unit testing
I am working through an android app tutorial course on udacity.com. 我正在通过udacity.com上的android应用程序教程课程学习。 I have come to a lesson where it's introducing testing.
我上了一堂介绍测试的课程。 However, the video for the current class is showing how to run a test where only one
run test
option is available. 但是,当前课程的视频显示了如何在只有一个
run test
选项可用的情况下run test
。 seen here: https://youtu.be/CHb8JGHU290?t=170 在这里看到: https : //youtu.be/CHb8JGHU290?t=170
but my android studio shows a number of options 但是我的android studio显示了很多选项
and I am not sure what is the correct one to use, or even what the differences between them are. 而且我不确定该使用哪种正确的方法,甚至不确定它们之间的区别。 Could anyone shed some light on why I have the 4 different choices and what they are?
谁能阐明我为什么有4种不同的选择以及它们是什么? In particular the first and second options are confusing me.
特别是第一和第二种选择使我感到困惑。 the third and fourth options are intuitive enough to understand.
第三个和第四个选项很直观,足以理解。
Thank you. 谢谢。
The options you are given are: 提供的选项有:
1- Run tests using Gradle: This has been added in version 1.1 of Android Studio, to run tests using Android's build system, Gradle. 1-使用Gradle运行测试:Android Studio版本1.1中已添加此功能,以使用Android的构建系统Gradle运行测试。
2- Run tests using Android JUnit, which will probably require a device/emulator. 2-使用Android JUnit运行测试,这可能需要设备/仿真器。 This is the option to use if you have test cases that make use of Android's test suite, like
AndroidTestCase
, also useful for running more complex and Android-related test cases. 如果您拥有使用Android测试套件的测试用例(例如
AndroidTestCase
,则可以使用此选项,这对于运行更复杂且与Android相关的测试用例也很有用。
3/4 - Run using JUnit framework. 3/4-使用JUnit框架运行。 In your case, the only difference between these options is that the first indicates All Tests available in the project, while the last option offers running all tests existing in the specified package.
就您而言,这两个选项之间的唯一区别是,第一个选项指示项目中所有可用的测试,而最后一个选项提供运行指定包中现有的所有测试。 In your case, probably both options are equivalent.
在您的情况下,可能两个选项都是等效的。
If you are running basic unit tests, I'd definitely stick with the first option. 如果您正在运行基本单元测试,那么我绝对会坚持使用第一个选项。 More details on Android Studio testing here: http://tools.android.com/tech-docs/unit-testing-support
此处提供有关Android Studio测试的更多详细信息: http : //tools.android.com/tech-docs/unit-testing-support
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.