Variables.html 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279
  1. <!DOCTYPE html>
  2. <!--[if IE 8]><html class="no-js lt-ie9" lang="en" > <![endif]-->
  3. <!--[if gt IE 8]><!--> <html class="no-js" lang="en" > <!--<![endif]-->
  4. <head>
  5. <meta charset="utf-8">
  6. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  7. <title>Dealing with variables &mdash; baangt 1.1.1 documentation</title>
  8. <script type="text/javascript" src="_static/js/modernizr.min.js"></script>
  9. <script type="text/javascript" id="documentation_options" data-url_root="./" src="_static/documentation_options.js"></script>
  10. <script type="text/javascript" src="_static/jquery.js"></script>
  11. <script type="text/javascript" src="_static/underscore.js"></script>
  12. <script type="text/javascript" src="_static/doctools.js"></script>
  13. <script type="text/javascript" src="_static/language_data.js"></script>
  14. <script type="text/javascript" src="_static/js/theme.js"></script>
  15. <link rel="stylesheet" href="_static/css/theme.css" type="text/css" />
  16. <link rel="stylesheet" href="_static/pygments.css" type="text/css" />
  17. <link rel="stylesheet" href="_static/theme_overrides.css" type="text/css" />
  18. <link rel="index" title="Index" href="genindex.html" />
  19. <link rel="search" title="Search" href="search.html" />
  20. <link rel="next" title="SendStatistics" href="SendStatistics.html" />
  21. <link rel="prev" title="Handling of Browser Drivers" href="BrowserDrivers.html" />
  22. </head>
  23. <body class="wy-body-for-nav">
  24. <div class="wy-grid-for-nav">
  25. <nav data-toggle="wy-nav-shift" class="wy-nav-side">
  26. <div class="wy-side-scroll">
  27. <div class="wy-side-nav-search" >
  28. <a href="index.html" class="icon icon-home"> baangt
  29. </a>
  30. <div role="search">
  31. <form id="rtd-search-form" class="wy-form" action="search.html" method="get">
  32. <input type="text" name="q" placeholder="Search docs" />
  33. <input type="hidden" name="check_keywords" value="yes" />
  34. <input type="hidden" name="area" value="default" />
  35. </form>
  36. </div>
  37. </div>
  38. <div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation">
  39. <p class="caption"><span class="caption-text">Contents:</span></p>
  40. <ul class="current">
  41. <li class="toctree-l1"><a class="reference internal" href="Installation.html"> Installation</a></li>
  42. <li class="toctree-l1"><a class="reference internal" href="OverviewUsage.html"> Overview</a></li>
  43. <li class="toctree-l1"><a class="reference internal" href="simpleExample.html"> First Steps</a></li>
  44. <li class="toctree-l1"><a class="reference internal" href="Structure.html"> Structure</a></li>
  45. <li class="toctree-l1"><a class="reference internal" href="ParametersConfigFile.html"> Parameters</a></li>
  46. <li class="toctree-l1"><a class="reference internal" href="SimpleAPI.html"> First API Test</a></li>
  47. <li class="toctree-l1"><a class="reference internal" href="TestTypes.html"> Types of Tests</a></li>
  48. <li class="toctree-l1"><a class="reference internal" href="DataFile.html"> Data file</a></li>
  49. <li class="toctree-l1"><a class="reference internal" href="SaveResults2Database.html"> Results in Database</a></li>
  50. <li class="toctree-l1"><a class="reference internal" href="HistoryAndReasons.html"> History</a></li>
  51. <li class="toctree-l1"><a class="reference internal" href="contributors.html"> Contributions</a></li>
  52. <li class="toctree-l1"><a class="reference internal" href="changelog.html"> Changelog</a></li>
  53. <li class="toctree-l1"><a class="reference internal" href="PlannedFeatures.html"> Planned Features</a></li>
  54. <li class="toctree-l1"><a class="reference internal" href="BrowserDrivers.html"> Browser Drivers</a></li>
  55. <li class="toctree-l1 current"><a class="current reference internal" href="#"> Variables</a><ul>
  56. <li class="toctree-l2"><a class="reference internal" href="#special-variables-for-apis">Special variables for APIs</a></li>
  57. <li class="toctree-l2"><a class="reference internal" href="#faker">Faker</a><ul>
  58. <li class="toctree-l3"><a class="reference internal" href="#info-for-developers">Info for Developers</a></li>
  59. </ul>
  60. </li>
  61. </ul>
  62. </li>
  63. <li class="toctree-l1"><a class="reference internal" href="SendStatistics.html"> Results</a></li>
  64. <li class="toctree-l1"><a class="reference internal" href="Datagenerator.html">DataGenerator</a></li>
  65. <li class="toctree-l1"><a class="reference internal" href="Datagenerator.html#input-file">Input File</a></li>
  66. <li class="toctree-l1"><a class="reference internal" href="Datagenerator.html#data-type">Data Type</a></li>
  67. <li class="toctree-l1"><a class="reference internal" href="Datagenerator.html#all-data-types-format">All Data Types Format</a></li>
  68. <li class="toctree-l1"><a class="reference internal" href="Developer.html"> For Developers</a></li>
  69. <li class="toctree-l1"><a class="reference internal" href="baangt-Plugin.html">What is a baangt-plugin</a></li>
  70. <li class="toctree-l1"><a class="reference internal" href="baangt-Plugin.html#how-to-make-a-baangt-plugin">how to make a baangt-plugin</a></li>
  71. <li class="toctree-l1"><a class="reference internal" href="baangt-Plugin.html#how-the-baangt-plugin-work">how the baangt-plugin work</a></li>
  72. <li class="toctree-l1"><a class="reference internal" href="baangt-Plugin.html#how-to-replace-the-existing-plugin-by-your-own-one">how to replace the existing plugin by your own one</a></li>
  73. <li class="toctree-l1"><a class="reference internal" href="articles/Articles.html"> :subheader: Articles</a></li>
  74. <li class="toctree-l1"><a class="reference external" href="http://www.baangt.org"> Web</a></li>
  75. </ul>
  76. <p class="caption"><span class="caption-text">Autodocs:</span></p>
  77. <ul>
  78. <li class="toctree-l1"><a class="reference internal" href="docs/baangt.base.html">Autodocs</a></li>
  79. <li class="toctree-l1"><a class="reference internal" href="docs/modules.html">Modules</a></li>
  80. </ul>
  81. </div>
  82. </div>
  83. </nav>
  84. <section data-toggle="wy-nav-shift" class="wy-nav-content-wrap">
  85. <nav class="wy-nav-top" aria-label="top navigation">
  86. <i data-toggle="wy-nav-top" class="fa fa-bars"></i>
  87. <a href="index.html">baangt</a>
  88. </nav>
  89. <div class="wy-nav-content">
  90. <div class="rst-content">
  91. <div role="navigation" aria-label="breadcrumbs navigation">
  92. <ul class="wy-breadcrumbs">
  93. <li><a href="index.html">Docs</a> &raquo;</li>
  94. <li>Dealing with variables</li>
  95. <li class="wy-breadcrumbs-aside">
  96. <a href="_sources/Variables.rst.txt" rel="nofollow"> View page source</a>
  97. </li>
  98. </ul>
  99. <hr/>
  100. </div>
  101. <div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
  102. <div itemprop="articleBody">
  103. <div class="section" id="dealing-with-variables">
  104. <h1>Dealing with variables<a class="headerlink" href="#dealing-with-variables" title="Permalink to this headline">¶</a></h1>
  105. <p>You know the basic variable format <code class="docutils literal notranslate"><span class="pre">$(ColumnFromDataFile)</span></code> which works in Locators and value fields.</p>
  106. <dl class="simple">
  107. <dt>For instance:</dt><dd><ul class="simple">
  108. <li><p><code class="docutils literal notranslate"><span class="pre">//&#64;id[$(SomeColumnName)]</span></code> will replace the locator at run time with the content of the data file of column <code class="docutils literal notranslate"><span class="pre">SomeColumnName</span></code></p></li>
  109. <li><p><code class="docutils literal notranslate"><span class="pre">$(URL)</span></code> in the Value 1 or Value 2 will replace the Value at run time with the content of the data file of column <code class="docutils literal notranslate"><span class="pre">URL</span></code></p></li>
  110. </ul>
  111. </dd>
  112. <dt>You may combine several variables into one expression</dt><dd><ul class="simple">
  113. <li><p><code class="docutils literal notranslate"><span class="pre">http://($(BASEURL)-$(URLPART)</span></code> will work, if your data file has the columns <code class="docutils literal notranslate"><span class="pre">BASEURL</span></code> and <code class="docutils literal notranslate"><span class="pre">URLPART</span></code>.
  114. Most probably you guessed it already - Column names are case sensitive. And columns may not be used twice.</p></li>
  115. </ul>
  116. </dd>
  117. </dl>
  118. <div class="section" id="special-variables-for-apis">
  119. <h2>Special variables for APIs<a class="headerlink" href="#special-variables-for-apis" title="Permalink to this headline">¶</a></h2>
  120. <p>TODO: Write Doku.</p>
  121. </div>
  122. <div class="section" id="faker">
  123. <h2>Faker<a class="headerlink" href="#faker" title="Permalink to this headline">¶</a></h2>
  124. <p>From Version 2020.04.6rc4 (April 2020) you can also use all the methods, that the famous python module <code class="docutils literal notranslate"><span class="pre">Faker</span></code> provides.</p>
  125. <p>The syntax is:
  126. <code class="docutils literal notranslate"><span class="pre">$(FAKER.&lt;methodName&gt;)</span></code></p>
  127. <dl class="simple">
  128. <dt>Examples:</dt><dd><ul class="simple">
  129. <li><p><code class="docutils literal notranslate"><span class="pre">$(FAKER.email)</span></code> will generate random E-Mail addresses</p></li>
  130. <li><p><code class="docutils literal notranslate"><span class="pre">$(FAKER.name)</span></code> will generate a random name</p></li>
  131. </ul>
  132. </dd>
  133. </dl>
  134. <p>To see all the methods, head over to <a class="reference external" href="https://faker.readthedocs.io/en/stable/fakerclass.html">https://faker.readthedocs.io/en/stable/fakerclass.html</a>. Because you use <code class="docutils literal notranslate"><span class="pre">baangt</span></code>
  135. you can use all Faker Methods without writing a single line of code.</p>
  136. <div class="section" id="info-for-developers">
  137. <h3>Info for Developers<a class="headerlink" href="#info-for-developers" title="Permalink to this headline">¶</a></h3>
  138. <p>Source in <code class="docutils literal notranslate"><span class="pre">baangt.base.Faker.py</span></code>. Called from <code class="docutils literal notranslate"><span class="pre">baangt.TestSteps.TestStepMaster.py</span></code> from <code class="docutils literal notranslate"><span class="pre">__getFakerData</span></code>.
  139. Currently it is not supported to hand over parameters.</p>
  140. </div>
  141. </div>
  142. </div>
  143. </div>
  144. </div>
  145. <footer>
  146. <div class="rst-footer-buttons" role="navigation" aria-label="footer navigation">
  147. <a href="SendStatistics.html" class="btn btn-neutral float-right" title="SendStatistics" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right"></span></a>
  148. <a href="BrowserDrivers.html" class="btn btn-neutral float-left" title="Handling of Browser Drivers" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left"></span> Previous</a>
  149. </div>
  150. <hr/>
  151. <div role="contentinfo">
  152. <p>
  153. &copy; Copyright 2020, Bernhard Buhl
  154. </p>
  155. </div>
  156. Built with <a href="http://sphinx-doc.org/">Sphinx</a> using a <a href="https://github.com/rtfd/sphinx_rtd_theme">theme</a> provided by <a href="https://readthedocs.org">Read the Docs</a>.
  157. </footer>
  158. </div>
  159. </div>
  160. </section>
  161. </div>
  162. <script type="text/javascript">
  163. jQuery(function () {
  164. SphinxRtdTheme.Navigation.enable(true);
  165. });
  166. </script>
  167. </body>
  168. </html>