Virtual USB: Bridging Remote Devices to Local Machines
Tags: virtualusb, testing, testgrid, webdev
Published: 2024-03-31 09:41:27

Virtual USB Connect is a new feature that has been introduced to the TestGrid suite of testing tools. This feature is designed to bridge the gap between cloud-based testing environments and local setups, offering a seamless integration experience for developers and testers.

## What is Virtual USB Connect?

Virtual USB Connect simulates a USB connection to a machine, allowing users to connect dedicated devices on the cloud directly to their local machines. This is achieved by creating a virtual USB connection, making it seem as though the device from the TestGrid’s Real Device Cloud is physically connected to the user’s workstation.

## Why Enterprise need virtual USB

### Build and deploy apps directly from any IDE
TestGrid virtual USB works out of the box with Android studio and Xcode, that means you can develop apps for both Android & iOS devices directly from these cloud devices.

### To improve the efficiency of testing

With the Virtual USB feature, enterprises can  improve the efficiency of their testing by allowing them to debug their apps on multiple devices simultaneously. This can significantly reduce the time it takes to test and release new versions of their apps.

### Perform Complete End to End Test Automation

TestGrid Virtual USB is supercharged by TestOS which means you can build apps on the go, test them for [cross browser compatibility](https://testgrid.io/blog/what-is-browser-compatibility/) , performance issues, load and even confirm if all API calls are working as expected before the launch.

## Setting Up Virtual USB Testing

### Prerequisite

- A TestGrid account (Log in or sign up for a free trial license)
- Your TestGrid Username and User token access key
- For security reasons, you’ll need to have TestGrid Private Devices Cloud enabled as part of your Enterprise / On-Prem to use virtual USB. This feature allocates a dedicated pool of TestGrid Real Devices Cloud to your organization only.
- Windows, macOS, or Linux operating system.
- Administrative rights to install software on your machine.
- Have the Java Development Kit (JDK) installed.
- A mobile native app or web app.
- If you’re testing an iOS app:
    macOS or Linux is required (not supported for Windows).
    Have Xcode installed (macOS only).
- If you’re testing an Android app:
   Android Debug Bridge (ADB) version higher than 1.0.39
   Android Studio 4 or higher.

**Step 1:** Send an email to support@testgrid.io to request access to the RemoteUSB.jar. Once our support team receives the request, you will be given access to download the RemoteUSB.jar file.
**Step 2:** Go to command prompt on your local machine and launch the below command to establish the connection from your local machine to our Real Device Cloud.
$ java -jar RemoteUSB.jar Server --username <username> --password <password> --server https://publicdev.testgrid.io
// or If you have any user token the use it below commands
$ java -jar RemoteUSB.jar Server --userToken <your_token> --server https://publicdev.testgrid.io
For Ex:

Determine the user’s Token.
For Ex:

Determine the user’s Token.
a). Go to the Dashboard and then click on the Created “Test Runs Application”. After that, click on “Test Case Writer” and then click on “Versions.” On the same screen, look for the “i” button in the upper right corner.

b). Select the “i” button icon, and from there, obtain the user token.

**Step 3**: A pop-up appears asking the application executable to accept. Click on Allow.

Once you’ve executed the above command line, it becomes a session data log, running continuously in the background. Do not close it, and keep it separate from terminals.

**Step 4:** To find out the list of devices on the Cloud. Run the below command
java -jar RemoteUSB.jar List


**Step 5:** To start a session with a device on the Cloud. Run the below command
java -jar RemoteUSB.jar Connect <UDID>


**Step 6:** Upon successful connection the command prompt appears as below

**Step 7:**  Upon connecting to XCode.We can see the device is connected and provides developers a unified workflow for user interface design, coding, testing, and debugging.

**Step8:**  To disconnect the device from the cloud Execute the below command
java -jar RemoteUSB.jar DIsconnect <UDID>

Once the command has been successfully executed, the prompt will look like this.

## Features of Virtual USB

**Build and deploy apps directly from any IDE (e.g., Android Studio, Xcode).**

Virtual USB allows you to connect to a real mobile device from your IDE and build and deploy your app directly to the device. This saves time and effort, and lets you debug on the device directly from your IDE.

**Simple configuration, ready to use in minutes.**

It is very easy to set up and use. In most cases, you can be up and running in just a few minutes.

**Use a mix of live and automated testing as it fits your use case.**

Virtual USB features can be used for both live and automated testing, depending on the specific needs of your team and project.

**Make the most of your early-stage development**

Virtual USB is especially useful for early-stage development when you are still iterating on your app’s design and functionality.

The Virtual USB Connect feature bridges the gap between local and remote devices, allowing businesses to stay ahead of the curve in the era of remote work and cloud computing.
This blog is originally published at [TestGrid](https://testgrid.io/blog/virtual-usb-connect/)