Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Edit: As of <a href="http://tools.android.com/recent/androidstudio018released">0.1.8 this is now supported in the IDE</a>. Please follow the instructions in there, instead of using the instructions below.</p> <p>Following the <a href="http://tools.android.com/tech-docs/new-build-system/user-guide">Android Gradle Plugin User Guide</a> I was able to get tests working on the command line by performing the following steps on a newly created project (I used the default 'com.example.myapplication' package):</p> <ol> <li>Add a src/instrumentTest/java directory for the tests</li> <li>Add a test class (extending ActivityTestCase) in the package com.example.myapplication.test</li> <li>Start a virtual device</li> <li>On the command line (in the MyApplicationProject/MyApplication directory) use the command '../gradlew connectedInstrumentTest'</li> </ol> <p>This ran my tests and placed the test results in MyApplicationProject/MyApplication/build/reports/instrumentTests/connected. I'm new to testing Android apps, but it seem to work fine.</p> <p>From within the IDE, it's possible to try and run the same test class. You'll need to </p> <ol> <li>Update build.gradle to list Maven Central as a repo</li> <li>Update build.gradle add JUnit 3.8 as a instrumentTestCompile dependency e.g. instrumentTestCompile 'junit:junit:3.8'</li> <li>In 'Project Structure' manually move JUnit to be first in the dependency order</li> </ol> <p>However this fails (the classpath used when running the tests is missing the test output directory). However, I'm not sure that this would work regardless as it's my understanding that an Android specific test runner is required.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload