[appium-device-farm-13] — Complete Details on How to Allocate a ‘build name’ in “Device Farm” dashboard

Get a step-by-step walkthrough in the video below!
Allocating a ‘Build Name’ in the Appium Device Farm dashboard is crucial for organizing, tracking, and debugging multiple test sessions effectively. Each build name acts as a label that groups related test executions, enabling better visibility and reporting.
In this guide, you’ll learn:
- What a “Build Name” is
- How to configure it via DesiredCapabilities or config file
- How it reflects in the Device Farm dashboard
What is a “Build Name”?
The df:build
is a tag that helps you group test sessions belonging to the same CI job, feature, release, or sprint. It's especially useful in dashboards where many sessions run across different teams or purposes.
Example use cases:
login-feature-regression
v1.2.3-smoke-test
release-candidate-qa
How to Allocate a Build Name
Method 1: Via Desired Capabilities (Recommended)
Add the capability df:build
to your test script. Here's how you can configure it in Java:
UiAutomator2Options cap=new UiAutomator2Options();
cap.setPlatformName("android");
cap.setAutomationName("uiautomator2");
cap.setDeviceName("Pixel9");
//To allocate build name
cap.setCapability("df:build","RegressionTest_V2.10");
driver = new AndroidDriver(new URL("http://127.0.0.1:4723/wd/hub"), cap);
driver.manage().timeouts().implicitlyWait(Duration.ofSeconds(10));
// Allocate a custom build name
cap.setCapability("df:build","RegressionTest_V2.10");
This will tag your session with “RegressionTest_V2.10" under the Builds section in the Device Farm dashboard.
Method 2: In Configuration File (
appium-config.json
)
If you are running tests via the Appium CLI with Device Farm plugin:
{
"server": {
"port": 4723,
"plugin": {
"device-farm": {
"df:build": "RegressionTest_V2.10"
}
}
}
}
Complete Example with Script & Device-farm Screenshot:
“Complete Code: Optimized and Ready to Use”:
package com.appiumguide.devicefarm;
import org.openqa.selenium.JavascriptExecutor;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.remote.RemoteWebElement;
import org.testng.annotations.AfterClass;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
import com.google.common.collect.ImmutableMap;
import io.appium.java_client.AppiumBy;
import io.appium.java_client.android.AndroidDriver;
import io.appium.java_client.android.options.UiAutomator2Options;
import java.net.*;
import java.time.Duration;
/**
* Script Details - "appium-device-farm”- Complete Details on How to Allocate a ‘build name’ in “Appium Device Farm” dashboard
*
* appium-java-client version: 9.5.0
*
* @author 'Ramesh Kodumuru' for AppiumGuide [appiumguide@gmail.com]
*/
public class devicefarm_BuildNameDemo {
private AndroidDriver driver;
WebElement dragelement,dropelement;
@BeforeClass
public void setup() throws MalformedURLException {
UiAutomator2Options cap=new UiAutomator2Options();
cap.setPlatformName("android");
cap.setAutomationName("uiautomator2");
cap.setDeviceName("Pixel9");
//To allocate build name
cap.setCapability("df:build","RegressionTest_V2.10");
driver = new AndroidDriver(new URL("http://127.0.0.1:4723/wd/hub"), cap);
driver.manage().timeouts().implicitlyWait(Duration.ofSeconds(10));
}
@Test
public void test1() throws InterruptedException {
driver.activateApp("com.wdiodemoapp");
Thread.sleep(5000);
driver.findElement(AppiumBy.androidUIAutomator("new UiSelector().text(\"Drag\")")).click();
dragelement=driver.findElement(AppiumBy.androidUIAutomator("new UiSelector().className(\"android.widget.ImageView\").instance(4)"));
dropelement=driver.findElement(AppiumBy.androidUIAutomator("new UiSelector().className(\"android.view.ViewGroup\").instance(10)"));
int eX=(int)(dropelement.getRect().getX());
int eY=(int)(dropelement.getRect().getY());
//Perform Drag gesture based on element id, endX & endY co-ordinates
System.out.println("Perform Drag gesture based on element id, endX & endY co-ordinates");
((JavascriptExecutor) driver).executeScript("mobile: dragGesture",ImmutableMap.of("elementId",((RemoteWebElement) dragelement).getId(),
"endX",eX,
"endY",eY));
Thread.sleep(3000);
dragelement=driver.findElement(AppiumBy.androidUIAutomator("new UiSelector().className(\"android.widget.ImageView\").instance(7)"));
int sX=(int)(dragelement.getRect().getX());
int sY=(int)(dragelement.getRect().getY());
dropelement=driver.findElement(AppiumBy.androidUIAutomator("new UiSelector().className(\"android.view.ViewGroup\").instance(8)"));
int eX1=(int)(dropelement.getRect().getX());
int eY1=(int)(dropelement.getRect().getY());
//Perform Drag gesture based on element id, startX,startY,endX & endY co-ordinates
System.out.println("Perform Drag gesture based on element id, startX,startY,endX & endY co-ordinates");
((JavascriptExecutor) driver).executeScript("mobile: dragGesture",ImmutableMap.of(
"startX",sX,
"startY",sY,
"endX",eX1,
"endY",eY1));
Thread.sleep(3000);
////Perform Drag gesture based on element id,endX,endY co-ordinates and Speed
dragelement=driver.findElement(AppiumBy.androidUIAutomator("new UiSelector().className(\"android.widget.ImageView\").instance(1)"));
dropelement=driver.findElement(AppiumBy.androidUIAutomator("new UiSelector().className(\"android.view.ViewGroup\").instance(10)"));
int eX2=(int)(dropelement.getRect().getX());
int eY2=(int)(dropelement.getRect().getY());
int speedvalue=(int)(100*2.625);
System.out.println("Perform Drag gesture based on element id,endX,endY co-ordinates and Speed");
((JavascriptExecutor) driver).executeScript("mobile: dragGesture",ImmutableMap.of("elementId",((RemoteWebElement) dragelement).getId(),
"endX",eX2,
"endY",eY2,
"speed",speedvalue));
Thread.sleep(3000);
}
@AfterClass
public void teardown() {
if(driver!=null) {
driver.quit();
System.out.println("Test Execution Completed");
}
}
}
This will tag your session with “RegressionTest_V2.10” under the Builds section in the Device Farm dashboard.

Observe that in the Device-Farm Dashboard → Under Builds Tab,we able to find Build Name “RegressionTest_V2.10”
GitHub Link:
🎬 Explore More! Watch My Latest Videos on YouTube!
Visit My Official Blog:
No comments:
Post a Comment