'Android Studio Start all unit tests, not instrumented

So far I've got bunch of tests in my multi module project. All of them could be run on PC... except one. It's intrumented test for Room DAO class. There is no problem if I launch it separately on emulator.

Instrumented test is correct while on emulator

But if I launch all the unit tests on PC, this one starts too. And of course it failed as there is no runner for it here.

Instrumented test shouldn't be here!

Why did it even started? I thought instrumented tests shouldn't start with unit ones. And yes, it's placed in androidTest.

I placed it in right directory, didn't I?

My build config could be helpful also.

Config, which starts all the tests. Including the one shouldn't be here

So the question is: how to start only tests for launch on PC? And vice versa: how to start only tests for device/emulator? Next step is to write and launch them too.

Update

I've tried using gradle run xml:

<component name="ProjectRunConfigurationManager">
  <configuration default="false" name="Unit tests" type="GradleRunConfiguration" factoryName="Gradle">
    <ExternalSystemSettings>
      <option name="executionName" />
      <option name="externalProjectPath" value="$PROJECT_DIR$" />
      <option name="externalSystemIdString" value="GRADLE" />
      <option name="scriptParameters" value="--tests &quot;*&quot;" />
      <option name="taskDescriptions">
        <list />
      </option>
      <option name="taskNames">
        <list>
          <option value="cleanTestDebugUnitTest" />
          <option value="testDebugUnitTest" />
        </list>
      </option>
      <option name="vmOptions" value="" />
    </ExternalSystemSettings>
    <ExternalSystemDebugServerProcess>true</ExternalSystemDebugServerProcess>
    <ExternalSystemReattachDebugProcess>true</ExternalSystemReattachDebugProcess>
    <DebugAllEnabled>false</DebugAllEnabled>
    <method v="2" />
  </configuration>
</component>

It doesn't run android test, but also skips tests from koltin modules (without android dependencies). Worked partially.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source