diff --git a/doc/README.md b/doc/README.md index 9f77ebbae4..8f9677eaf4 100644 --- a/doc/README.md +++ b/doc/README.md @@ -59,7 +59,8 @@ extensions, and frameworks) and for running unit tests and UI tests. tvos_extension
- Coming soon. + tvos_ui_test
+ tvos_unit_test
diff --git a/doc/rules-tvos.md b/doc/rules-tvos.md index 963c05b23b..8ba29868b7 100644 --- a/doc/rules-tvos.md +++ b/doc/rules-tvos.md @@ -499,3 +499,256 @@ and extensions, list it in the `frameworks` attributes of those + +## tvos_ui_test + +```python +tvos_ui_test(name, bundle_id, infoplists, minimum_os_version, runner, +test_host, data, deps, provisioning_profile, [test specific attributes]) +``` + +Builds and bundles a tvOS UI `.xctest` test bundle. Runs the tests using the +provided test runner when invoked with `bazel test`. + +The following is a list of the `tvos_ui_test` specific attributes; for a list of +the attributes inherited by all test rules, please check the +[Bazel documentation](https://bazel.build/versions/master/docs/be/common-definitions.html#common-attributes-tests). + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Attributes
name +

Name, required

+

A unique name for the target.

+
bundle_id +

String; optional

+

The bundle ID (reverse-DNS path) of the test bundle. It cannot be the + same bundle ID as the test_host bundle ID. If not + specified, the test_host's bundle ID will be used with a + "Tests" suffix.

+
infoplists +

List of labels; optional

+

A list of .plist files that will be merged to form the + Info.plist that represents the test bundle. If not + specified, a default one will be provided that only contains the + CFBundleName and CFBundleIdentifier keys with + placeholders that will be replaced when bundling. Please see + Info.plist Handling + for what is supported.

+
minimum_os_version +

String; optional

+

An optional string indicating the minimum tvOS version supported by the + target, represented as a dotted version number (for example, + "9.0"). If this attribute is omitted, then the value specified + by the flag --tvos_minimum_os will be used instead. +

runner +

Label; optional

+

A target that will specify how the tests are to be run. This target + needs to be defined using a rule that provides the + AppleTestRunnerInfo provider.

+
test_host +

Label; required

+

A tvos_application target that represents the app that + will be tested using XCUITests. This is required as passing a default + has no meaning in UI tests. +

+
data +

List of labels; optional

+

The list of files needed by this rule at runtime.

+

Targets named in the data attribute will appear in the `*.runfiles` + area of this rule, if it has one. This may include data files needed by + a binary or library, or other programs needed by it.

+
deps +

List of labels; optional

+

A list of dependencies targets to link into the binary. Any + resources, such as asset catalogs, that are referenced by those targets + will also be transitively included in the final test bundle.

+
provisioning_profile +

Label; optional

+

The provisioning profile (.mobileprovision file) to use + when bundling the test bundle. This value is optional for simulator + builds as the simulator doesn't fully enforce entitlements, but is + required for device builds.

+
[test specific attributes] +

For a list of the attributes inherited by all test rules, please check the + Bazel documentation. +

+
+ +## tvos_unit_test + +```python +tvos_unit_test(name, bundle_id, infoplists, minimum_os_version, runner, +test_host, data, deps, [test specific attributes]) +``` + +Builds and bundles a tvOS Unit `.xctest` test bundle. Runs the tests using the +provided test runner when invoked with `bazel test`. + +`tvos_unit_test` targets can work in two modes: as app or library tests. If the +`test_host` attribute is set to an `tvos_application` target, the tests will run +within that application's context. If no `test_host` is provided, the tests will +run outside the context of a tvOS application. Because of this, certain +functionalities might not be present (e.g. UI layout, NSUserDefaults). You can +find more information about app and library testing for Apple platforms +[here](https://developer.apple.com/library/content/documentation/DeveloperTools/Conceptual/testing_with_xcode/chapters/03-testing_basics.html). + +The following is a list of the `tvos_unit_test` specific attributes; for a list +of the attributes inherited by all test rules, please check the +[Bazel documentation](https://bazel.build/versions/master/docs/be/common-definitions.html#common-attributes-tests). + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Attributes
name +

Name, required

+

A unique name for the target.

+
bundle_id +

String; optional

+

The bundle ID (reverse-DNS path) of the test bundle. It cannot be the + same bundle ID as the test_host bundle ID. If not + specified, the test_host's bundle ID will be used with a + "Tests" suffix.

+
env +

Dictionary of strings; optional

+

Dictionary of environment variables that should be set during the + test execution.

+
infoplists +

List of labels; optional

+

A list of .plist files that will be merged to form the + Info.plist that represents the test bundle. If not + specified, a default one will be provided that only contains the + CFBundleName and CFBundleIdentifier keys with + placeholders that will be replaced when bundling. Please see + Info.plist Handling + for what is supported.

+
minimum_os_version +

String; optional

+

An optional string indicating the minimum tvOS version supported by the + target, represented as a dotted version number (for example, + "9.0"). If this attribute is omitted, then the value specified + by the flag --tvos_minimum_os will be used instead. +

runner +

Label; optional

+

A target that will specify how the tests are to be run. This target + needs to be defined using a rule that provides the AppleTestRunnerInfo + provider.

+
test_host +

Label; optional

+

A tvos_application target that represents the app that + will host the tests. If not specified, the runner will assume it's a + library-based test.

+
data +

List of labels; optional

+

The list of files needed by this rule at runtime.

+

Targets named in the data attribute will appear in the `*.runfiles` + area of this rule, if it has one. This may include data files needed by + a binary or library, or other programs needed by it.

+
deps +

List of labels; optional

+

A list of dependencies targets to link into the binary. Any + resources, such as asset catalogs, that are referenced by those targets + will also be transitively included in the final test bundle.

+
[test specific attributes] +

For a list of the attributes inherited by all test rules, please check the + Bazel documentation. +

+