Test Execution with Android Auto
Android Auto testing requires a connection to the head unit server and interaction through supported commands. This guide walks you through the setup process and provides details on how to ensure compatibility with various devices. Android Auto tests are designed to validate in-car infotainment system behavior through automated scripts, simplifying the validation of touch interactions and screenshots.
How to Set Up Manually: Head Unit Server
Android Auto testing requires enabling developer mode on the Android Auto app and starting the built-in Head Unit Server.
Enable Android Auto developer mode
Start head unit server - (Only 1-3 sections)
Android auto tests doesn't work on Oneplus devices since headunit server cannot run on android device while usb debugging is on.
Create Android Auto Test
Run android auto test using this desired capability-
digitalai:automotiveProjection ("widthxheight")
, using one of these options: 800x480, 1280x720, 1920x1080
Supported Commands
- Tap Command
Sends a tap command to a specific coordinate on the screen.
driver.executeScript("digitalai:automotive.tap",800,479)
;
x: X-coordinate of the tap
y: Y-coordinate of the tap
- GetScreenshot
String base64String= (String) driver.executeScript("digitalai:automotive.getScreenshot");
can be converted to a file using this code
// Write the byte array to the output PNG file
try (FileOutputStream fos = new FileOutputStream("screenshot12.png")) {
fos.write(decodedBytes);
} catch (IOException e) {
throw new RuntimeException(e);
}
Automotive Test Report
Once the test execution is completed and the cloud is configured with a reporter, the DHU video recording will be published in the test video report in the reporter.
The device video will be uploaded as an attachment to the test report: