How to Import Android Test Project to Eclipse - Vosie/WikiCards GitHub Wiki

WikiCardsTest

WikiCardsTest is the android test project for WikiCards app. It is based on android-test framework. This doc describes how to import this project into your eclipse IDE.

1. Import as A Project

We may use main menu File->Import to choose the android-test folder, like the following images:

step 1: choose file and import

choose file and import

step 2: choose general/existing projects into workspace

choose general/existing projects into workspace

step 3: select android-test folder

select android-test folder

step 4: press finish

press finish

step 5: WikiCardsTest project

WikiCardsTest project

After the project imported, we should not have any modification of any files, including WikiCards project and WikiCardsTest project. If we have them, we can use git reset --hard to remove them.

2. Create Emulator (optional)

Before running the tests, we have to create an emulator instance to run the tests. We should create a emulator running in Android 4.4 (android-19) to have the consistent result. All tests is valid only when we runs at the target version. The target version may be changed in the future. But it is Android 4.4 (android-19) currently.

step 6: create emulator

create emulator

step 7: start emulator

start emulator

3. Run the Tests

We may right click on the WikiCardsTest project and choose Run As->Android JUnit Test. If you are the first time to run android unit test, you may need to choose the default runtime of junit tests. Please choose "android junit" in that dialog and set it as workspace default.

step 8: run unit tests

run unit tests

step 9: get the result

get the result

If you don't have the JUnit view in your screen, you may enable it by choosing Window->Show View->Other / Java->Junit.