Using Tunnels in Automated Tests

Applies to CrossBrowserTesting SaaS, last modified on October 22, 2021

This page relates to the new version of the tunnel that has been introduced to CrossBrowserTesting. If you use the legacy tunnel version, see CBT Tunnel (Legacy).

To use the SmartBear SecureTunnel function in automated tests, you need to configure your test framework to start the tunnel automatically. The easiest way to do this is to run the SBSecureTunnel command-line utility.

  • Configure your test framework to start the utility automatically. If your test run is scheduled, then you can also schedule the tunnel to start before it.

    – or –

    You can run the utility manually beforehand. For instance, if your tests are scheduled to run at night, you can run the utility manually before you go home.

  • To ensure the tunnel is up and running after you start it, add some “wait” command to your test script to wait, for example, for 5-7 seconds.

    Another approach to ensure the tunnel has started successfully is add the --ready file-name parameter to the command line, for example:

    SBSecureTunnel.exe --username your-account --authkey api-key --acceptAllCerts --ready c:/Temp/tunnel-ready.tmp

    The command-line utility will create this file after the tunnel is up and running. Your automated scripts can check the presence of this file to start doing test actions.

  • If you need the tunnel to shut down automatically, add the --kill file-name parameter to the command line:

    SBSecureTunnel.exe --username your-account --authkey api-key --acceptAllCerts --ready c:/Temp/tunnel-ready.tmp --kill C:/Temp/test-is-over.tmp

    It tells the tunnel utility to monitor for the specified file on the hard drive.

    Your automated tests can create this file at the end of a test session, and it will be a signal for the tunnel to shut down.

  • If you need to run several automated tests concurrently, you may want to use different tunnels for them. These tunnels can have different parameters (that is, they can work in different modes). In this case, you need to assign names to these tunnels and then specify the tunnel name in parameters of your automated script. See Using Named Tunnels in Automated Tests for details.

See Also

Local Testing — Secure Tunnels
SecureTunnel Command Line
Automated Testing

Highlight search results