How to get Android Test Framework working

Hi,

I'm trying to get a handle on how to set up the Android Testing Framework using IntelliJ (ultimate edition 9)

There are a couple of posts (one blog post and one discussion), but I'm still not understanding the precise mechanics of setting up testing.

I have 2 main problems:
  1.   I don't know if I'm setting up the Test module correctly (I show a series of screenshots below).
  2.   When I add a "testing" module, my test class doesn't "see" my main Activity classes (see below).


I have set up an Android project (for simplicity I'm just using the HelloWorld Android app outlined here).

The blog post says that I need to add a new module to my existing Android project and that the new module should be named "Tests".
The post then shows this dialog screen (test-module).
test-module.png
However, I never see anything that resembles the screenshot above.




Here is the sequence of windows that I see when I try to add a new module:

New > Module
1.png

Create module from scratch
2.png

Name the module "Tests"
3.png


Create a source directory in the new module
ab.png

Finish making the module
Screen shot 2010-11-08 at 3.44.31 PM.png

Once the module is created, I have a directory structure that looks like this:

Screen shot 2010-11-08 at 3.48.41 PM.png

I then edit the run configuration of the "Tests" module like this:
Screen shot 2010-11-08 at 3.46.57 PM.png

I then create a new class called HelloAndroidTest in my Tests module

and the code inside my class is this:
import android.test.ActivityInstrumentationTestCase2;
import com.example.helloandroid.HelloAndroid;

public class HelloAndroidTest extends ActivityInstrumentationTestCase2<HelloAndroid> {
}
One initial problem is that my class HelloAndroid (which is in the main module) is not seen by the Tests module.
Thoughts on where I've gone wrong??

TKS!
1 comment

Turns out you need IntelliJ X (10).  As far as I can tell, 9 doesn't have this feature.

0

Please sign in to leave a comment.