diff --git a/docs/test_doc.md b/docs/test_doc.md index 0d9b10e72..70f710512 100755 --- a/docs/test_doc.md +++ b/docs/test_doc.md @@ -2,12 +2,139 @@ + + +## default_test_factory.make_tests + +
+default_test_factory.make_tests(factory, name, test_rule, kwargs)
+
+ + Main entry point of generating tests" + +**PARAMETERS** + + +| Name | Description | Default Value | +| :------------- | :------------- | :------------- | +| factory |

-

| none | +| name |

-

| none | +| test_rule |

-

| none | +| kwargs |

-

| none | + + + + +## default_test_factory.make_test_suite + +
+default_test_factory.make_test_suite(factory, name, test_rule, test_kwargs)
+
+ + + +**PARAMETERS** + + +| Name | Description | Default Value | +| :------------- | :------------- | :------------- | +| factory |

-

| none | +| name |

-

| none | +| test_rule |

-

| none | +| test_kwargs |

-

| none | + + + + +## default_test_factory.make_test_suite_splits + +
+default_test_factory.make_test_suite_splits(factory, name, in_kwargs)
+
+ + Helper function to split up a test for named splits and runners splits + +At the end of the day, we need to able to control how many tests / bundles +there are for sharding by class, otherwise it would recompile many times. + +Finally - you can set the splits to be whatever you want. + +**PARAMETERS** + + +| Name | Description | Default Value | +| :------------- | :------------- | :------------- | +| factory |

-

| none | +| name |

-

| none | +| in_kwargs |

-

| none | + + + + +## default_test_factory.make_runner_split + +
+default_test_factory.make_runner_split(name, runner, in_split)
+
+ + + +**PARAMETERS** + + +| Name | Description | Default Value | +| :------------- | :------------- | :------------- | +| name |

-

| none | +| runner |

-

| none | +| in_split |

-

| none | + + + + +## default_test_factory.make_named_split + +
+default_test_factory.make_named_split(name, split_kwargs, in_split)
+
+ + + +**PARAMETERS** + + +| Name | Description | Default Value | +| :------------- | :------------- | :------------- | +| name |

-

| none | +| split_kwargs |

-

| none | +| in_split |

-

| none | + + + + +## default_test_factory.make_test + +
+default_test_factory.make_test(name, test_rule, kwargs)
+
+ + Helper to create an individual test + +**PARAMETERS** + + +| Name | Description | Default Value | +| :------------- | :------------- | :------------- | +| name |

-

| none | +| test_rule |

-

| none | +| kwargs |

-

| none | + + ## ios_ui_test
-ios_ui_test(name, apple_library, kwargs)
+ios_ui_test(name, apple_library, test_factory, kwargs)
 
Builds and packages iOS UI Tests. @@ -19,6 +146,7 @@ ios_ui_test(name, name | The name of the UI test. | none | | apple_library | The macro used to package sources into a library. | <function apple_library> | +| test_factory | Use this to generate other variations of tests. | struct(make_named_split = <function _make_named_split>, make_runner_split = <function _make_runner_split>, make_test = <function _make_test>, make_test_suite = <function _make_test_suite>, make_test_suite_splits = <function _make_test_suite_splits>, make_tests = <function _make_tests>) | | kwargs | Arguments passed to the apple_library and ios_ui_test rules as appropriate. | none | @@ -27,7 +155,7 @@ ios_ui_test(name, name, apple_library, kwargs) +ios_unit_snapshot_test(name, apple_library, test_factory, kwargs) Builds and packages iOS Unit Snapshot Tests. @@ -39,6 +167,7 @@ ios_unit_snapshot_test(name, name | The name of the UI test. | none | | apple_library | The macro used to package sources into a library. | <function apple_library> | +| test_factory | Use this to generate other variations of tests. | struct(make_named_split = <function _make_named_split>, make_runner_split = <function _make_runner_split>, make_test = <function _make_test>, make_test_suite = <function _make_test_suite>, make_test_suite_splits = <function _make_test_suite_splits>, make_tests = <function _make_tests>) | | kwargs | Arguments passed to the apple_library and ios_unit_test rules as appropriate. | none | @@ -47,7 +176,7 @@ ios_unit_snapshot_test(name, -ios_unit_test(name, apple_library, kwargs) +ios_unit_test(name, apple_library, test_factory, kwargs) Builds and packages iOS Unit Tests. @@ -59,6 +188,7 @@ ios_unit_test(name, name | The name of the unit test. | none | | apple_library | The macro used to package sources into a library. | <function apple_library> | +| test_factory | Use this to generate other variations of tests. | struct(make_named_split = <function _make_named_split>, make_runner_split = <function _make_runner_split>, make_test = <function _make_test>, make_test_suite = <function _make_test_suite>, make_test_suite_splits = <function _make_test_suite_splits>, make_tests = <function _make_tests>) | | kwargs | Arguments passed to the apple_library and ios_unit_test rules as appropriate. | none | diff --git a/rules/test.bzl b/rules/test.bzl index 3774a4b7e..2fe684874 100644 --- a/rules/test.bzl +++ b/rules/test.bzl @@ -115,7 +115,7 @@ def _make_tests(factory, name, test_rule, **kwargs): Main entry point of generating tests" """ - # If we have given the reason to generate many tests then do so + # If the user indicates they want more than one test we will generate one if "runners" in kwargs or "split_name_to_kwargs" in kwargs: factory.make_test_suite(factory, name, test_rule, **kwargs) else: @@ -216,6 +216,7 @@ def ios_unit_test(name, apple_library = apple_library, test_factory = default_te Args: name: The name of the unit test. apple_library: The macro used to package sources into a library. + test_factory: Use this to generate other variations of tests. **kwargs: Arguments passed to the apple_library and ios_unit_test rules as appropriate. """ _ios_test(name, _ios_internal_unit_test_bundle, _ios_unit_test, test_factory, apple_library, **kwargs) @@ -227,6 +228,7 @@ def ios_ui_test(name, apple_library = apple_library, test_factory = default_test Args: name: The name of the UI test. apple_library: The macro used to package sources into a library. + test_factory: Use this to generate other variations of tests. **kwargs: Arguments passed to the apple_library and ios_ui_test rules as appropriate. """ if not kwargs.get("test_host", None): @@ -240,6 +242,7 @@ def ios_unit_snapshot_test(name, apple_library = apple_library, test_factory = d Args: name: The name of the UI test. apple_library: The macro used to package sources into a library. + test_factory: Use this to generate other variations of tests. **kwargs: Arguments passed to the apple_library and ios_unit_test rules as appropriate. """ _ios_test(name, _ios_internal_unit_test_bundle, _ios_unit_test, test_factory, apple_library, internal_test_deps = ["@bazel_tools//tools/cpp/runfiles"], **kwargs)