Warm tip: This article is reproduced from serverfault.com, please click

android-使用ProviderTestCase2测试内容提供者

(android - Testing content providers with ProviderTestCase2)

发布于 2020-11-28 08:32:24

我正在尝试按照此答案中的代码片段测试我的内容提供商

https://stackoverflow.com/a/35680611/12652258

帖子提到Test不能与AndroidJUnit4Runner运行-Test当然必须作为android Instrumented test运行

我该如何实现?

1:在不使用AndroidJUnit4运行程序的情况下运行检测测试?

2:将测试文件放置在项目中的什么位置?测试文件夹还是androidTest文件夹中?

Questioner
Tendai
Viewed
0
Tendai 2020-11-28 18:36:10

我想到了。

你将文件放置在androidTest目录中。

删除注释 @RunWith(AndroidJUnit4::class)

确保你的方法以单词test开头如果你遵循本文中给出的答案,一切都应该正常运行。

https://stackoverflow.com/a/35680611/12652258