Page tree
Skip to end of metadata
Go to start of metadata

Last updated: Apr 13, 2021 14:25

This article explains how you can use the command-line interface (CLI) to create a DevTunnel session and connect to a device without using the Perfecto UI. For this purpose, Perfecto offers the following tools:

  • Creates and connects a DevTunnel session with a device.
  • Creates a DevTunnel session with a device (without connecting to the device) and returns the session ID as output.

You can run these scripts on Windows and Mac.


Before using the DevTunnel CLI, you need to perform the following steps to install DevTunnel and make the Perfecto security token available in a dedicated text file.

On this page:

To install DevTunnel and make the security token available:

  1. Open the Perfecto UI and navigate to the Manual Testing view.
  2. Open a mobile device.
  3. On the device toolbar, click the DevTunnel icon .
  4. In the DevTunnel form, do the following:

     Click to view image
    1. Click Download DevTunnelInstaller. The download tool identifies the target operating system and downloads the proper installation package.
    2. Open the file and follow the prompts on the screen. The installation is slightly different on Windows and Mac.
      Note the default installation directory. You may change it if needed.
    3. When the installation is complete, click Close.
  5. Generate a security token:
    1. In the Perfecto UI at <YourCloud> (where YourCloud is your actual cloud name, such as mobilecloud), click your user name and select My security token
       Click to view image
    2. In the My security token form, click Generate Security Token.

       Click to view images
    3. Click Copy to clipboard. You will paste the token into a dedicated file in step 6. 

       Click to view image
    4. Click Close.
  6. Create a token.txt file in the same folder where you plan to save the CLI script and paste the copied security token into it. Then save and close the file.

Run the CLI script

  1. Download or and save the file to the same folder as your token.txt file.
  2. Run the preferred script with the cloud name, device ID, and operating system parameters, as follows:

    ./ <cloud> <Device ID> <operation system>
  3. When you are done working with the device, close the DevTunnel session by doing one of the following: 
    • From another command line window opened in the same directory, run the following command:

      On Mac
      touch stopnow
      On Windows
      type nul > stopnow
    • Press Ctrl+C.
    • Run the script in the background and the following command from the same command line window:

      On Mac
      touch stopnow
      On Windows
      type nul > stopnow

Clean up

If you close the command line window that runs the script without properly stopping the script, the DevTunnel session stays connected and the device remains in use. In this case, you can manually clean up by running the provided cleanup scripts:

To clean up:

  • Run the respective cleanup script with the cloud name as the only parameter, as follows:

    ./<script-name>.sh <cloud-name>
  • No labels