Skip to content

Commit

Permalink
Fix docs
Browse files Browse the repository at this point in the history
  • Loading branch information
jerrymarino committed Aug 10, 2023
1 parent 9f7005f commit 16a5895
Show file tree
Hide file tree
Showing 2 changed files with 137 additions and 4 deletions.
136 changes: 133 additions & 3 deletions docs/test_doc.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,139 @@



<a id="default_test_factory.make_tests"></a>

## default_test_factory.make_tests

<pre>
default_test_factory.make_tests(<a href="#default_test_factory.make_tests-factory">factory</a>, <a href="#default_test_factory.make_tests-name">name</a>, <a href="#default_test_factory.make_tests-test_rule">test_rule</a>, <a href="#default_test_factory.make_tests-kwargs">kwargs</a>)
</pre>

Main entry point of generating tests"

**PARAMETERS**


| Name | Description | Default Value |
| :------------- | :------------- | :------------- |
| <a id="default_test_factory.make_tests-factory"></a>factory | <p align="center"> - </p> | none |
| <a id="default_test_factory.make_tests-name"></a>name | <p align="center"> - </p> | none |
| <a id="default_test_factory.make_tests-test_rule"></a>test_rule | <p align="center"> - </p> | none |
| <a id="default_test_factory.make_tests-kwargs"></a>kwargs | <p align="center"> - </p> | none |


<a id="default_test_factory.make_test_suite"></a>

## default_test_factory.make_test_suite

<pre>
default_test_factory.make_test_suite(<a href="#default_test_factory.make_test_suite-factory">factory</a>, <a href="#default_test_factory.make_test_suite-name">name</a>, <a href="#default_test_factory.make_test_suite-test_rule">test_rule</a>, <a href="#default_test_factory.make_test_suite-test_kwargs">test_kwargs</a>)
</pre>



**PARAMETERS**


| Name | Description | Default Value |
| :------------- | :------------- | :------------- |
| <a id="default_test_factory.make_test_suite-factory"></a>factory | <p align="center"> - </p> | none |
| <a id="default_test_factory.make_test_suite-name"></a>name | <p align="center"> - </p> | none |
| <a id="default_test_factory.make_test_suite-test_rule"></a>test_rule | <p align="center"> - </p> | none |
| <a id="default_test_factory.make_test_suite-test_kwargs"></a>test_kwargs | <p align="center"> - </p> | none |


<a id="default_test_factory.make_test_suite_splits"></a>

## default_test_factory.make_test_suite_splits

<pre>
default_test_factory.make_test_suite_splits(<a href="#default_test_factory.make_test_suite_splits-factory">factory</a>, <a href="#default_test_factory.make_test_suite_splits-name">name</a>, <a href="#default_test_factory.make_test_suite_splits-in_kwargs">in_kwargs</a>)
</pre>

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 |
| :------------- | :------------- | :------------- |
| <a id="default_test_factory.make_test_suite_splits-factory"></a>factory | <p align="center"> - </p> | none |
| <a id="default_test_factory.make_test_suite_splits-name"></a>name | <p align="center"> - </p> | none |
| <a id="default_test_factory.make_test_suite_splits-in_kwargs"></a>in_kwargs | <p align="center"> - </p> | none |


<a id="default_test_factory.make_runner_split"></a>

## default_test_factory.make_runner_split

<pre>
default_test_factory.make_runner_split(<a href="#default_test_factory.make_runner_split-name">name</a>, <a href="#default_test_factory.make_runner_split-runner">runner</a>, <a href="#default_test_factory.make_runner_split-in_split">in_split</a>)
</pre>



**PARAMETERS**


| Name | Description | Default Value |
| :------------- | :------------- | :------------- |
| <a id="default_test_factory.make_runner_split-name"></a>name | <p align="center"> - </p> | none |
| <a id="default_test_factory.make_runner_split-runner"></a>runner | <p align="center"> - </p> | none |
| <a id="default_test_factory.make_runner_split-in_split"></a>in_split | <p align="center"> - </p> | none |


<a id="default_test_factory.make_named_split"></a>

## default_test_factory.make_named_split

<pre>
default_test_factory.make_named_split(<a href="#default_test_factory.make_named_split-name">name</a>, <a href="#default_test_factory.make_named_split-split_kwargs">split_kwargs</a>, <a href="#default_test_factory.make_named_split-in_split">in_split</a>)
</pre>



**PARAMETERS**


| Name | Description | Default Value |
| :------------- | :------------- | :------------- |
| <a id="default_test_factory.make_named_split-name"></a>name | <p align="center"> - </p> | none |
| <a id="default_test_factory.make_named_split-split_kwargs"></a>split_kwargs | <p align="center"> - </p> | none |
| <a id="default_test_factory.make_named_split-in_split"></a>in_split | <p align="center"> - </p> | none |


<a id="default_test_factory.make_test"></a>

## default_test_factory.make_test

<pre>
default_test_factory.make_test(<a href="#default_test_factory.make_test-name">name</a>, <a href="#default_test_factory.make_test-test_rule">test_rule</a>, <a href="#default_test_factory.make_test-kwargs">kwargs</a>)
</pre>

Helper to create an individual test

**PARAMETERS**


| Name | Description | Default Value |
| :------------- | :------------- | :------------- |
| <a id="default_test_factory.make_test-name"></a>name | <p align="center"> - </p> | none |
| <a id="default_test_factory.make_test-test_rule"></a>test_rule | <p align="center"> - </p> | none |
| <a id="default_test_factory.make_test-kwargs"></a>kwargs | <p align="center"> - </p> | none |


