Introduce instrumentation tests

This commit is contained in:
topjohnwu
2024-12-13 01:09:52 -08:00
committed by John Wu
parent 24615afda1
commit 9112a3a4f5
15 changed files with 190 additions and 104 deletions
+16
View File
@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">
<uses-permission tools:node="removeAll" />
<application tools:node="replace">
<uses-library android:name="android.test.runner" />
</application>
<instrumentation
android:name="androidx.test.runner.AndroidJUnitRunner"
android:targetPackage="com.topjohnwu.magisk"
android:label="Tests for Magisk" />
</manifest>
@@ -0,0 +1,29 @@
package com.topjohnwu.magisk.test
import androidx.test.ext.junit.runners.AndroidJUnit4
import com.topjohnwu.magisk.core.TestImpl
import org.junit.BeforeClass
import org.junit.Test
import org.junit.runner.RunWith
@RunWith(AndroidJUnit4::class)
class Environment {
companion object {
@BeforeClass
@JvmStatic
fun before() {
TestImpl.before()
}
}
@Test
fun setupMagisk() {
TestImpl.setupMagisk()
}
@Test
fun setupShellGrantTest() {
TestImpl.setupShellGrantTest()
}
}
@@ -0,0 +1,24 @@
package com.topjohnwu.magisk.test
import androidx.test.ext.junit.runners.AndroidJUnit4
import com.topjohnwu.magisk.core.TestImpl
import org.junit.BeforeClass
import org.junit.Test
import org.junit.runner.RunWith
@RunWith(AndroidJUnit4::class)
class MagiskAppTest {
companion object {
@BeforeClass
@JvmStatic
fun before() {
TestImpl.before()
}
}
@Test
fun testZygisk() {
TestImpl.testZygisk()
}
}