ActivityUnitTestCase和ActivityInstrumentationTestCase2的区别区别、ActivityUnitTestCase

2023-09-06 00:07:52 作者:Now let go the handle.现在把手放开吧

我是新来的Andr​​oid仪表案件。我一直在寻找的API样本,发现有时候我们使用ActivityUnitTestCase和ActivityInstrumentationTestCase2。两者之间的区别是什么?什么时候我们使用一个比其他?

I am new to Android Instrumentation cases. i have been looking at the API samples and see that sometimes we use ActivityUnitTestCase and the ActivityInstrumentationTestCase2. What is the difference between the two ? When would we use one over the other ?

推荐答案

请参阅这里讨论的区别: http://www.vogella.com/articles/AndroidTesting/article.html#activity_testing

See the difference discussed here: http://www.vogella.com/articles/AndroidTesting/article.html#activity_testing

要点:

ActivityUnitTestCase可用于测试布局和分离的方法。 ActivityInstrumentationTestCase2可以在需要时发送触摸/鼠标事件,并测试状态管理使用。