One recurring question from our customers is "How can I integrate my tests written with Hiptest with SauceLabs" ?". So let's answer this in this blog post.
There are mainly two ways to use SauceLabs, for manual and automated testing. We'll cover both use case in this post.
SauceLabs provides an easy way to emulate any browser/operating system to do manual testing inside your browser.
Manually executing the tests written in Hiptest with this emulator is pretty straightforward, as you should follow the exact same process as usual (with the exception, of course, that you use the emulator instead of your browser).
In case of a test failure, you may want to link the result with the session you have done on SauceLabs. There are two ways to do so, mainly depending on the way you work with Hiptest.
When using one test run by manual campaign
Some teams prefer to have one dedicated test run for each test campaign. Once all tests have been executed, another test run is created to re-run the failing tests if there are any.
In that kind of use case, it it possible to use tag linkers
in the Hiptest project to easily create a link to the test execution you have made for the test.
The image below shows the setup in one of our project to easily link to Saucelabs:
Then, once your test as been executed, copy the SauceLabs id for this test in the browser URL as shown below:
and create a tag on your test name "SL:<value copied previously>. You should now have a link shown when opening the test:
When using one test run by sprint/release
In this use case, you may have multiple results linked to a single test. In that case, you will not have the possibility to use the tag linkers, as it is not yet possible to create a tag at the test result level.
In that case, you may simply copy the link of the execution and paste it into the description field of the test result for further consultation.
It is not yet possible to add the video as an attachment for the test result, but we keep on extending the variety of formats available as attachments.
Running tests generated from Hiptest with SauceLabs is fairly easy. The first step is to ensure your project is ready for automation: that means that all scenarios and folders setups have been written using action words.
Then go the the automation tab of your project and select the language and framework in which you want to get the tests automated. There, all you have to do is to use Selenium WebDriver to implement the action words. Some configuration might be required to tweak the export of the tests. You can have a look at this detailed example
to see how we did it to support Selenium with the Coffee machine sample and Java/JUnit.
Once you have all your tests running locally with Selenium, you can pretty easily integrate them with SauceLabs as the only piece of code you have to update is the way you fetch the Selenium driver.
Here what it would look like in Java:
WebDriver driver = new RemoteWebDriver(new URL("http://YOUR_USERNAME:YOUR_ACCESS_KEY@ondemand.saucelabs.com:80/wd/hub");
And now you can restart your tests and see them executed by SauceLabs instead of your local instance. We strongly advise you to have a look at SauceLabs docs
(and in particular the instant Selenium/Appium section
) which are full of useful resources when it comes to setting up the Selenium (or Appium) driver.
If you have never seen how to automate tests from Hiptest and integrate them with a CI tool, please consider reading the CI in 5 minutes flat tutorial
that show you with a simple Hiptest project how automation is done and how it can be quickly integrated with a CI tool.
When selecting the implemented project during this tutorial, you can choose hps-java-junit-selenium
which is already setup to use Selenium but can be quickly tuned to use SauceLabs with the help of some environment variables (as show in the README
As you can see, integrating SauceLabs into your current testing process is pretty simple. When it comes to manual execution, it is just used as a tool for execute your tests and do not impact much the current way you run the tests.
When it has to be integrated inside an automated process, it is simply used as a remote driver for Selenium or Appium, once again not impacting the way you automate your tests.