{"id":3879,"date":"2024-12-06T12:54:17","date_gmt":"2024-12-06T12:54:17","guid":{"rendered":"https:\/\/testgrid.io\/docs\/?post_type=epkb_post_type_1&#038;p=3879"},"modified":"2025-10-01T10:06:28","modified_gmt":"2025-10-01T10:06:28","slug":"dynamic-test-case-execution-on-testgrid-leveraging-random-device-allocation","status":"publish","type":"epkb_post_type_1","link":"https:\/\/testgrid.io\/docs\/document\/dynamic-test-case-execution-on-testgrid-leveraging-random-device-allocation\/","title":{"rendered":"Dynamic Test Case Execution on TestGrid: Leveraging Random Device Allocation"},"content":{"rendered":"<h2>Overview:<\/h2>\n<p>This document outlines the process for executing test cases on TestGrid devices by dynamically allocating the first available device from the pool, rather than binding specific devices to individual test cases. This approach ensures efficient utilization of TestGrid resources, minimizes idle time for devices, and simplifies test case management by eliminating the need for manual device assignment.<\/p>\n<p>By leveraging this dynamic allocation mechanism, test cases are automatically routed to available devices based on their readiness and availability. This process promotes scalability, optimizes test execution workflows, and supports a seamless testing experience in environments with diverse device configurations.<\/p>\n<h2>Using the Cap Builder API for Dynamic Device Allocation<\/h2>\n<p>To execute test cases on the first available device within TestGrid, the <strong>Cap Builder API<\/strong> can be utilized. Below is the syntax for the API request:<\/p>\n<pre><code class=\"language-bash\">curl --location 'https:\/\/example.testgrid.io\/api\/cap-builder' \\\r\n--form 'user_token=\"your-user-token\"' \\\r\n--form 'device_type=\"android\"' \\\r\n--form 'project_name=\"test\"' \\\r\n--form 'device_name=\"Galaxy A53 5G\"' \\\r\n--form 'os_version=\"14\"' \\\r\n--form 'device_tag=\"tag 1\"'\r\n<\/code><\/pre>\n<h3>Field Details:<\/h3>\n<ul>\n<li><strong><code>device_type<\/code><\/strong>: Specifies the type of device (e.g., <code>android<\/code> , <code>ios,<\/code>or <code>web<\/code>).<\/li>\n<li><strong><code>project_name<\/code><\/strong>: Indicates the project to which the test cases belong.<\/li>\n<li><strong><code>user_token<\/code><\/strong>: Authentication token for the user.<\/li>\n<\/ul>\n<h3>Optional Parameters:<\/h3>\n<ul>\n<li><strong><code>device_name<\/code><\/strong>: (Optional) Specifies a particular device model to refine the search.<\/li>\n<li><strong><code>os_version<\/code><\/strong>: (Optional) Defines the OS version for targeted device selection.<\/li>\n<li><strong><code>device_tag<\/code><\/strong>: (Optional) Enables filtering by a specific device tag.<\/li>\n<\/ul>\n<p>If no optional fields are provided, the system will select the first available device that matches the <code>device_type<\/code> criteria. This flexibility allows for efficient and scalable test execution across the TestGrid infrastructure.<\/p>\n<h2>Sample API Response<\/h2>\n<p>The API returns a JSON response with the details of the allocated device. Below is an example:<\/p>\n<div class=\"contain-inline-size rounded-md border-[0.5px] border-token-border-medium relative bg-token-sidebar-surface-primary dark:bg-gray-950\">\n<div class=\"flex items-center text-token-text-secondary px-4 py-2 text-xs font-sans justify-between rounded-t-md h-9 bg-token-sidebar-surface-primary dark:bg-token-main-surface-secondary select-none\">json Android<\/div>\n<div class=\"flex items-center rounded bg-token-sidebar-surface-primary px-2 font-sans text-xs text-token-text-secondary dark:bg-token-main-surface-secondary\">\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"json\">{\r\n    \"status\": true,\r\n    \"data\": {\r\n        \"appium_url\": \"http:\/\/example.testgrid.io\/appium_xxxx\/wd\/hub\",\r\n        \"platform_name\": \"android\",\r\n        \"device_name\": \"Galaxy S20 5G\",\r\n        \"platform_version\": \"13\",\r\n        \"automation_name\": \"UiAutomator2\",\r\n        \"udid\": \"your-device-udid\",\r\n        \"user_token\": \"your-user-token\",\r\n        \"system_port\": \"4011\",\r\n        \"remote_host\": \"example.testgrid.io\",\r\n        \"remote_path\": \"\/wd\/hub\",\r\n        \"remote_port\": \"xxxxx\",\r\n        \"project_name\": \"test\"\r\n    }\r\n}\r\n\r\njson Web\r\n\r\n<\/pre>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">{\r\n    \"status\": true,\r\n    \"data\": {\r\n        \"appium_url\": \"http:\/\/example.testgrid.io\/browserrunXXXXX\/wd\/hub\",\r\n        \"platform_name\": \"linux\",\r\n        \"udid\": \"your-device-udid\",\r\n        \"user_token\": \"your-user-token\",\r\n        \"browser_name\": \"chrome\",\r\n        \"project_name\": \"test\"\r\n    }\r\n}<\/pre>\n<p>&nbsp;<\/p>\n<\/div>\n<\/div>\n<h2>Key Response Fields<\/h2>\n<h5>Mobile Device Response<\/h5>\n<ul>\n<li><strong><code>appium_url<\/code><\/strong>: URL to connect with Appium for mobile test execution.<\/li>\n<li><strong><code>platform_name<\/code><\/strong>: Name of the device platform (e.g., <code>android<\/code>).<\/li>\n<li><strong><code>device_name<\/code><\/strong>: Name of the allocated device.<\/li>\n<li><strong><code>platform_version<\/code><\/strong>: Version of the device&#8217;s operating system.<\/li>\n<li><strong><code>udid<\/code><\/strong>: Unique identifier for the device.<\/li>\n<li><strong><code>system_port<\/code><\/strong>: Port for communication with the device.<\/li>\n<li><strong><code>remote_host<\/code>, <code>remote_path<\/code>, <code>remote_port<\/code><\/strong>: Host, path, and port details for the Appium server.<\/li>\n<li><strong><code>project_name<\/code><\/strong>: Name of the project associated with the test case.<\/li>\n<\/ul>\n<h5>Web Response<\/h5>\n<ul>\n<li><strong><code>appium_url<\/code><\/strong>: URL to connect with Appium for web browser test execution.<\/li>\n<li><strong><code>platform_name<\/code><\/strong>: Name of the platform hosting the browser (e.g., <code>linux<\/code>).<\/li>\n<li><strong><code>udid<\/code><\/strong>: Unique identifier for the browser session.<\/li>\n<li><strong><code>browser_name<\/code><\/strong>: Name of the browser used for testing (e.g., <code>chrome<\/code>).<\/li>\n<li><strong><code>project_name<\/code><\/strong>: Name of the project associated with the test case.<\/li>\n<\/ul>\n<p>These responses provide all the necessary details to initiate test execution on either mobile devices or web browsers.<\/p>\n<p>&nbsp;<\/p>\n<h2>Sample Java Code for Web Test Case Execution Using TestGrid<\/h2>\n<p>Below is a sample Java code that demonstrates the process of executing a test case on the first available web browser session using the TestGrid Cap Builder API.<\/p>\n<p>&nbsp;<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"java\">package all;\r\n\r\nimport com.jayway.jsonpath.JsonPath;\r\nimport com.jayway.jsonpath.ReadContext;\r\nimport okhttp3.*;\r\nimport org.openqa.selenium.By;\r\nimport org.openqa.selenium.Keys;\r\nimport org.openqa.selenium.WebDriver;\r\nimport org.openqa.selenium.remote.DesiredCapabilities;\r\nimport org.openqa.selenium.remote.RemoteWebDriver;\r\nimport org.testng.Assert;\r\nimport org.testng.annotations.Test;\r\n\r\nimport java.io.IOException;\r\nimport java.net.URL;\r\nimport java.util.concurrent.TimeUnit;\r\n\r\npublic class WebAppParallelAutomation extends BaseClass {\r\n\r\n    WebDriver driver;\r\n    static String[] search = {\"Python\", \"Java\", \"Selenium\", \"Appium\", \"Nodejs\", \"Nodered\", \"IOS\", \"Android\",\r\n            \"Docker\", \"Machine Learning\"};\r\n\r\n    String userToken = \"your-user-token\";\r\n\r\n    @Test\r\n    public void WebApp1() {\r\n        String device_id = null;\r\n        try {\r\n            device_id = startWebSession();\r\n            reportTestcaseStarted(driver, \"WebApp1\");\r\n\r\n            \/\/ Navigate to DemoQA login page\r\n            driver.get(\"https:\/\/demoqa.com\/login\");\r\n            reportTestStep(driver, \"Open DemoQA\");\r\n\r\n            \/\/ Set implicit wait\r\n            driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);\r\n\r\n            \/\/ Execute search operations on Google\r\n            for (int i = 0; i &lt; 1; i++) {\r\n                for (int j = 0; j &lt; 10; j++) {\r\n                    driver.get(\"https:\/\/www.google.com\/\");\r\n                    driver.findElement(By.name(\"q\")).sendKeys(search[j]);\r\n                    driver.findElement(By.name(\"q\")).sendKeys(Keys.ENTER);\r\n                    Thread.sleep(5000);\r\n                }\r\n            }\r\n\r\n            reportTestcasePassed(driver, \"Success\");\r\n            driver.quit();\r\n            releaseDevice(device_id);\r\n        } catch (Exception e) {\r\n            reportTestcaseFailed(driver, \"Failed\");\r\n            driver.quit();\r\n            releaseDevice(device_id);\r\n        }\r\n    }\r\n\r\n    public String releaseDevice(String device_id) {\r\n        try {\r\n            OkHttpClient client = new OkHttpClient();\r\n            RequestBody body = new MultipartBody.Builder()\r\n                    .setType(MultipartBody.FORM)\r\n                    .addFormDataPart(\"user_token\", userToken)\r\n                    .build();\r\n\r\n            Request request = new Request.Builder()\r\n                    .url(\"http:\/\/example.testgrid.io\/api\/user\/releasedevice\/\" + device_id)\r\n                    .method(\"POST\", body)\r\n                    .build();\r\n\r\n            Response response = client.newCall(request).execute();\r\n            return response.body().string();\r\n        } catch (Exception e) {\r\n            return null;\r\n        }\r\n    }\r\n\r\n    private String startWebSession() throws IOException {\r\n        OkHttpClient client = new OkHttpClient();\r\n        RequestBody body = new MultipartBody.Builder()\r\n                .setType(MultipartBody.FORM)\r\n                .addFormDataPart(\"user_token\", userToken)\r\n                .addFormDataPart(\"device_type\", \"web\")\r\n                .addFormDataPart(\"project_name\", \"test\")\r\n                .build();\r\n\r\n        Request request = new Request.Builder()\r\n                .url(\"http:\/\/example.testgrid.io\/api\/cap-builder\")\r\n                .method(\"POST\", body)\r\n                .build();\r\n\r\n        Response response = client.newCall(request).execute();\r\n        ReadContext ctx = JsonPath.parse(response.body().string());\r\n\r\n        boolean status = ctx.read(\"$.status\");\r\n        if (status) {\r\n            String appiumUrl = ctx.read(\"$.data.appium_url\");\r\n            String platformName = ctx.read(\"$.data.platform_name\");\r\n            String browser_name = ctx.read(\"$.data.browser_name\");\r\n            String udid = ctx.read(\"$.data.udid\");\r\n            String device_id = ctx.read(\"$.data.device_id\");\r\n            String projectName = ctx.read(\"$.data.project_name\");\r\n\r\n            DesiredCapabilities capabilities = new DesiredCapabilities();\r\n            capabilities.setCapability(\"platformName\", platformName);\r\n            capabilities.setCapability(\"browserName\", browser_name);\r\n            capabilities.setCapability(\"tg:udid\", udid);\r\n            capabilities.setCapability(\"tg:userToken\", userToken);\r\n            capabilities.setCapability(\"tg:projectName\", projectName);\r\n\r\n            driver = new RemoteWebDriver(new URL(appiumUrl), capabilities);\r\n            return device_id;\r\n        } else {\r\n            String message = ctx.read(\"$.message\");\r\n            Assert.fail(message);\r\n            return null;\r\n        }\r\n    }\r\n}\r\n<\/pre>\n<p>&nbsp;<\/p>\n<h5>Key Highlights:<\/h5>\n<ol>\n<li><strong>Dynamic Session Initialization<\/strong>: The <code>startWebSession()<\/code> method interacts with the Cap Builder API to request the first available browser session.<\/li>\n<li><strong>Test Execution<\/strong>: Example test flows include navigating to a webpage and performing search operations on Google.<\/li>\n<li><strong>Device Release<\/strong>: The <code>releaseDevice()<\/code> method ensures the device\/session is released back to the pool after test completion.<\/li>\n<li><strong>Error Handling<\/strong>: The code includes robust exception handling to manage failures gracefully.<\/li>\n<\/ol>\n<p>This code is a template for setting up scalable, parallelized web test execution using TestGrid.<\/p>\n<h2>Android App Automation Using TestGrid<\/h2>\n<p>Here is a Java example for automating an Android app using TestGrid and Appium. This script demonstrates key aspects like initializing a session, automating app interactions, and releasing the session back to TestGrid:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">package all;\r\n\r\nimport com.jayway.jsonpath.JsonPath;\r\nimport com.jayway.jsonpath.ReadContext;\r\nimport io.appium.java_client.AppiumDriver;\r\nimport io.appium.java_client.android.AndroidDriver;\r\nimport okhttp3.*;\r\nimport org.openqa.selenium.By;\r\nimport org.openqa.selenium.ScreenOrientation;\r\nimport org.openqa.selenium.WebElement;\r\nimport org.openqa.selenium.remote.DesiredCapabilities;\r\nimport org.testng.Assert;\r\nimport org.testng.annotations.Test;\r\n\r\nimport java.io.IOException;\r\nimport java.net.URL;\r\n\r\npublic class AutomationTestingAndroidBroadcom extends BaseClass {\r\n\r\n    AppiumDriver driver;\r\n\r\n    @Test\r\n    public void AndroidApp1Visual() {\r\n        try {\r\n            \/\/ Start the Android session\r\n            startAndroidSession();\r\n\r\n            reportTestcaseStarted(driver, \"TC01_GoodWeatherGraphsScreen\");\r\n\r\n            \/\/ Allow app installation and launch the app\r\n            waitForSeconds(5);\r\n            AndroidDriver driver1 = (AndroidDriver) driver;\r\n\r\n            driver1.installApp(\"https:\/\/api.testgrid.io\/\/wassets\/upload\/file\/1701363450_file_goodweather.apk\");\r\n            driver1.activateApp(\"org.asdtm.goodweather\");\r\n\r\n            waitForSeconds(5);\r\n            driver1.rotate(ScreenOrientation.PORTRAIT);\r\n\r\n            \/\/ Handle app interactions\r\n            try {\r\n                driver.findElement(By.xpath(\"\/\/*[@text='OK']\")).click();\r\n            } catch (Exception e) {\r\n                System.out.println(e.getMessage());\r\n            }\r\n\r\n            \/\/ Refresh home screen\r\n            WebElement refreshHome = driver.findElement(By.xpath(\"\/\/android.widget.TextView[@resource-id='org.asdtm.goodweather:id\/main_menu_refresh']\"));\r\n            refreshHome.click();\r\n            reportTestStep(driver, \"Clicked on Refresh\");\r\n\r\n            \/\/ Search for a city\r\n            WebElement searchCityButton = driver.findElement(By.xpath(\"\/\/android.widget.TextView[@resource-id='org.asdtm.goodweather:id\/main_menu_search_city']\"));\r\n            searchCityButton.click();\r\n            reportTestStep(driver, \"Clicked on Search Button\");\r\n\r\n            WebElement searchCityView = driver.findElement(By.xpath(\"\/\/android.support.v7.widget.ar[@resource-id='org.asdtm.goodweather:id\/search_view']\"));\r\n            searchCityView.click();\r\n            reportTestStep(driver, \"Clicked on Search view\");\r\n\r\n            WebElement searchCityEditText = driver.findElement(By.xpath(\"\/\/*[@resource-id='org.asdtm.goodweather:id\/search_src_text']\"));\r\n            searchCityEditText.sendKeys(\"Atlanta\");\r\n            reportTestStep(driver, \"Typed on Search view\");\r\n\r\n            waitForSeconds(5);\r\n\r\n            WebElement atlantaText = driver.findElement(By.xpath(\"\/\/*[@resource-id='org.asdtm.goodweather:id\/city_name']\"));\r\n            atlantaText.click();\r\n            reportTestStep(driver, \"Clicked on Atlanta Text view\");\r\n\r\n            \/\/ Interact with app menu\r\n            WebElement menu = driver.findElement(By.xpath(\"\/\/android.widget.ImageButton[@content-desc='Open navigation drawer']\"));\r\n            menu.click();\r\n            reportTestStep(driver, \"Clicked on Menu\");\r\n\r\n            WebElement closeButton = driver.findElement(By.xpath(\"\/\/android.widget.CheckedTextView[@text='Graphs']\"));\r\n            closeButton.click();\r\n            waitForSeconds(5);\r\n            reportTestStep(driver, \"Clicked on Graphs\");\r\n\r\n            WebElement updateButton = driver.findElement(By.id(\"org.asdtm.goodweather:id\/action_refresh\"));\r\n            updateButton.click();\r\n            reportTestStep(driver, \"Clicked on Refresh\");\r\n\r\n            reportTestcasePassed(driver, \"Success\");\r\n            quitDriver();\r\n        } catch (Exception e) {\r\n            System.out.println(e.getMessage());\r\n            e.printStackTrace();\r\n            try {\r\n                reportTestcaseFailed(driver, \"Failed\");\r\n                quitDriver();\r\n            } catch (Exception e1) {\r\n                System.out.println(e1.getMessage());\r\n                e1.printStackTrace();\r\n            }\r\n        }\r\n    }\r\n\r\n    private void startAndroidSession() throws IOException {\r\n        OkHttpClient client = new OkHttpClient.Builder().build();\r\n        RequestBody body = new MultipartBody.Builder()\r\n                .setType(MultipartBody.FORM)\r\n                .addFormDataPart(\"user_token\", \"your-user-token\")\r\n                .addFormDataPart(\"device_type\", \"android\")\r\n                .addFormDataPart(\"project_name\", \"test\")\r\n                .addFormDataPart(\"os_version\", \"14\")\r\n                .build();\r\n\r\n        Request request = new Request.Builder()\r\n                .url(\"http:\/\/example.testgrid.io\/api\/cap-builder\")\r\n                .method(\"POST\", body)\r\n                .build();\r\n\r\n        Response response = client.newCall(request).execute();\r\n        ReadContext ctx = JsonPath.parse(response.body().string());\r\n\r\n        if (ctx.read(\"$.status\", Boolean.class)) {\r\n            \/\/ Extract capabilities from API response\r\n            String appiumUrl = ctx.read(\"$.data.appium_url\");\r\n            DesiredCapabilities capabilities = new DesiredCapabilities();\r\n            capabilities.setCapability(\"deviceName\", ctx.read(\"$.data.device_name\"));\r\n            capabilities.setCapability(\"platformVersion\", ctx.read(\"$.data.platform_version\"));\r\n            capabilities.setCapability(\"platformName\", ctx.read(\"$.data.platform_name\"));\r\n            capabilities.setCapability(\"automationName\", ctx.read(\"$.data.automation_name\"));\r\n            capabilities.setCapability(\"udid\", ctx.read(\"$.data.udid\"));\r\n            capabilities.setCapability(\"tg:userToken\", ctx.read(\"$.data.user_token\"));\r\n            capabilities.setCapability(\"tg:projectName\", ctx.read(\"$.data.project_name\"));\r\n            capabilities.setCapability(\"systemPort\", ctx.read(\"$.data.system_port\"));\r\n            capabilities.setCapability(\"uiautomator2ServerLaunchTimeout\", \"90000\");\r\n\r\n            driver = new AndroidDriver&lt;&gt;(new URL(appiumUrl), capabilities);\r\n            System.out.println(\"Session started successfully.\");\r\n        } else {\r\n            String message = ctx.read(\"$.message\");\r\n            Assert.fail(message);\r\n        }\r\n    }\r\n\r\n    public void quitDriver() {\r\n        driver.quit();\r\n        System.out.println(\"Driver quit successfully.\");\r\n    }\r\n\r\n    public void waitForSeconds(int seconds) {\r\n        try {\r\n            Thread.sleep(seconds * 1000);\r\n        } catch (InterruptedException e) {\r\n            e.printStackTrace();\r\n        }\r\n    }\r\n}\r\n\r\n\r\n<\/pre>\n<h5>Key Highlights:<\/h5>\n<ol>\n<li><strong>Session Initialization<\/strong>:\n<ul>\n<li><code>startAndroidSession()<\/code> retrieves device details dynamically from the TestGrid Cap Builder API and starts a session using <code>AndroidDriver<\/code>.<\/li>\n<\/ul>\n<\/li>\n<li><strong>App Automation<\/strong>:\n<ul>\n<li>The script installs an APK, launches the app, and performs interactions like search and navigation.<\/li>\n<\/ul>\n<\/li>\n<li><strong>Error Handling<\/strong>:\n<ul>\n<li>Proper exception handling ensures test flow execution is logged and session cleanup happens in case of failures.<\/li>\n<\/ul>\n<\/li>\n<li><strong>Scalability<\/strong>:\n<ul>\n<li>The script dynamically fetches devices, making it suitable for parallel and distributed testing on TestGrid.<\/li>\n<\/ul>\n<\/li>\n<\/ol>\n","protected":false},"excerpt":{"rendered":"<p>Overview: This document outlines the process for executing test cases on TestGrid devices by dynamically allocating the first available device from the pool, rather than binding specific devices to individual test cases. This approach ensures efficient utilization of TestGrid resources, minimizes idle time for devices, and simplifies test case management by eliminating the need for [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","template":"","meta":{"_acf_changed":false,"footnotes":""},"epkb_post_type_1_category":[34,31],"epkb_post_type_1_tag":[],"class_list":["post-3879","epkb_post_type_1","type-epkb_post_type_1","status-publish","hentry","epkb_post_type_1_category-documentation","epkb_post_type_1_category-e2e-testing"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.3 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Dynamic Test Case Execution on TestGrid: Leveraging Random Device Allocation -<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/testgrid.io\/docs\/document\/dynamic-test-case-execution-on-testgrid-leveraging-random-device-allocation\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Dynamic Test Case Execution on TestGrid: Leveraging Random Device Allocation -\" \/>\n<meta property=\"og:description\" content=\"Overview: This document outlines the process for executing test cases on TestGrid devices by dynamically allocating the first available device from the pool, rather than binding specific devices to individual test cases. This approach ensures efficient utilization of TestGrid resources, minimizes idle time for devices, and simplifies test case management by eliminating the need for [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/testgrid.io\/docs\/document\/dynamic-test-case-execution-on-testgrid-leveraging-random-device-allocation\/\" \/>\n<meta property=\"article:modified_time\" content=\"2025-10-01T10:06:28+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/testgrid.io\/docs\/wp-content\/uploads\/2023\/12\/Step-1-3.png\" \/>\n\t<meta property=\"og:image:width\" content=\"1920\" \/>\n\t<meta property=\"og:image:height\" content=\"981\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data1\" content=\"3 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/testgrid.io\\\/docs\\\/document\\\/dynamic-test-case-execution-on-testgrid-leveraging-random-device-allocation\\\/\",\"url\":\"https:\\\/\\\/testgrid.io\\\/docs\\\/document\\\/dynamic-test-case-execution-on-testgrid-leveraging-random-device-allocation\\\/\",\"name\":\"Dynamic Test Case Execution on TestGrid: Leveraging Random Device Allocation -\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/testgrid.io\\\/docs\\\/#website\"},\"datePublished\":\"2024-12-06T12:54:17+00:00\",\"dateModified\":\"2025-10-01T10:06:28+00:00\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/testgrid.io\\\/docs\\\/document\\\/dynamic-test-case-execution-on-testgrid-leveraging-random-device-allocation\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/testgrid.io\\\/docs\\\/document\\\/dynamic-test-case-execution-on-testgrid-leveraging-random-device-allocation\\\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/testgrid.io\\\/docs\\\/document\\\/dynamic-test-case-execution-on-testgrid-leveraging-random-device-allocation\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/testgrid.io\\\/docs\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Dynamic Test Case Execution on TestGrid: Leveraging Random Device Allocation\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/testgrid.io\\\/docs\\\/#website\",\"url\":\"https:\\\/\\\/testgrid.io\\\/docs\\\/\",\"name\":\"\",\"description\":\"\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/testgrid.io\\\/docs\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Dynamic Test Case Execution on TestGrid: Leveraging Random Device Allocation -","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/testgrid.io\/docs\/document\/dynamic-test-case-execution-on-testgrid-leveraging-random-device-allocation\/","og_locale":"en_US","og_type":"article","og_title":"Dynamic Test Case Execution on TestGrid: Leveraging Random Device Allocation -","og_description":"Overview: This document outlines the process for executing test cases on TestGrid devices by dynamically allocating the first available device from the pool, rather than binding specific devices to individual test cases. This approach ensures efficient utilization of TestGrid resources, minimizes idle time for devices, and simplifies test case management by eliminating the need for [&hellip;]","og_url":"https:\/\/testgrid.io\/docs\/document\/dynamic-test-case-execution-on-testgrid-leveraging-random-device-allocation\/","article_modified_time":"2025-10-01T10:06:28+00:00","og_image":[{"width":1920,"height":981,"url":"https:\/\/testgrid.io\/docs\/wp-content\/uploads\/2023\/12\/Step-1-3.png","type":"image\/png"}],"twitter_card":"summary_large_image","twitter_misc":{"Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/testgrid.io\/docs\/document\/dynamic-test-case-execution-on-testgrid-leveraging-random-device-allocation\/","url":"https:\/\/testgrid.io\/docs\/document\/dynamic-test-case-execution-on-testgrid-leveraging-random-device-allocation\/","name":"Dynamic Test Case Execution on TestGrid: Leveraging Random Device Allocation -","isPartOf":{"@id":"https:\/\/testgrid.io\/docs\/#website"},"datePublished":"2024-12-06T12:54:17+00:00","dateModified":"2025-10-01T10:06:28+00:00","breadcrumb":{"@id":"https:\/\/testgrid.io\/docs\/document\/dynamic-test-case-execution-on-testgrid-leveraging-random-device-allocation\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/testgrid.io\/docs\/document\/dynamic-test-case-execution-on-testgrid-leveraging-random-device-allocation\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/testgrid.io\/docs\/document\/dynamic-test-case-execution-on-testgrid-leveraging-random-device-allocation\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/testgrid.io\/docs\/"},{"@type":"ListItem","position":2,"name":"Dynamic Test Case Execution on TestGrid: Leveraging Random Device Allocation"}]},{"@type":"WebSite","@id":"https:\/\/testgrid.io\/docs\/#website","url":"https:\/\/testgrid.io\/docs\/","name":"","description":"","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/testgrid.io\/docs\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"}]}},"_links":{"self":[{"href":"https:\/\/testgrid.io\/docs\/wp-json\/wp\/v2\/epkb_post_type_1\/3879","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/testgrid.io\/docs\/wp-json\/wp\/v2\/epkb_post_type_1"}],"about":[{"href":"https:\/\/testgrid.io\/docs\/wp-json\/wp\/v2\/types\/epkb_post_type_1"}],"author":[{"embeddable":true,"href":"https:\/\/testgrid.io\/docs\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/testgrid.io\/docs\/wp-json\/wp\/v2\/comments?post=3879"}],"version-history":[{"count":6,"href":"https:\/\/testgrid.io\/docs\/wp-json\/wp\/v2\/epkb_post_type_1\/3879\/revisions"}],"predecessor-version":[{"id":5187,"href":"https:\/\/testgrid.io\/docs\/wp-json\/wp\/v2\/epkb_post_type_1\/3879\/revisions\/5187"}],"wp:attachment":[{"href":"https:\/\/testgrid.io\/docs\/wp-json\/wp\/v2\/media?parent=3879"}],"wp:term":[{"taxonomy":"epkb_post_type_1_category","embeddable":true,"href":"https:\/\/testgrid.io\/docs\/wp-json\/wp\/v2\/epkb_post_type_1_category?post=3879"},{"taxonomy":"epkb_post_type_1_tag","embeddable":true,"href":"https:\/\/testgrid.io\/docs\/wp-json\/wp\/v2\/epkb_post_type_1_tag?post=3879"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}