views:

120

answers:

2

Have someone got any tutorials for how to do testing on Android in Intellij? I am looking for resources similar to what you find for Eclipse with the ability to create a test project for my android project.

A: 

You can find some help in the IDEA forum thread.

Tests for Android application should be located in a separate module with its own AndroidManifest.xml file. To find out how to create tests for your Android application, you can use samples in Android SDK (i.e. "Snake" sample).

Create IDEA project from existing sources. 2 modules with Android facets will be created automatically: base module and "tests". Then add dependency between these module and compile. If compilation is successful, open some test class (i.e. "SkeletonAppTest" in "Snake" sample) in editor and select Run->SkeletonAppTest (with Android icon) in the popup menu: tests will run on emulator or device. You can create Android Tests run configuration to run tests in different scopes.

Unfortunately, IDEA 9 doesn't have an option to create test module for some base Android module. You can create it using SDK command-line tool.

CrazyCoder
There is also a blog post explaining how it works in IDEA 10: http://blogs.jetbrains.com/idea/2010/09/android-unit-testing-support/
CrazyCoder