<a id="ios_ui_test"></a>

## ios_ui_test

<pre>
ios_ui_test(<a href="#ios_ui_test-name">name</a>, <a href="#ios_ui_test-apple_library">apple_library</a>, <a href="#ios_ui_test-kwargs">kwargs</a>)
ios_ui_test(<a href="#ios_ui_test-name">name</a>, <a href="#ios_ui_test-apple_library">apple_library</a>, <a href="#ios_ui_test-test_factory">test_factory</a>, <a href="#ios_ui_test-kwargs">kwargs</a>)
</pre>

Builds and packages iOS UI Tests.
Expand All @@ -19,6 +146,7 @@ ios_ui_test(<a href="#ios_ui_test-name">name</a>, <a href="#ios_ui_test-apple_li
| :------------- | :------------- | :------------- |
| <a id="ios_ui_test-name"></a>name | The name of the UI test. | none |
| <a id="ios_ui_test-apple_library"></a>apple_library | The macro used to package sources into a library. | <code>&lt;function apple_library&gt;</code> |
| <a id="ios_ui_test-test_factory"></a>test_factory | Use this to generate other variations of tests. | <code>struct(make_named_split = &lt;function _make_named_split&gt;, make_runner_split = &lt;function _make_runner_split&gt;, make_test = &lt;function _make_test&gt;, make_test_suite = &lt;function _make_test_suite&gt;, make_test_suite_splits = &lt;function _make_test_suite_splits&gt;, make_tests = &lt;function _make_tests&gt;)</code> |
| <a id="ios_ui_test-kwargs"></a>kwargs | Arguments passed to the apple_library and ios_ui_test rules as appropriate. | none |


Expand All @@ -27,7 +155,7 @@ ios_ui_test(<a href="#ios_ui_test-name">name</a>, <a href="#ios_ui_test-apple_li
## ios_unit_snapshot_test

<pre>
ios_unit_snapshot_test(<a href="#ios_unit_snapshot_test-name">name</a>, <a href="#ios_unit_snapshot_test-apple_library">apple_library</a>, <a href="#ios_unit_snapshot_test-kwargs">kwargs</a>)
ios_unit_snapshot_test(<a href="#ios_unit_snapshot_test-name">name</a>, <a href="#ios_unit_snapshot_test-apple_library">apple_library</a>, <a href="#ios_unit_snapshot_test-test_factory">test_factory</a>, <a href="#ios_unit_snapshot_test-kwargs">kwargs</a>)
</pre>

Builds and packages iOS Unit Snapshot Tests.
Expand All @@ -39,6 +167,7 @@ ios_unit_snapshot_test(<a href="#ios_unit_snapshot_test-name">name</a>, <a href=
| :------------- | :------------- | :------------- |
| <a id="ios_unit_snapshot_test-name"></a>name | The name of the UI test. | none |
| <a id="ios_unit_snapshot_test-apple_library"></a>apple_library | The macro used to package sources into a library. | <code>&lt;function apple_library&gt;</code> |
| <a id="ios_unit_snapshot_test-test_factory"></a>test_factory | Use this to generate other variations of tests. | <code>struct(make_named_split = &lt;function _make_named_split&gt;, make_runner_split = &lt;function _make_runner_split&gt;, make_test = &lt;function _make_test&gt;, make_test_suite = &lt;function _make_test_suite&gt;, make_test_suite_splits = &lt;function _make_test_suite_splits&gt;, make_tests = &lt;function _make_tests&gt;)</code> |
| <a id="ios_unit_snapshot_test-kwargs"></a>kwargs | Arguments passed to the apple_library and ios_unit_test rules as appropriate. | none |


Expand All @@ -47,7 +176,7 @@ ios_unit_snapshot_test(<a href="#ios_unit_snapshot_test-name">name</a>, <a href=
## ios_unit_test

<pre>
ios_unit_test(<a href="#ios_unit_test-name">name</a>, <a href="#ios_unit_test-apple_library">apple_library</a>, <a href="#ios_unit_test-kwargs">kwargs</a>)
ios_unit_test(<a href="#ios_unit_test-name">name</a>, <a href="#ios_unit_test-apple_library">apple_library</a>, <a href="#ios_unit_test-test_factory">test_factory</a>, <a href="#ios_unit_test-kwargs">kwargs</a>)
</pre>

Builds and packages iOS Unit Tests.
Expand All @@ -59,6 +188,7 @@ ios_unit_test(<a href="#ios_unit_test-name">name</a>, <a href="#ios_unit_test-ap
| :------------- | :------------- | :------------- |
| <a id="ios_unit_test-name"></a>name | The name of the unit test. | none |
| <a id="ios_unit_test-apple_library"></a>apple_library | The macro used to package sources into a library. | <code>&lt;function apple_library&gt;</code> |
| <a id="ios_unit_test-test_factory"></a>test_factory | Use this to generate other variations of tests. | <code>struct(make_named_split = &lt;function _make_named_split&gt;, make_runner_split = &lt;function _make_runner_split&gt;, make_test = &lt;function _make_test&gt;, make_test_suite = &lt;function _make_test_suite&gt;, make_test_suite_splits = &lt;function _make_test_suite_splits&gt;, make_tests = &lt;function _make_tests&gt;)</code> |
| <a id="ios_unit_test-kwargs"></a>kwargs | Arguments passed to the apple_library and ios_unit_test rules as appropriate. | none |


5 changes: 4 additions & 1 deletion rules/test.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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)
Expand All @@ -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):
Expand All @@ -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)

0 comments on commit 16a5895

Please sign in to comment.