| <html devsite> | |
| <head> | |
| <meta name="project_path" value="/_project.yaml"> | |
| <meta name="book_path" value="/versions/6.2.0/_book.yaml"> | |
| </head> | |
| <body> | |
| <h1 class="page-title" id="modules.testing">testing</h1> | |
| <!-- {% raw %} --> | |
| Helper methods for Starlark to access testing infrastructure. | |
| <h2>Members</h2> | |
| <ul> | |
| <li> | |
| <a href="#analysis_test">analysis_test</a> | |
| </li> | |
| <li> | |
| <a href="#ExecutionInfo">ExecutionInfo</a> | |
| </li> | |
| <li> | |
| <a href="#TestEnvironment">TestEnvironment</a> | |
| </li> | |
| </ul> | |
| <h2 id="analysis_test">analysis_test</h2> | |
| <p><pre class="rule-signature"><a class="anchor" href="globals.html#None">None</a> testing.analysis_test(name, implementation, attrs=None, fragments=[], toolchains=[], attr_values={})</pre></p> | |
| <b>Experimental</b>. This API is experimental and may change at any time. Please do not depend on it. It may be enabled on an experimental basis by setting <code>--+experimental_analysis_test_call</code> <br>Creates a new analysis test target. <p>The number of transitive dependencies of the test are limited. The limit is controlled by <code>--analysis_testing_deps_limit</code> flag. | |
| <!-- hide-from-toc is a class used by DevSite for the public Bazel site | |
| (https://developers.google.com/devsite/reference/styles/headings#hide_headings_from_the_toc) --> | |
| <h3 class="hide-from-toc">Parameters</h3> | |
| <table class="table table-bordered table-condensed table-params"> | |
| <colgroup> | |
| <col class="col-param"> | |
| <col class="param-description"> | |
| </colgroup> | |
| <thead> | |
| <tr> | |
| <th>Parameter</th> | |
| <th>Description</th> | |
| </tr> | |
| </thead> | |
| <tbody> | |
| <tr> | |
| <td id="analysis_test.name"> | |
| <code>name</code> | |
| </td> | |
| <td> | |
| required<br/> | |
| Name of the target. It should be a Starlark identifier, matching pattern '[A-Za-z_][A-Za-z0-9_]*'. | |
| </td> | |
| </tr> | |
| <tr> | |
| <td id="analysis_test.implementation"> | |
| <code>implementation</code> | |
| </td> | |
| <td> | |
| required<br/> | |
| The Starlark function implementing this analysis test. It must have exactly one parameter: <a href="ctx.html">ctx</a>. The function is called during the analysis phase. It can access the attributes declared by <code>attrs</code> and populated via <code>attr_values</code>. The implementation function may not register actions. Instead, it must register a pass/fail result via providing <a href='AnalysisTestResultInfo.html'>AnalysisTestResultInfo</a>. | |
| </td> | |
| </tr> | |
| <tr> | |
| <td id="analysis_test.attrs"> | |
| <code>attrs</code> | |
| </td> | |
| <td> | |
| <code><a class="anchor" href="dict.html">dict</a>; or <a class="anchor" href="globals.html#None">None</a></code>; | |
| default = None<br/> | |
| Dictionary declaring the attributes. See the <a href="rule.html">rule</a> call.Attributes are allowed to use configuration transitions defined using <a href="#analysis_test_transition">analysis_test_transition</a>. | |
| </td> | |
| </tr> | |
| <tr> | |
| <td id="analysis_test.fragments"> | |
| <code>fragments</code> | |
| </td> | |
| <td> | |
| <code><a class="anchor" href="list.html">sequence</a> of <a class="anchor" href="string.html">string</a>s</code>; | |
| default = []<br/> | |
| List of configuration fragments that are available to the implementation of the analysis test. | |
| </td> | |
| </tr> | |
| <tr> | |
| <td id="analysis_test.toolchains"> | |
| <code>toolchains</code> | |
| </td> | |
| <td> | |
| <code><a class="anchor" href="list.html">sequence</a></code>; | |
| default = []<br/> | |
| The set of toolchains the test requires. See the <a href="#rule">rule</a> call. | |
| </td> | |
| </tr> | |
| <tr> | |
| <td id="analysis_test.attr_values"> | |
| <code>attr_values</code> | |
| </td> | |
| <td> | |
| <code><a class="anchor" href="dict.html">dict</a> of <a class="anchor" href="string.html">string</a>s</code>; | |
| default = {}<br/> | |
| Dictionary of attribute values to pass to the implementation. | |
| </td> | |
| </tr> | |
| </tbody> | |
| </table> | |
| <h2 id="ExecutionInfo">ExecutionInfo</h2> | |
| <p><pre class="rule-signature"><a class="anchor" href="ExecutionInfo.html">ExecutionInfo</a> testing.ExecutionInfo(requirements={}, exec_group='test')</pre></p> | |
| <a href='ExecutionInfo.html'>testing.ExecutionInfo</a> provider key/constructor | |
| <h2 id="TestEnvironment">TestEnvironment</h2> | |
| <p><pre class="rule-signature"><a class="anchor" href="RunEnvironmentInfo.html">RunEnvironmentInfo</a> testing.TestEnvironment(environment, inherited_environment=[])</pre></p> | |
| <b>Deprecated: Use RunEnvironmentInfo instead.</b> Creates a new test environment provider. Use this provider to specify extra environment variables to be made available during test execution. | |
| <!-- hide-from-toc is a class used by DevSite for the public Bazel site | |
| (https://developers.google.com/devsite/reference/styles/headings#hide_headings_from_the_toc) --> | |
| <h3 class="hide-from-toc">Parameters</h3> | |
| <table class="table table-bordered table-condensed table-params"> | |
| <colgroup> | |
| <col class="col-param"> | |
| <col class="param-description"> | |
| </colgroup> | |
| <thead> | |
| <tr> | |
| <th>Parameter</th> | |
| <th>Description</th> | |
| </tr> | |
| </thead> | |
| <tbody> | |
| <tr> | |
| <td id="TestEnvironment.environment"> | |
| <code>environment</code> | |
| </td> | |
| <td> | |
| required<br/> | |
| A map of string keys and values that represent environment variables and their values. These will be made available during the test execution. | |
| </td> | |
| </tr> | |
| <tr> | |
| <td id="TestEnvironment.inherited_environment"> | |
| <code>inherited_environment</code> | |
| </td> | |
| <td> | |
| <code><a class="anchor" href="list.html">sequence</a> of <a class="anchor" href="string.html">string</a>s</code>; | |
| default = []<br/> | |
| A sequence of names of environment variables. These variables are made available during the test execution with their current value taken from the shell environment. If a variable is contained in both <code>environment</code> and <code>inherited_environment</code>, the value inherited from the shell environment will take precedence if set. | |
| </td> | |
| </tr> | |
| </tbody> | |
| </table> | |
| </body> | |
| </html> | |
| <!-- {% endraw %} --> |