123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312 |
- <!DOCTYPE html>
- <!--[if IE 8]><html class="no-js lt-ie9" lang="en" > <![endif]-->
- <!--[if gt IE 8]><!--> <html class="no-js" lang="en" > <!--<![endif]-->
- <head>
- <meta charset="utf-8">
-
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
-
- <title>Developer guidelines for custom enhancements — baangt 2020.3.0.rc4 documentation</title>
-
-
-
-
-
-
- <script type="text/javascript" src="_static/js/modernizr.min.js"></script>
-
-
- <script type="text/javascript" id="documentation_options" data-url_root="./" src="_static/documentation_options.js"></script>
- <script type="text/javascript" src="_static/jquery.js"></script>
- <script type="text/javascript" src="_static/underscore.js"></script>
- <script type="text/javascript" src="_static/doctools.js"></script>
- <script type="text/javascript" src="_static/language_data.js"></script>
-
- <script type="text/javascript" src="_static/js/theme.js"></script>
-
-
- <link rel="stylesheet" href="_static/css/theme.css" type="text/css" />
- <link rel="stylesheet" href="_static/pygments.css" type="text/css" />
- <link rel="index" title="Index" href="genindex.html" />
- <link rel="search" title="Search" href="search.html" />
- <link rel="next" title="Why baangt and why is it open source?" href="HistoryAndReasons.html" />
- <link rel="prev" title="Types of tests" href="TestTypes.html" />
- </head>
- <body class="wy-body-for-nav">
-
- <div class="wy-grid-for-nav">
-
- <nav data-toggle="wy-nav-shift" class="wy-nav-side">
- <div class="wy-side-scroll">
- <div class="wy-side-nav-search" >
-
-
- <a href="index.html" class="icon icon-home"> baangt
-
-
- </a>
-
-
-
-
-
- <div role="search">
- <form id="rtd-search-form" class="wy-form" action="search.html" method="get">
- <input type="text" name="q" placeholder="Search docs" />
- <input type="hidden" name="check_keywords" value="yes" />
- <input type="hidden" name="area" value="default" />
- </form>
- </div>
-
- </div>
- <div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation">
-
-
-
-
-
-
- <p class="caption"><span class="caption-text">Contents:</span></p>
- <ul class="current">
- <li class="toctree-l1"><a class="reference internal" href="Installation.html"> Installation</a></li>
- <li class="toctree-l1"><a class="reference internal" href="OverviewUsage.html"> Overview</a></li>
- <li class="toctree-l1"><a class="reference internal" href="simpleExample.html"> First Steps</a></li>
- <li class="toctree-l1"><a class="reference internal" href="Structure.html"> Structure</a></li>
- <li class="toctree-l1"><a class="reference internal" href="ParametersConfigFile.html"> Parameters</a></li>
- <li class="toctree-l1"><a class="reference internal" href="DataFile.html"> Data file</a></li>
- <li class="toctree-l1"><a class="reference internal" href="SimpleAPI.html"> First API Test</a></li>
- <li class="toctree-l1"><a class="reference internal" href="TestTypes.html"> Types of Tests</a></li>
- <li class="toctree-l1 current"><a class="current reference internal" href="#"> For Developers</a><ul>
- <li class="toctree-l2"><a class="reference internal" href="#subclassing">Subclassing</a></li>
- <li class="toctree-l2"><a class="reference internal" href="#debugging">Debugging</a></li>
- <li class="toctree-l2"><a class="reference internal" href="#plugins">Plugins</a></li>
- <li class="toctree-l2"><a class="reference internal" href="#network-trace">Network trace</a></li>
- <li class="toctree-l2"><a class="reference internal" href="#building-baangt-sources">Building baangt sources</a><ul>
- <li class="toctree-l3"><a class="reference internal" href="#building-pypi">Building pyPi</a></li>
- <li class="toctree-l3"><a class="reference internal" href="#building-executables">Building Executables</a></li>
- </ul>
- </li>
- </ul>
- </li>
- <li class="toctree-l1"><a class="reference internal" href="HistoryAndReasons.html"> History</a></li>
- <li class="toctree-l1"><a class="reference internal" href="contributors.html"> Contributions</a></li>
- <li class="toctree-l1"><a class="reference internal" href="changelog.html"> Changelog</a></li>
- <li class="toctree-l1"><a class="reference internal" href="PlannedFeatures.html"> Planned Features</a></li>
- <li class="toctree-l1"><a class="reference internal" href="BrowserDrivers.html"> Browser Drivers</a></li>
- <li class="toctree-l1"><a class="reference internal" href="articles/Articles.html"> :subheader: Articles</a></li>
- <li class="toctree-l1"><a class="reference external" href="http://www.baangt.org"> Web</a></li>
- </ul>
-
-
- </div>
- </div>
- </nav>
- <section data-toggle="wy-nav-shift" class="wy-nav-content-wrap">
-
- <nav class="wy-nav-top" aria-label="top navigation">
-
- <i data-toggle="wy-nav-top" class="fa fa-bars"></i>
- <a href="index.html">baangt</a>
-
- </nav>
- <div class="wy-nav-content">
-
- <div class="rst-content">
-
-
- <div role="navigation" aria-label="breadcrumbs navigation">
- <ul class="wy-breadcrumbs">
-
- <li><a href="index.html">Docs</a> »</li>
-
- <li>Developer guidelines for custom enhancements</li>
-
-
- <li class="wy-breadcrumbs-aside">
-
-
- <a href="_sources/Developer.rst.txt" rel="nofollow"> View page source</a>
-
-
- </li>
-
- </ul>
-
- <hr/>
- </div>
- <div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
- <div itemprop="articleBody">
-
- <div class="section" id="developer-guidelines-for-custom-enhancements">
- <h1>Developer guidelines for custom enhancements<a class="headerlink" href="#developer-guidelines-for-custom-enhancements" title="Permalink to this headline">¶</a></h1>
- <p><code class="docutils literal notranslate"><span class="pre">baangt</span></code> is already pretty versatile but from time to time you’ll face a requirement, that simply can’t be done without
- writing code. But that’s not a bad thing - we like writing code after all, don’t we?</p>
- <div class="section" id="subclassing">
- <h2>Subclassing<a class="headerlink" href="#subclassing" title="Permalink to this headline">¶</a></h2>
- <p>The main classes and functions should be more than OK for you. You’ll just need to implement some central enhancements.
- For instance there’s a requirement to check after each Browser-Interaction, whether a specific popup/message appeared.
- Don’t be cruel and let the end-users duplicate the locator over and over again in their XLSX.</p>
- <p>Instead create a subclass of BrowserDriver</p>
- <div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="kn">from</span> <span class="nn">baangt.base.BrowserDriver</span> <span class="kn">import</span> <span class="n">BrowserHandling</span>
- <span class="k">class</span> <span class="nc">MyCustomBrowser</span><span class="p">(</span><span class="n">BrowserHandling</span><span class="p">)</span>
- <span class="k">def</span> <span class="nf">findByAndClick</span><span class="p">(</span><span class="o">...</span><span class="p">)</span>
- <span class="c1"># Search for the element</span>
- <span class="bp">self</span><span class="o">.</span><span class="n">customSearchAndReact</span><span class="p">()</span>
- <span class="k">def</span> <span class="nf">customSearchAndReact</span><span class="p">():</span>
- <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">findBy</span><span class="p">(</span><span class="n">xpath</span><span class="p">,</span> <span class="s2">"specialThingForThisClient"</span><span class="p">):</span>
- <span class="bp">self</span><span class="o">.</span><span class="n">testdataDict</span><span class="p">[</span><span class="n">GC</span><span class="o">.</span><span class="n">TESTCASESTATUS</span><span class="p">]</span> <span class="o">=</span> <span class="n">GC</span><span class="o">.</span><span class="n">TESTCASESTATUS_FAILED</span>
- </pre></div>
- </div>
- <p>That’s it. Business people will love you and whenever “specialThingForThisClient” changes, you’ll have to adjust only
- in one place.</p>
- <p>After subclassing you’ll need to replace the standard <code class="docutils literal notranslate"><span class="pre">BrowserHandling</span></code> with <code class="docutils literal notranslate"><span class="pre">MyCustomBrowser</span></code> in order for baangt
- to use it.</p>
- </div>
- <div class="section" id="debugging">
- <h2>Debugging<a class="headerlink" href="#debugging" title="Permalink to this headline">¶</a></h2>
- <p>Yeah, sometimes the logs alone are not enough, even when you set loglevel to <code class="docutils literal notranslate"><span class="pre">debug</span></code>. In such cases you’ll want to set
- breakpoints and expect the program to halt on the breakpoint. You’ve two chances to achieve that:</p>
- <ul class="simple">
- <li><dl class="simple">
- <dt>Start baangtIA.py from CLI using:</dt><dd><p><code class="docutils literal notranslate"><span class="pre">python3</span> <span class="pre">baangtIA.py</span> <span class="pre">--run=<PathAndFileOfTestrunName></span> <span class="pre">--globals=<PathAndFileNameForGlobals></span></code></p>
- </dd>
- </dl>
- </li>
- <li><p>Use <code class="docutils literal notranslate"><span class="pre">TX.DEBUG</span></code> as flag in <code class="docutils literal notranslate"><span class="pre">baangt</span></code> interactive starter (=the UI, that comes when you start CLI without parameter
- <code class="docutils literal notranslate"><span class="pre">--run</span></code>) with value <code class="docutils literal notranslate"><span class="pre">True</span></code></p></li>
- </ul>
- </div>
- <div class="section" id="plugins">
- <h2>Plugins<a class="headerlink" href="#plugins" title="Permalink to this headline">¶</a></h2>
- <p>Please make yourself familiar with <a class="reference external" href="https://pluggy.readthedocs.io/en/latest/">https://pluggy.readthedocs.io/en/latest/</a> in order to implement Plugins.
- If you’re stuck let me know.</p>
- </div>
- <div class="section" id="network-trace">
- <h2>Network trace<a class="headerlink" href="#network-trace" title="Permalink to this headline">¶</a></h2>
- <p>Sometimes it’s useful (especially for frontend debugging and in performance measurments) to have more detailed log about
- the calls that the browser exchanges with the backend. If you need this, use <code class="docutils literal notranslate"><span class="pre">TC.NetworkInfo</span></code> with value = <code class="docutils literal notranslate"><span class="pre">True</span></code>.
- In the output file you’ll see a new tab “Network” that shows all calls, headers, payload and timing information for each
- call.</p>
- <p>Use with care, as the file can get pretty big.</p>
- </div>
- <div class="section" id="building-baangt-sources">
- <h2>Building baangt sources<a class="headerlink" href="#building-baangt-sources" title="Permalink to this headline">¶</a></h2>
- <p>Core project members can build distribution as follows:</p>
- <div class="section" id="building-pypi">
- <h3>Building pyPi<a class="headerlink" href="#building-pypi" title="Permalink to this headline">¶</a></h3>
- <ul class="simple">
- <li><p>Increase version in <code class="docutils literal notranslate"><span class="pre">setup.py</span></code></p></li>
- <li><p><code class="docutils literal notranslate"><span class="pre">MakePackage.sh</span></code> to upload to PyPi</p></li>
- <li><p>Use latest version in depending project’s <code class="docutils literal notranslate"><span class="pre">requirements.txt</span></code> (Custom projects)</p></li>
- <li><p><code class="docutils literal notranslate"><span class="pre">pip</span> <span class="pre">install</span> <span class="pre">-r</span> <span class="pre">requirements.txt</span></code></p></li>
- </ul>
- </div>
- <div class="section" id="building-executables">
- <h3>Building Executables<a class="headerlink" href="#building-executables" title="Permalink to this headline">¶</a></h3>
- <ul>
- <li><p>Checkout <code class="docutils literal notranslate"><span class="pre">https://github.com/Athos1972/baangt-executables</span></code></p></li>
- <li><p>On a Windows computer: <code class="docutils literal notranslate"><span class="pre">execWindow.bat</span></code></p></li>
- <li><p>Move <code class="docutils literal notranslate"><span class="pre">/executables/baangt_windows_executable.zip</span></code> to checked out <code class="docutils literal notranslate"><span class="pre">baangt-executables</span></code> ideally with this line:</p>
- <blockquote>
- <div><p><code class="docutils literal notranslate"><span class="pre">mv</span> <span class="pre">executables/baangt_mac_executable.zip</span> <span class="pre">../baangt-executables</span></code></p>
- </div></blockquote>
- </li>
- <li><p>Repeat accordingly on Mac (<code class="docutils literal notranslate"><span class="pre">execMac.sh</span></code>)</p></li>
- <li><p>Repeat accordingly on Ubuntu (<code class="docutils literal notranslate"><span class="pre">execUbuntu.sh</span></code>)</p></li>
- <li><p><code class="docutils literal notranslate"><span class="pre">git</span> <span class="pre">add</span> <span class="pre">.</span></code> in the folder <code class="docutils literal notranslate"><span class="pre">baangt-executables</span></code></p></li>
- <li><p><code class="docutils literal notranslate"><span class="pre">git</span> <span class="pre">commit</span> <span class="pre">-m</span> <span class="pre"><version></span></code></p></li>
- <li><p><code class="docutils literal notranslate"><span class="pre">git</span> <span class="pre">push</span></code></p></li>
- </ul>
- </div>
- </div>
- </div>
- </div>
-
- </div>
- <footer>
-
- <div class="rst-footer-buttons" role="navigation" aria-label="footer navigation">
-
- <a href="HistoryAndReasons.html" class="btn btn-neutral float-right" title="Why baangt and why is it open source?" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right"></span></a>
-
-
- <a href="TestTypes.html" class="btn btn-neutral float-left" title="Types of tests" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left"></span> Previous</a>
-
- </div>
-
- <hr/>
- <div role="contentinfo">
- <p>
- © Copyright 2020, Bernhard Buhl
- </p>
- </div>
- 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>.
- </footer>
- </div>
- </div>
- </section>
- </div>
-
- <script type="text/javascript">
- jQuery(function () {
- SphinxRtdTheme.Navigation.enable(true);
- });
- </script>
-
-
-
-
- </body>
- </html>
|