Question

I want to parallel test my application on various OEM and android versions?

Answer Medium Confidence (76%)

You can run your tests in parallel on Genymotion SaaS by leveraging the built‑in cloud grid and the HTTP API. Here’s a quick playbook:

1. **Pick the right device set**

*Use the API endpoint*

`GET https://api.genymotion.com/v1/devices`

to list all available device recipes. Filter by OEM (`manufacturer`), Android version (`apiLevel`) and screen size.

2. **Create a “device group”**

*Group* the device IDs you want to run in parallel.

Example:

```json

[

"pixel_3a_api_30",

"samsung_galaxy_s10_api_28",

"oneplus_7t_api_29",

"nexus_5_api_23"

]

```

3. **Launch parallel instances**

*Use the “Create VM” endpoint*

`POST https://api.genymotion.com/v1/vm`

with the `deviceId` field set to each recipe.

You can script this with a simple loop (Python, Bash, etc.) to start dozens of VMs at once.

4. **Run your test suite**

*Connect* to each VM via the Genymotion Cloud SDK or WebDriver (Appium, Espresso, etc.).

For example, with Appium:

```python

capabilities = {

"appium:platformName": "Android",

"appium:deviceName": "Genymotion",

"appium:automationName": "UiAutomator2",

"appium:udid": ""

}

driver = webdriver.Remote('https://hub.genymotion.com/wd/hub', capabilities)

```

Repeat this for each VM.

Use your CI tool (GitHub Actions, GitLab CI, Jenkins) to spin up the VMs, run tests, and tear them down automatically.

5. **Collect results**

*Genymotion SaaS* returns a unique VM URL and a WebSocket for logs.

Capture logs, screenshots, and video (if enabled) via the API:

`GET https://api.genymotion.com/v1/vm/{vmId}/log`

`GET https://api.genymotion.com/v1/vm/{vmId}/video`

6. **Clean up**

After tests finish, delete the VMs:

`DELETE https://api.genymotion.com/v1/vm/{vmId}`

### Quick Tips

- **Parallel Limits**: The SaaS plan you’re on determines the max concurrent VMs. Check the *“Limits”* section in your dashboard.

- **Device Matrix**: Create a matrix in your test runner (e.g., pytest‑parametrize) that covers all OEM/Android combos.

- **Headless Mode**: For CI, use headless VMs to save resources.

- **Network Latency**: Run the CI runner in the same region as your Genymotion SaaS instance for lower latency.

### Example Script (Python)

```python

import requests

import json

import time

API_KEY = "YOUR_API_KEY"

BASE_URL = "https://api.genymotion.com/v1"

headers = {"Authorization": f"Bearer {API_KEY}"}

# 1. Get device list

devices = requests.get(f"{BASE_URL}/devices", headers=headers).json()

# 2. Choose devices (filter by OEM & API level)

selected = [d["id"] for d in devices if d["manufacturer"] in ("Samsung", "OnePlus") and d["apiLevel"] in (29,30)]

# 3. Launch VMs

vm_ids = []

for device_id in selected:

vm = requests.post(f"{BASE_URL}/vm", json={"deviceId": device_id}, headers=headers).json()

vm_ids.append(vm["vmId"])

# 4. Wait for VMs to be ready

time.sleep(30)

# 5. Run tests (pseudo‑code)

for vm_id in vm_ids:

# connect via Appium, run suite

pass

# 6. Delete VMs

for vm_id in vm_ids:

requests.delete(f"{BASE_URL}/vm/{vm_id}", headers=headers)

```

Feel free to tweak the script to match your test framework. Let us know if you need help wiring it into GitHub Actions or another CI system! 🚀