activitycreator script is enhanced to generate 'tests' project along with the main project. The current behavior of generating Activity is extended by generating ActivityTest in 'tests/src' folder. The 'tests' folder follows the example provided asis in 'ApiDemos'. ApiDemos was used as reference project to mimic the project layout for building tests using Instrumentation.
From 'tests' project, type:
"adb shell am instrument -w [your.package].tests/android.test.InstrumentationTestRunner"
to run all tests using Android InstrumentationTestRunner.
NOTE: 'tests' is a separate AndroidProject by all means. It has its own AndroidManifest.xml, build.xml, src, res etc.,
AMEND:
Fixed style issues, javadoc
Fixed build.template to generate tests/build.xml
Removed build.tests.template since its obsolete now.
21 lines
627 B
Plaintext
21 lines
627 B
Plaintext
package PACKAGE;
|
|
|
|
import android.test.ActivityInstrumentationTestCase;
|
|
|
|
/**
|
|
* This is a simple framework for a test of an Application. See
|
|
* {@link android.test.ApplicationTestCase ApplicationTestCase} for more information on
|
|
* how to write and extend Application tests.
|
|
* <p/>
|
|
* To run this test, you can type:
|
|
* adb shell am instrument -w \
|
|
* -e class PACKAGE.ACTIVITY_NAMETest \
|
|
* PACKAGE.tests/android.test.InstrumentationTestRunner
|
|
*/
|
|
public class ACTIVITY_NAMETest extends ActivityInstrumentationTestCase<ACTIVITY_NAME> {
|
|
|
|
public ACTIVITY_NAMETest() {
|
|
super("PACKAGE", ACTIVITY_NAME.class);
|
|
}
|
|
|
|
} |