diff options
author | Android Partner Docs <noreply@android.com> | 2018-11-09 09:43:40 -0800 |
---|---|---|
committer | Mark Hecomovich <mheco@google.com> | 2018-11-09 14:44:57 -0800 |
commit | c331c4c429cc28bfe87f1e7fe8c954ba2f7509fc (patch) | |
tree | be8019bc8baef8b03fdaf36bdb5fc2e2d4788ffc /en/compatibility/tests/development/jar.md | |
parent | c1e42576367b058286943f85117e2cf1caccdd59 (diff) | |
download | source.android.com-c331c4c429cc28bfe87f1e7fe8c954ba2f7509fc.tar.gz |
Docs: Changes to source.android.com
- 220816688 Devsite localized content from translation request 1008214. by Android Partner Docs <noreply@android.com>
- 220816664 Devsite localized content from translation request 1013270. by Android Partner Docs <noreply@android.com>
- 220816636 Devsite localized content from translation request 1013272. by Android Partner Docs <noreply@android.com>
- 220816628 Devsite localized content from translation request 1014969. by Android Partner Docs <noreply@android.com>
- 220815612 Fix CVE reference for CVE-2017-1000112 by Android Partner Docs <noreply@android.com>
- 220713007 Edit text, distinguish between simple and complex setup, ... by Clay Murphy <claym@google.com>
- 220702656 Document default Java getService behavior. by Android Partner Docs <noreply@android.com>
- 220485453 Update docs for ODM manifest overriding vendor manifest. by Android Partner Docs <noreply@android.com>
- 220485175 Devsite localized content from translation request 1012616. by Android Partner Docs <noreply@android.com>
- 220485126 Devsite localized content from translation request 964305. by Android Partner Docs <noreply@android.com>
- 220485102 Devsite localized content from translation request 1009438. by Android Partner Docs <noreply@android.com>
- 220485097 Devsite localized content from translation request 1012331. by Android Partner Docs <noreply@android.com>
- 220346894 Adding GSI details for app developers and device complian... by Heidi von Markham <hvm@google.com>
- 220346865 Updated the Index.yaml file by Android Partner Docs <noreply@android.com>
- 220316234 Adding AOSP links to 2018-11-01.html by Android Partner Docs <noreply@android.com>
- 220310886 Fix broken link on advisory page by Danielle Roberts <daroberts@google.com>
- 220291759 Devsite localized content from translation request 997229. by Android Partner Docs <noreply@android.com>
- 220291718 Devsite localized content from translation request 1009639. by Android Partner Docs <noreply@android.com>
- 220291707 Devsite localized content from translation request 1010359. by Android Partner Docs <noreply@android.com>
- 220289357 Add tags for OPM7.181105.004 (angler/bullhead), OPM8.1811... by Android Partner Docs <noreply@android.com>
- 220197576 Update WFoV assembly box to 2.7 by Kenneth Lau <kennethlau@google.com>
- 220193030 Change Input overview title by Danielle Roberts <daroberts@google.com>
- 220174571 Updated HTC components table by Android Partner Docs <noreply@android.com>
- 220124279 November 2018 bulletins by Danielle Roberts <daroberts@google.com>
- 220118829 Devsite localized content from translation request 1012605. by Android Partner Docs <noreply@android.com>
- 219944386 Update ASHA CoC spec. based on feedback from Oticon and i... by Android Partner Docs <noreply@android.com>
- 219852814 Mention Soong on home page by Clay Murphy <claym@google.com>
- 219843976 Devsite localized content from translation request 1007156. by Android Partner Docs <noreply@android.com>
- 219827948 Fix some html style issue. by Android Partner Docs <noreply@android.com>
- 219823685 Devsite localized content from translation request 1001117. by Android Partner Docs <noreply@android.com>
- 219738856 Fix reference to Soong introduction in Android version by Clay Murphy <claym@google.com>
- 219733022 Add a bullentin column to release numbers by Android Partner Docs <noreply@android.com>
- 219707540 Move testing docs from AOSP to SAC proper by Clay Murphy <claym@google.com>
- 219701714 Devsite localized content from translation request 1010885. by Android Partner Docs <noreply@android.com>
- 219675967 Hello, this changelist shows a new page called 'Codelab a... by Android Partner Docs <noreply@android.com>
- 219615108 Added note that OTA clients must notify DPCs about OTA st... by Android Partner Docs <noreply@android.com>
- 219525544 Fixed the Trusty API Reference link from by Android Partner Docs <noreply@android.com>
- 219491359 Devsite localized content from translation request 1008378. by Android Partner Docs <noreply@android.com>
- 219351557 Fix links to manifest-format.md by Android Partner Docs <noreply@android.com>
- 219338673 Update documentation for file-based encryption by Android Partner Docs <noreply@android.com>
- 219306017 Devsite localized content from translation request 1010762. by Android Partner Docs <noreply@android.com>
- 219306010 Devsite localized content from translation request 1007340. by Android Partner Docs <noreply@android.com>
- 219305976 Devsite localized content from translation request 1010760. by Android Partner Docs <noreply@android.com>
- 219305971 Devsite localized content from translation request 1007769. by Android Partner Docs <noreply@android.com>
- 219305969 Devsite localized content from translation request 1001106. by Android Partner Docs <noreply@android.com>
- 219163709 Update our Android Severity webpage to clarify that Insta... by Android Partner Docs <noreply@android.com>
- 219161004 Devsite localized content from translation request 1009631. by Android Partner Docs <noreply@android.com>
- 219160993 Devsite localized content from translation request 1009414. by Android Partner Docs <noreply@android.com>
- 219160986 Devsite localized content from translation request 980845. by Android Partner Docs <noreply@android.com>
- 218920762 Change examples from /data/misc/media* to /data/misc/audi... by Christina Nguyen <cqn@google.com>
- 218917538 Update the description of fastboot to the correct behavior. by Christina Nguyen <cqn@google.com>
PiperOrigin-RevId: 220816688
Change-Id: Ifd1ceca1330d6c1f951fa5d7b2da571c95cd212b
Diffstat (limited to 'en/compatibility/tests/development/jar.md')
-rw-r--r-- | en/compatibility/tests/development/jar.md | 93 |
1 files changed, 93 insertions, 0 deletions
diff --git a/en/compatibility/tests/development/jar.md b/en/compatibility/tests/development/jar.md new file mode 100644 index 00000000..6ec60f47 --- /dev/null +++ b/en/compatibility/tests/development/jar.md @@ -0,0 +1,93 @@ +Project: /_project.yaml +Book: /_book.yaml + +{% include "_versions.html" %} + +<!-- + Copyright 2018 The Android Open Source Project + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> + +# JAR (Java) Host Tests + +JAR host tests should be implemented to provide complete code coverage of your +software. Follow the instructions to [Build local unit +tests](https://developer.android.com/training/testing/unit-testing/local-unit-tests){: .external}. +Write small unit tests to validate a specific function and nothing more. + +## Example + +The following Blueprint file provides a simple Hello World JAR host test example to +copy and adapt to your needs: +[platform_testing/tests/example/jarhosttest/Android.bp](https://android.googlesource.com/platform/platform_testing/+/master/tests/example/jarhosttest/Android.bp) + +This corresponds to the actual test code found at: +[platform_testing/tests/example/jarhosttest/test/android/test/example/helloworld/HelloWorldTest.java](platform_testing/+/master/tests/example/jarhosttest/test/android/test/example/helloworld/HelloWorldTest.java) + +A snapshot of the Blueprint file is included here for convenience: + + ``` + java_test_host { + name: "HelloWorldHostTest", + + test_suites: ["general-tests"], + + srcs: ["test/**/*.java"], + + static_libs: [ + "junit", + "mockito", + ], +} + ``` + +Note the `java_host_test` declaration at the beginning indicates this is a JAR +host test. + +## Settings + +The following settings garner explanation: + + ``` + name: "HelloWorldHostTest", + ``` + + +The `name` setting is required when the `java_test_host` module type is specified +(at the start of the block). It gives a name to your module, and the resulting +JAR will be named the same and with a `.jar` suffix, e.g. in this case, the +resulting test JAR is named as `HelloWorldHostTest.jar`. In addition, this also +defines a make target name for your module, so that you can use `make [options] +<HelloWorldHostTest>` to build your test module and all its dependencies. + + +``` + test_suites: ["general-tests"], +``` + +The `test_suites` setting makes the test easily discoverable by the Trade +Federation test harness. Other suites can be added here such as CTS so that this +test may be shared. + + ``` + static_libs: [ + "junit", + ], + ``` + +The `static_libs` setting instructs the build system to incorporate the contents +of the named modules into the resulting apk of current module. This means that +each named module is expected to produce a `.jar` file, and its content will be +used for resolving classpath references during compile time, as well as +incorporated into the resulting apk. |