簡體   English   中英

無法在新的Android Kotlin項目上運行Instrumented測試

[英]Failing to run Instrumented tests on a new Android Kotlin project

我剛剛用Kotlin支持創建了一個新的Android應用程序。

當我嘗試運行默認的檢測測試時,它不會運行並向我顯示以下消息:

Class not found: "oussaki.com.pos.ExampleInstrumentedTest"Empty test suite.

這是我正在嘗試運行的Instrumented測試類:

@RunWith(AndroidJUnit4::class) 
class ExampleInstrumentedTest {
    @Test
    fun useAppContext() {
        // Context of the app under test.
        val appContext = InstrumentationRegistry.getTargetContext()
        assertEquals("oussaki.com.pos", appContext.packageName)
    }
}

在此輸入圖像描述

這是一個眾所周知的問題: https//issuetracker.google.com/issues/38452937 ,希望將在下一個版本中修復。

目前您可以手動轉到“編輯配置”並添加要在“Android檢測測試”下運行的特定類/方法的配置。

您也可以嘗試最新的金絲雀版本: https//developer.android.com/studio/preview/index.html但我個人無法讓它與我的項目一起工作。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM