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