Skip to content

quickstart

inazaruk edited this page Jul 20, 2012 · 28 revisions

Quick Start Tutorial

Go to home | documentation

The robomorphine-testrunner library is available in two versions. The full version and version that is designed to enable quick integration with standard build system provided with Android SDK.

In this tutorial we'll talk about the Android build integration suite and example that uses this integration suite. Note that this suite is not exposing much robomorphine-testrunner functionality. It should be able to get you started though. You can then try to modify provided scripts and customize it to your needs (you can refer ant tasks documentation for more details about tasks).

Android Build Integration Suite

This suite was created in order to make it easy to use library for the first time. It requires only several files copied and one modification in build.xml file in order to start working.

You can download this suite at downloads section. The file name is android-build.zip.

To start using it, copy all three files (rbm-test.xml, rbm-testrunner.xml and rbm.testrunner.jar) to root folder of your test project. You need to have similar project layout:

res
src
AndroidManifest.xml
build.xml
local.properties
project.properties
rbm-test.xml
rbm-testrunner.xml
rbm-testrunner.jar

When this is done, add next line into your build.xml file at the end of file:

<import file="rbm-test.xml" />

Your build.xml file should look like:

<!-- version-tag: custom -->
<import file="${sdk.dir}/tools/ant/build.xml" />
<import file="rbm-test.xml" /> <!-- this line should be added -->

Example

But in order to make things even easier, there is an example that uses quick-integration library. You can find it at downloads section. The file name is android-build-example.zip. Please download it and extract somewhere.

The example contains two projects named tested and tester. And, obviously, tested project contains some useful functionality, while tester project contains lots of important tests.

Step 1 - generate local.properties files

In order to start using example you have to create local.properties files in both tested and tester folders:

  • .../tested/local.properties
  • .../tester/local.properties

Both files will be identical. Here's how local.properties looks on my windows machine:

# ... some generated comments here ...
sdk.dir=R:\\repository\\dev\\bin\\android-sdk

So both files must contain sdk.dir property that points to you Android SDK location. You can do this either manually or by using android command line tool:

> path-to-android-sdk/tools/android update project -p path-to-example/tested
> path-to-android-sdk/tools/android update project -p path-to-example/tester

Step 2 - build

Let's now build these projects. For this go to tester project folder and run:

> ant debug

Step 3 - run tests

You are now ready to run tests. If you have Android device connected to adb (i.e. you don't want to start emulator):

> ant installt rbm-test

If you want to start emulator, run tests and then stop emulator:

> ant rbm-test-on-emulator -Dtarget=android-15

Step 4 - look at junit reports

If you want to view junit reports, go to tester/bin/test/junit folder. You can also view logcat dump at tester/bin/test/logcat.log file.

Step 5 - help yourself

In order to see detailed help, run:

> ant rbm-help

Go to home | documentation

Clone this wiki locally