
Tricentis Tosca is a highly versatile test automation tool that can automate a wide variety of applications, including web applications. Tosca uses a browser plugin or extension to execute test cases locally in a browser. This is very advantageous because a test case only needs to be written once, and Tosca can then execute the developed test case on different local browsers using test configuration parameters.
To continue and expand this concept of reusing previously developed test cases across different platforms and browsers, it makes sense to connect a cross-browser cloud provider like Sauce Labs to Tosca for test automation. The advantages of such a solution are:
This guide is intended to serve as a manual for integrating Tosca with the Sauce Labs platform, particularly from an enterprise environment with a firewall and web proxy. It also outlines best practices for setting up test cases in Tosca.
To establish a solid foundation for later setup, it's recommended to use a Tosca agent for the initial connection to the Sauce Labs Cloud. This agent should have full access and ideally not be behind a proxy or corporate firewall. While this step may seem trivial, it allows us to revert to this setup at any time during subsequent troubleshooting, enabling us to analyze and potentially isolate connection access errors without limitations.
The goal of the first step looks like this:

We use a simple test case and first ensure that it is executed correctly on the local Tosca agent in the Scratchbook:

Next, the same test case is executed in the Sauce Labs Cloud. We use the EU data center https://ondemand.eu-central-1.saucelabs.com/wd/hub (an overview of all data center endpoints can be found here: Data Center Endpoints | Sauce Labs Documentation).
The test configuration parameter «HubAddress» is to be configured in Tosca according to the following scheme:

By using the parameter "HubAddress", the test case is no longer executed locally, but in the Sauce Labs Cloud. After execution in the Scratchbook, we see the result in the Sauce Labs Cloud. As shown in the image above, specifying the parameter "Browser" is sufficient to run the test. A default value is used for the operating system and browser version.

Next, we will implement execution using Sauce Labs from within the company network using a web proxy.
To configure Tosca's access to the Sauce Labs Cloud within a corporate network with a proxy server and firewall, additional parameters must be added to the test configuration. However, first and foremost, you should check with your IT department whether the Tosca agents can access the Sauce Labs Cloud. It may be necessary to adjust certain firewall rules.
The setup now looks like this:

Once it is ensured that web access from the Tosca agents to the Sauce Labs data center endpoint is working, three important test configuration parameters need to be added:

Once these parameters have been added to the configuration, we can restart the execution in the Scratchbook and check in Sauce Labs whether the test case was executed correctly. If there are any problems during execution, these should be analyzed in detail with the internal IT department.
During the Sauce Labs test run, you should now take a closer look at the session metadata. If you find that the outdated JWP WebDriver protocol was used, this should definitely be corrected.
The use of the W3C protocol is documented in more detail by Sauce Labs: W3C WebDriver Capabilities Support | Sauce Labs Documentation
Sauce Labs recommends using the newer W3C protocol instead of the JWP (JSON Wire Protocol). The following describes how these recommendations can be implemented with Tosca. The name of the capabilities to be used is crucial.

The Webdriver_platformName configures the platform to be used (the deprecated value "OperatingSystem" must be avoided). Sauce Labs will now use the correct protocol. This can be verified in the "Metadata" tab of the Sauce Labs test environment.

Up to this point, we have successfully established the correct connection between Tosca and Sauce Labs and now have the ability to configure all relevant settings for controlling the test in the cloud. The Sauce Labs Platform Configurator is also very helpful in this regard.
Sauce Labs offers a very helpful tool to generate the configuration parameters of possible device and OS version variants, as well as, for example, screen resolution – the Platform Configurator (Sauce Labs - Platform Configurator):

The setup shown above (Windows 11 / Chrome version 110 / resolution of 1920x1080 pixels) is implemented in Tosca as follows:

Note the correct notation for the different parameters:
The setup shown above allows a test case, developed once in Tosca, to be run on different platforms in Sauce Labs:

It is recommended to structure the Tosca Execution area with folders according to the required setups and to apply the previously created Tosca test configurations to the corresponding folders:

Within the ExecutionLists, the same test case can now be reused multiple times and thus executed on different setups.
Tosca already offers comprehensive reporting and error analysis capabilities. It is recommended to continue using the existing reporting from test executions in Tosca.
However, Sauce Labs offers further options for traceability of the test procedure. In particular, the video recordings of the test runs provide testers with a comprehensive tool for error analysis:

The commands on the left can also be used to analyze timing problems, for example.
Connecting to Sauce Labs from Tosca is straightforward, even from an enterprise environment with proxy authentication. However, the configuration parameters used are not consistently named, and finding the correct parameters for the connection can sometimes be challenging.
Once the parameters are correctly configured, a comprehensive extension for the Tosca environment is established: Test cases written once can be executed on remote devices. This eliminates the need for the expensive purchase and maintenance-intensive upkeep of the corresponding infrastructure.
Furthermore, Sauce Labs Cloud can be used to automatically test mobile apps on virtual and real devices. This leads to further cost savings and ultimately to higher test coverage.
Would you like to utilize our expertise and implement technological innovations?


Do you have a question or are you looking for more information? Provide your contact information and we will call you back.