Three are two mainly test methods in android.in google document one is Local unit test and another is Instrumented test.
1.
Local unit tests are tests that run on your local machine, without needing access to the Android framework or an Android device. To learn how to develop local units tests, see Building Local Unit Tests.
2.Instrumented tests are tests that run on an Android device or emulator. These tests have access to Instrumentation
information, such as the Context
for the app under test.
Environment
:
Eclipse IDE for Android Developers 23.0.2.1259578
jdk1.7
Window7 64
To setup Junit with eclipse following steps need to be followed.
Step 1: download junit jar file in http://junit.org/junit4/
Step 2: set Environment. open Eclipse
- Go to help
- Install New Software
- Work with: Juno http://download.eclipse.org/releases/juno/
- Programming languages (expand it)
- Install Java Development Tools
- Restart
if not will get nullException. I find answer in stackoverflow.com
Step 3: write code then test it
http://developer.android.com/training/testing/unit-testing/local-unit-tests.html
http://www.tutorialspoint.com/junit/junit_plug_with_eclipse.htm
http://stackoverflow.com/questions/1250505/junit4-eclipse-an-internal-error-occured-during-launching
http://junit.org/junit4/