Eri*_*arr 92 java tdd android unit-testing android-espresso
我是Android新手,我看过使用这些注释的示例代码.例如:
@SmallTest
public void testStuff() {
TouchUtils.tapView(this, anEditTextView);
sendKeys("H E L P SPACE M E PERIOD");
assertEquals("help me.", anEditTextView.getText().toString());
}
Run Code Online (Sandbox Code Playgroud)
那个注释有什么作用?
Dav*_*ser 132
这篇博文最好地解释了它.基本上,它是以下内容:
根据Android开发人员博客,小测试应该<100毫秒,中等测试<2秒,大测试<120秒.
有关如何指定运行哪些测试的信息,请参阅此页面(搜索"@SmallTest").
作为Davidann的回答以及评论中主要是OP的问题的补充:
在上面的代码的情况下,它实际上DO除了留下便条让其他开发者什么?它执行什么吗?有没有使用此注释的工具?Android开发的目的是什么?
您可以运行一组使用特定注释注释的测试.
运行特定的测试大小,即使用SmallTest或MediumTest或LargeTest进行注释:
adb shell am instrument -w -e size [small | medium | large] com.android.foo/android.support.test.runner.AndroidJUnitRunner
您也可以通过gradle设置这些参数:
android {
...
defaultConfig {
...
testInstrumentationRunnerArgument 'size', 'Large'
}
}
有关详细信息,请参阅此博客文章.
| 归档时间: |
|
| 查看次数: |
19006 次 |
| 最近记录: |