Device fragmentation means there are many different devices with various screen sizes, OS versions, and hardware. Why does this make testing mobile apps harder?
Think about how different devices might show or run the app differently.
Device fragmentation means many device types exist. Each may behave differently, so testers must check the app on many devices to ensure it works well everywhere.
Given many device types, which testing approach helps cover most device differences efficiently?
Think about balancing cost and coverage.
Using both emulators and real devices for a representative sample helps cover many device types without testing every single device physically.
Consider this Python code snippet that checks device compatibility based on OS version and screen size.
devices = [
{'name': 'DeviceA', 'os_version': 10, 'screen_size': 5.5},
{'name': 'DeviceB', 'os_version': 9, 'screen_size': 6.1},
{'name': 'DeviceC', 'os_version': 11, 'screen_size': 4.7}
]
compatible_devices = [d['name'] for d in devices if d['os_version'] >= 10 and d['screen_size'] >= 5.0]
print(compatible_devices)Check which devices have OS version 10 or higher and screen size 5.0 or larger.
DeviceA has OS 10 and screen 5.5 (meets both conditions). DeviceB has OS 9 (too low). DeviceC has OS 11 and screen 4.7 (screen too small). So only DeviceA qualifies.
You want to check if the app's main button width adjusts correctly on devices with screen width 320 and 480 pixels.
Given button_width is the actual width in pixels, which assertion is best?
screen_width = 320 # or 480 button_width = get_button_width(screen_width) # returns button width in pixels
The button should be 80% of the screen width.
Option B checks the button width is 80% of screen width, which matches the expected adaptive UI behavior. Others are incorrect or illogical.
In a test automation framework, which feature helps efficiently run tests on multiple device configurations to handle fragmentation?
Think about running the same test many times with different inputs.
Parameterization allows running the same test with various device parameters, covering many devices efficiently. Hardcoding or ignoring devices reduces coverage.