【发布时间】:2021-05-04 10:28:52
【问题描述】:
我有一个应用程序在干净的架构中开发,具有多个模块。考虑下面的包结构。
app
src
|--> main
|--> test
|--> test classes that access shared test classes from common-test like mainCoroutineRue
data
src
|--> main
|--> test
|--> test classes that access shared test classes from common-test like FakeDispatcher
common-test
src
|--> main
|--> MainCorotineRule
|--> FakeDispatcher
|--> test
这里是gradle文件代码:
应用程序:
dependencies{
testImplementation project(':common-test')
}
数据:
plugins{
id 'java-library'
id 'kotlin'
}
dependencies{
testImplemenation project(path:':common-test',configuration:'default')
}
普通测试:
plugins{
id 'com.android.library'
id 'kotlin-android'
}
dependecies{
implementation "androidx.arch.core:core-testing:1.1.1"
//test classes
//implementation junit
//impementation coroutine-test
//mockk
}
现在的问题是我能够成功地访问应用程序测试类中的 MainCoroutineRule 等类,但是当我通过编译运行测试时,我无法从 common-test 访问类(即 FakeDispatcher)到数据模块的测试文件夹中它从 common-test 导入正确的类的时间。 它抛出的错误是“未解决的参考” 请告诉我错过了什么?
【问题讨论】:
标签: android kotlin android-gradle-plugin clean-architecture