1 This project contains the tests for the Android Eclipse Plugins.
3 You can do three things:
4 1- Run the unit tests as a full "eclipse plugin" suite
5 2- Run the unit tests as independent JUnit tests (not as plugin)
6 3. Run the functional tests as a full "eclipse plugin" suite (require a real SDK)
8 The unit tests are isolated tests that do not require external dependencies such as an SDK.
9 The functional tests are higher level tests that may require a real SDK.
11 ------------------------------------------
12 1- Running the unit tests as a full "eclipse plugin" suite
13 ------------------------------------------
15 Steps to run the test suite:
17 A- In Eclipse, import following projects from development/tools/eclipse/plugins:
22 B- Create a new "JUnit Plug-in Test" run configuration via the "Run > Open Run Dialog..." menu
23 Set the launch configuration's data as follows:
25 Select "Run a single test"
27 Test class: com.android.ide.eclipse.tests.UnitTests
31 "-Dtest_data=<adt>/plugins/com.android.ide.eclipse.tests/unittests/data/"
32 replacing "<adt>" with absolute filesystem path to the android plugin source location
34 All other fields can be left with their default values
36 C. Run the newly created launch configuration
38 Running the tests will run a secondary instance of Eclipse.
40 Please note the following constraints to be aware of when writing tests to run within a plugin environment:
42 a. Access restrictions: cannot access package or protected members in a different
43 plugin, even if they are in the same declared package
44 b. Using classloader.getResource or getResourceAsStream to access test data will
45 likely fail in the plugin environment. Instead, use AdtTestData to access test files
46 in conjunction with the "test_data" environment variable mentioned above
49 -------------------------------------------
50 2- Run the unit tests as independent JUnit tests (not plugin)
51 -------------------------------------------
53 A- In Eclipse, import following projects from development/tools/eclipse/plugins:
58 B- Select the "unittests" source folder, right-click and select
59 "Run As > JUnit Test" (i.e. not the plugin tests)
61 This creates a debug configuration of type "JUnit Test" running all tests
62 in the source folder "unittests". The runtime must be JUnit 3.
64 Note: this method runs the tests within a regular JVM environment (ie not within
65 an Eclipse instance). This method has the advantage of being quicker than running
66 as a JUnit plugin test, and requires less potential set-up, but has the
67 disadvantage of not properly replicating how the tests will be run in the
68 continuous test environment. Tests that pass when run as "JUnit Tests" can
69 fail when run as "JUnit Plugin Tests", due to the extra constraints imposed by
70 running within an Eclipse plug-in noted in section 1.
72 ------------------------------------------
73 3- Running the functional tests as a full "eclipse plugin" suite
74 ------------------------------------------
76 Steps to run the test suite:
78 A- In Eclipse, import following projects from development/tools/eclipse/plugins:
83 B - Setup an SDK on host machine, that is compatible with the Eclipse ADT plugins under test
85 C- Create a new "JUnit Plug-in Test" run configuration via the "Run > Open Run Dialog..." menu
86 Set the launch configuration's data as follows:
88 Select "Run a single test"
90 Test class: com.android.ide.eclipse.tests.FuncTests
92 ii. "Environment" tab:
93 Add a "sdk_home" environment variable, setting its path to the SDK from step B
95 All other fields can be left with their default values
97 D. Run the newly created launch configuration
99 Running the tests will run a secondary instance of Eclipse.