-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Test: Add unit test using robolectric
This patch adds android unit test. Using robolectric, tests run inside the JVM. model list has mobilenet, yolov8 now, so itemCount will be 2. Signed-off-by: Yelin Jeong <[email protected]>
- Loading branch information
Showing
4 changed files
with
34 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 25 additions & 0 deletions
25
...erence_offloading/src/test/java/ai/nnstreamer/ml/inference/offloading/ActivityUnitTest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package ai.nnstreamer.ml.inference.offloading | ||
|
||
|
||
import androidx.recyclerview.widget.RecyclerView | ||
|
||
import org.junit.Assert.assertEquals | ||
import org.junit.Test | ||
import org.junit.runner.RunWith | ||
import org.robolectric.Robolectric | ||
import org.robolectric.RobolectricTestRunner | ||
|
||
@RunWith(RobolectricTestRunner::class) | ||
class ActivityUnitTest { | ||
@Test | ||
fun testModelListLength() { | ||
val activityController = Robolectric.buildActivity(MainActivity::class.java).create() | ||
val activity = activityController.get() | ||
val recyclerview = activity.findViewById<RecyclerView>(R.id.model_list) | ||
val adapter = recyclerview.adapter | ||
|
||
adapter?.run { | ||
assertEquals(2, adapter.itemCount) | ||
} | ||
} | ||
} |
17 changes: 0 additions & 17 deletions
17
...ference_offloading/src/test/java/ai/nnstreamer/ml/inference/offloading/ExampleUnitTest.kt
This file was deleted.
Oops, something went wrong.