Android Studio 中的 Kotest 单元测试实现

问题描述

我是单元测试的新手,我正在开发一个 Kotlin 项目,所以我认为使用基于 Kotlin 的框架会很棒。

我在向项目添加依赖项时遇到问题。如果 Kotest 可以在 Gradle

添加以下依赖,运行程序没有检测到“任何可运行的方法”:

testImplementation 'io.kotest:kotest-runner-junit5:4.6.1'
testImplementation "io.kotest:kotest-assertions-core:4.6.1"

我的单元测试代码如下:

package com.consumerfinance.Nowpay

import io.kotest.core.spec.style.AnnotationSpec
import junit.framework.Assert.assertEquals


/**
 * Example local unit test,which will execute on the development machine (host).
 *
 * See [testing documentation](http://d.android.com/tools/testing).
 */

class ExampleUnitTest : AnnotationSpec() {

    @Test
    fun addition_isCorrect() {
        assertEquals(4,2 + 2)
    }
}

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)