我是Android的新手,我已经看过使用这些注释的示例代码。例如:
@SmallTest
public void testStuff() {
TouchUtils.tapView(this, anEditTextView);
sendKeys("H E L P SPACE M E PERIOD");
assertEquals("help me.", anEditTextView.getText().toString());
}
该注释完成了什么工作?
在评论中,除了Davidann的回答(主要是OP的问题)之外:
在上面的代码的情况下,它实际上DO任何东西,除了休假其他开发人员的说明?它有强制执行吗?是否有任何利用此注释的工具?Android开发的目的是什么?
您可以运行一组用特定注释注释的测试。
运行特定的测试大小,即使用SmallTest或MediumTest或LargeTest进行注释:
亚行外壳工具-w -e size [small | medium | large] com.android.foo/android.support.test.runner.AndroidJUnitRunner
您也可以通过gradle设置这些参数:
android {
...
defaultConfig {
...
testInstrumentationRunnerArgument 'size', 'Large'
}
}
通过gradle:
-Pandroid.testInstrumentationRunnerArguments.size=small
有关更多详细信息,请参阅Doug Stevenson博客文章以及此博客文章。
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句