【问题标题】:How to run tests in androidTest module?如何在 androidTest 模块中运行测试?
【发布时间】:2022-09-28 13:54:36
【问题描述】:

在我的build.gralde.kts 中有一个模块描述

        val androidTest by getting {
            dependencies {
                implementation(kotlin(\"test-junit\"))
                implementation(AndroidTestDependencies.junit)
            }
        }

但在项目层次结构中,它看起来与 commonTest/commonMain 等不同。此外,由于某种原因,我无法在此模块中运行测试。可能是什么问题呢?

    标签: unit-testing junit kotlin-multiplatform


    【解决方案1】:

    您可以尝试像这样设置junit依赖项:

    val androidTest by getting {
        dependencies {
            implementation(kotlin("test-junit"))
            implementation("junit:junit:4.13.2")
        }
    } 
    

    就我而言,它工作正常

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-09-16
      • 1970-01-01
      • 2019-11-07
      • 1970-01-01
      • 2017-01-24
      • 1970-01-01
      相关资源
      最近更新 更多