in Android

Android > Unit Test Functional and UI

These are what i referenced.
– http://stackoverflow.com/questions/16586409/how-can-i-create-tests-in-android-studio

– http://www.vogella.com/articles/AndroidTesting/article.html#activity_testing1

– http://tools.android.com/recent/androidstudio018released

Edit: As of 0.1.8 this is now supported in the IDE.

Following the Android Gradle Plugin User Guide 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):

1. Add a src/instrumentTest/java directory for the tests
2. Add a test class (extending ActivityTestCase) in the package com.example.myapplication.test
3. Start a virtual device
4. On the command line (in the MyApplicationProject/MyApplication directory) use the command ‘../gradlew connectedInstrumentTest’

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.

Write a Comment

Comment