siesta-lite
Version:
Stress-free JavaScript unit testing and functional testing tool, works in NodeJS and browsers
1 lines • 10.4 kB
JavaScript
Ext.data.JsonP.saucelabs_integration({"guide":"<p><p><img src=\"guides/saucelabs_integration/images/logo@2x.png\" alt=\"\" width=\"460\" height=\"64\"></p></p>\n<div class='toc'>\n<p><strong>Contents</strong></p>\n<ol>\n<li><a href='#!/guide/saucelabs_integration-section-authentication'>Authentication</a></li>\n<li><a href='#!/guide/saucelabs_integration-section-quick-testing'>Quick testing</a></li>\n<li><a href='#!/guide/saucelabs_integration-section-finding-the-values-for-platform-and-browsername-capability'>Finding the values for platform and browserName capability</a></li>\n<li><a href='#!/guide/saucelabs_integration-section-parallelization'>Parallelization</a></li>\n<li><a href='#!/guide/saucelabs_integration-section-under-the-hood'>Under the hood</a></li>\n<li><a href='#!/guide/saucelabs_integration-section-shared-tunnel'>Shared tunnel</a></li>\n<li><a href='#!/guide/saucelabs_integration-section-conclusion'>Conclusion</a></li>\n<li><a href='#!/guide/saucelabs_integration-section-see-also%3A'>See also:</a></li>\n<li><a href='#!/guide/saucelabs_integration-section-buy-this-product'>Buy this product</a></li>\n<li><a href='#!/guide/saucelabs_integration-section-support'>Support</a></li>\n<li><a href='#!/guide/saucelabs_integration-section-see-also'>See also</a></li>\n<li><a href='#!/guide/saucelabs_integration-section-copyright-and-license'>COPYRIGHT AND LICENSE</a></li>\n</ol>\n</div>\n\n<h1 id='saucelabs_integration-section-integration-with-sauce-labs-cloud-testing-infrastructure-'>Integration with Sauce Labs cloud-testing infrastructure </h1>\n\n<p>Most of the web projects supports all major browsers. When aiming for the full certainty, about the quality of the product in every supported browser,\na logical step is to run the test suite in all those browsers. Counting Chrome, Firefox, Safari, Edge - thats at least 4x\nof the single test suite launch, so for the single-machine setup, the workload can quickly become extremely intense.</p>\n\n<p>One way to solve this bottleneck is to maintain a farm of virtual machines with various OS/browser combinations.\nThis can be tricky and will consume lots of your time and resources. Another, more elegant way is to use services\nproviding the same infrastructure in the cloud. Thanks to services such as <a href=\"http://www.saucelabs.com/\">Sauce Labs</a> it is now very simple.</p>\n\n<h2 id='saucelabs_integration-section-authentication'>Authentication</h2>\n\n<p>When registering an account in Sauce Labs, you will receive a user name (displayed in the right top corner after logging in) and an api key\n(can be found in the left-bottom corner of the \"Account\" page).\nLater in this guide we will refer to these as \"Sauce Labs username\" and \"Sauce Labs access key\" (or Sauce Labs API key).</p>\n\n<h2 id='saucelabs_integration-section-quick-testing'>Quick testing</h2>\n\n<p>Assuming your local web server is configured to listen at host \"localhost\" on port 80, all you need to launch your test suite in the cloud\nis to sign up for the SauceLabs trial and run the following command:</p>\n\n<pre><code>__SIESTA_DIR__/bin/webdriver http://localhost/my/siesta/project/wrapper.html --saucelabs SL_USERNAME,SL_KEY \n--cap browserName=firefox --cap platform=windows\n</code></pre>\n\n<p>That's all, the only difference from a normal Siesta automated launch, is the <code>--saucelabs</code> option, which is a shortcut performing\na few additional actions. We'll examine what happens under the hood later in this guide.</p>\n\n<p>Note how we have specified the desired OS/browser combination using the <code>--cap</code> switch (it specifies remote webdriver capability).\nFor a full list of supported capabilities please refer to <a href=\"https://github.com/SeleniumHQ/selenium/wiki/DesiredCapabilities\">https://github.com/SeleniumHQ/selenium/wiki/DesiredCapabilities</a>.</p>\n\n<p>If your webserver listens on a different host (<code>mylocalhost</code> for example) then the <code>--saucelabs</code> option should look like:</p>\n\n<pre><code>--saucelabs SL_USERNAME,SL_KEY,mylocalhost\n</code></pre>\n\n<h2 id='saucelabs_integration-section-finding-the-values-for-platform-and-browsername-capability'>Finding the values for platform and browserName capability</h2>\n\n<p>Sometimes it can be tricky to find the value for the \"platform\" platform, Selenium documentation provides only the generic ones.</p>\n\n<p>The best way to do it is to start manual testing session, choosing the desired OS / browser combination from the SauceLabs UI.\nThen you can immediately terminate the session, and open the page with session information in the SauceLabs dashboard (check the \"Manual\nsessions\" tab).</p>\n\n<p>There, on the \"Metadata\" tab, you can find the \"Base config\" property, which contains WebDriver capabilities for the OS/Browser\nyou've chosen.</p>\n\n<h2 id='saucelabs_integration-section-parallelization'>Parallelization</h2>\n\n<p>When using cloud-based infrastructure, each test page is running inside of the own VM, which guarantees the exclusive focus owning\nand allows us to run several test pages in parallel. Naturally, that speed ups the test execution, by the number of parallel sessions\nwe can run.</p>\n\n<p>This can be done using the <code>--max-workers</code> option, that specifies the maximum number of parallel sessions.</p>\n\n<h2 id='saucelabs_integration-section-under-the-hood'>Under the hood</h2>\n\n<p>Let's examine what happens under the hood when we use the <code>--saucelabs</code> shortcut option. In fact, we don't have to use this shortcut\noption and can perform all the steps listed below manually.</p>\n\n<p>1) The first thing that happens is that Siesta establishes a local tunnel from your machine to the SauceLabs server, using the SauceLabs binaries.\nYou can do this step manually by using the batch file in the Siesta package:</p>\n\n<pre><code> __SIESTA_DIR__/bin/sc -u SL_USERNAME -k SL_API_KEY -t mylocalhost\n</code></pre>\n\n<p>When launched successfully, you should see the following text:</p>\n\n<pre><code>11 Aug 13:21:22 - Sauce Connect 4.3, build 1283 399e76d\n11 Aug 13:21:22 - Using CA certificate bundle /etc/ssl/certs/ca-certificates.crt.\n.....\n11 Aug 13:22:12 - Starting Selenium listener...\n11 Aug 13:22:15 - Sauce Connect is up, you may start your tests.\n11 Aug 13:22:15 - Connection established.\n</code></pre>\n\n<p>2) The <code>--host</code> option is set to point to the SauceLabs server, based on your username and access key:</p>\n\n<pre><code>--host=\"http://SL_USERNAME:SL_API_KEY@ondemand.saucelabs.com:80/wd/hub\"\n</code></pre>\n\n<p>To sum up, instead of using the <code>--saucelabs</code> shortcut option, we could:</p>\n\n<ul>\n<li><p>launch the tunnel manually:</p>\n\n<pre><code> __SIESTA_DIR__/bin/sc -u SL_USERNAME -k SL_API_KEY -t mylocalhost\n</code></pre></li>\n<li><p>specify the command as:</p>\n\n<pre><code> __SIESTA_DIR__/bin/webdriver http://localhost/my/siesta/project/wrapper.html \n --host=\"http://SL_USERNAME:SL_API_KEY@ondemand.saucelabs.com:80/wd/hub\" \n --cap browserName=firefox --cap platform=XP \n</code></pre></li>\n</ul>\n\n\n<p>For convenience, instead of setting the <code>--host</code> option manually, one can specify <code>--saucelabs-user</code> and <code>--saucelabs-key</code> options.</p>\n\n<pre><code> __SIESTA_DIR__/bin/webdriver http://localhost/my/siesta/project/wrapper.html \n --saucelabs-user=SL_USERNAME --saucelabs-key=SL_API_KEY\n --cap browserName=firefox --cap platform=XP\n</code></pre>\n\n<h2 id='saucelabs_integration-section-shared-tunnel'>Shared tunnel</h2>\n\n<p>We found, that if you and some other team member has manually started unnamed SauceConnect tunnels, tests can't find which tunnel\nto use and can't open project page. This can be solved by starting the tunnel with the <code>--tunnel-identifier</code> option, and\nthen specifying that id with the Siesta's <code>--saucelabs-tunnel-identifier</code> option.</p>\n\n<p>To share the tunnel to BrowserStack between the tests launches (saves the tunnel up/down time, convenient during development), use the\n<code>--saucelabs_</code> option, which does the same things as <code>--saucelabs</code> but uses existing tunnel.</p>\n\n<p>Then you'll need to launch the tunnel manually:</p>\n\n<pre><code> __SIESTA_DIR__/bin/sc -u SL_USERNAME -k SL_API_KEY -t mylocalhost\n</code></pre>\n\n<h2 id='saucelabs_integration-section-conclusion'>Conclusion</h2>\n\n<p>As you can see, thanks to the excellent <a href=\"http://www.saucelabs.com\">Sauce Labs</a> infrastructure, launching your tests in the cloud is as easy as specifying\none extra argument on the command line. The benefits of cloud testing are obvious - no need to waste time and resources setting up and maintaining your own VM farm,\nand additionally you can run your test suite in various browsers in parallel.</p>\n\n<h2 id='saucelabs_integration-section-see-also%3A'>See also:</h2>\n\n<p><a href=\"https://docs.saucelabs.com/reference/sauce-connect/\">https://docs.saucelabs.com/reference/sauce-connect/</a></p>\n\n<h2 id='saucelabs_integration-section-buy-this-product'>Buy this product</h2>\n\n<p>Visit our store: <a href=\"https://bryntum.com/store/siesta\">https://bryntum.com/store/siesta</a></p>\n\n<h2 id='saucelabs_integration-section-support'>Support</h2>\n\n<p>Ask a question in our community forum: <a href=\"https://www.bryntum.com/forum/viewforum.php?f=20\">https://www.bryntum.com/forum/viewforum.php?f=20</a></p>\n\n<p>Subscribers can post expedited questions in Premium Forum: <a href=\"https://www.bryntum.com/forum/viewforum.php?f=21\">https://www.bryntum.com/forum/viewforum.php?f=21</a></p>\n\n<p>Please report any bugs through the web interface at <a href=\"https://www.assembla.com/spaces/bryntum/support/tickets\">https://www.assembla.com/spaces/bryntum/support/tickets</a></p>\n\n<h2 id='saucelabs_integration-section-see-also'>See also</h2>\n\n<p>Siesta web-page: <a href=\"https://bryntum.com/products/siesta\">https://bryntum.com/products/siesta</a></p>\n\n<p>Other Bryntum products: <a href=\"https://bryntum.com/products\">https://bryntum.com/products</a></p>\n\n<h2 id='saucelabs_integration-section-copyright-and-license'>COPYRIGHT AND LICENSE</h2>\n\n<p>Copyright (c) 2009-2022, Bryntum AB & Nickolay Platonov</p>\n\n<p>All rights reserved.</p>\n","title":"Sauce Labs integration"});