
但是,如果我想同时进行中小型测试,不仅是小型还是非中型测试,我该怎么办?有这个问题的解决方案吗?
解决方法 根据 InstrumentationTestRunner API doc,这就是AndroID SDK的设计和应该如何工作的方式:Running all small tests: adb shell am instrument -w -e size small com.androID.foo/androID.test.InstrumentationTestRunner
Running all medium tests: adb shell am instrument -w -e size medium com.androID.foo/androID.test.InstrumentationTestRunner
Running all large tests: adb shell am instrument -w -e size large com.androID.foo/androID.test.InstrumentationTestRunner
即使您使用plain adb命令来运行测试,也必须使用两个进程分别运行中小型测试,一个接一个. AndroID Maven插件只是adb命令的另一个包装器,所以没有办法通过androID-maven-plugin配置AFAIK来改变默认行为.
如果你仔细阅读InstrumentationTestRunner API doc,你会注意到有一个有趣的命令用法:
Filter test run to tests with given annotation: adb shell am instrument -w -e annotation com.androID.foo.MyAnnotation com.androID.foo/androID.test.InstrumentationTestRunner
If used with other options,the resulting test run will contain the union of the two options. e.g. “-e size large -e annotation com.androID.foo.MyAnnotation” will run only tests with both the LargeTest and “com.androID.foo.MyAnnotation” annotations.
注释配置作为实验API添加(标记为@hIDe,有关详细信息,请参阅this version history),并且未在am instrument options list中记录.理论上,您可以创建自己的注释类(请参阅SmallTest.java作为示例),标记所有@MediumTest与@CustomizedTest一起使用-e size和-e annotation来实现你想要的:同时从两个注释中运行union测试,所有这些都在一个命令中.
不幸的是,androID-maven-plugin不支持注释配置,请参阅plugin documentation和latest source code.可能的解决方法是使用exec-maven-plugin运行plain adb shell am instrument命令.
希望这是有道理的.
总结以上是内存溢出为你收集整理的android-maven-plugin,instrumentation testing和testSize全部内容,希望文章能够帮你解决android-maven-plugin,instrumentation testing和testSize所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)