title: How to run a single unit test method from command line while targeting a specific Gradle build flavor
body: <p>I am trying to run just a single Android test case from the command line.  </p>
  
  <p>From the IDE I can just right click and run, but from CLI with the following it fails:</p>
  
  <pre><code>./gradlew test --tests "com.xyz.b.module.TestClass.testToRun"
  </code></pre>
  
  <p>Error: </p>
  
  <pre><code>&gt; Unknown command-line option '--tests'.
  </code></pre>
  
  <p>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. </p>
  
  <p><strong>Update</strong>: I have a camera app.  Imagine that I have a build variant called <code>usCameraDebug</code>.  (That means united states camera debug) Now can you tell me how to run a single test case i called <code>mySingleTest</code>?</p>
  
  <p>I tried this as you mentioned: <code>./gradlew test --tests "*mySingleTest"</code></p>
  
  <p>and <code>./gradlew app:usCameraDebug test --tests "*mySingleTest"</code></p>
  
  <p>and  also: <code>./gradlew app:usCameraDebugUnitTest --tests "*mySingleTest"</code>
   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. </p>
  
  <p>Here is the test I want to run:</p>
  
  <pre><code>package  com.xyz.cameras.parts
      @Test
          fun mySingleTest(){
              assertEquals(12,13)
          }
  </code></pre>