Run Unit Tests in Your Linux or Mac box. - Vosie/WikiCards GitHub Wiki

If you want to contribute code, it is annoying when travis always failed but your IDE always passed. This should not be existing in our codebase. But it happens all the time because we don't have the same machine or environment. This Wiki tells you how the travis runs to test WikiCards in Linux box.

Prerequisite

  • Ant

Overall Procedures

The overall procedure is very simple:

  1. start up the emulator

  2. build the project

  3. run the test.

Everything is controlled by ant.

Start up the emulator

For normal usage, we may want to see the screen. So, we can use android's AVD manager to start an emulator by ourself.

The following command is used in travis and is an optional command, you may use AVD manager to start the emulator.

echo no | android create avd --force -n test -t android-19 --abi armeabi-v7a
emulator -avd test -no-skin -no-audio -no-window &

Please note we use android-19 as our emulator version.

Export ant and android to PATH

Before calling ant, we need to make sure the ant and android command is in the PATH. The ant command is at {ANT_HOME}/bin/ant, like ~/apache-ant-1.9.4/bin/ant. You may type ant to check if it is in your PATH. Another thing is android which is at {ANDROID_SDK}/tools/android, like ~/adt-bundle-mac-x86_64-20130219/sdk/tools/android.

Run travis.sh

We provide a ./ci/travis.sh executable to run the travis procedure:

./ci/travis.sh

That's the travis procedure.

⚠️ **GitHub.com Fallback** ⚠️