I am trying to run just a single Android test case from the command line.
From the IDE I can just right click and run, but from CLI with the following it fails:
./gradlew test --tests "com.xyz.b.module.TestClass.testToRun"
Error:
> Unknown command-line option '--tests'.
How can I run a single UNIT TEST method? I want to emphasis that I want to run a single unit test, not an instrumentation test from command line.
Update: I have a camera app. Imagine that I have a build variant called usCameraDebug
. (That means united states camera debug) Now can you tell me how to run a single test case i called mySingleTest
?
I tried this as you mentioned: ./gradlew test --tests "*mySingleTest"
and ./gradlew app:usCameraDebug test --tests "*mySingleTest"
and also: ./gradlew app:usCameraDebugUnitTest --tests "*mySingleTest"
but it . does not work. caan you tell me exactly what to type based on my build variant. its in a module called "app" as defaulted.
Here is the test I want to run:
package com.xyz.cameras.parts
@Test
fun mySingleTest(){
assertEquals(12,13)
}