Код: Выделить всё
import org.junit.Assert.assertEquals
import org.junit.Test
import org.junit.runner.RunWith
import org.robolectric.RobolectricTestRunner
@RunWith(RobolectricTestRunner::class)
class ExampleRobo {
@Test
fun someTest() {
assertEquals(4, 2 + 2)
}
}
Мои настройки разработчика:< /strong>
- Mac OS (яблочный кремний m2)
- AS Hedgehog | 2023.1.1 Патч 2
- Gradle 8.2 и AGP 8.2.1
Это мое тестирование Gradle настройка:
Код: Выделить всё
// JUnit 4 & 5
testImplementation("junit:junit:4.13.2")
testImplementation("org.junit.jupiter:junit-jupiter:5.8.1")
// JUnit vintage (so we can use simultaneously JUnit 4 & 5)
testImplementation("org.junit.vintage:junit-vintage-engine:5.8.1")
// external libraries (Mockk & Robolectric)
testImplementation("io.mockk:mockk:1.13.10")
testImplementation("org.robolectric:robolectric:4.12")
Подробнее здесь: https://stackoverflow.com/questions/784 ... le-silicon