I want to test mobile app battery consumption on android. I am new to this. Is there anyone who can guide me about this?
You can use
adb to get battery consumption of your app by
adb shell dumpsys batterystats [your.package.name]
The result is very detail, so you may need to use
grep to fine grain information you want and then import result into your continuous integration.
If you only need to know an over view of battery usage for all your tests in a controlled environment,
adb shell dumpsys battery should be enough. You can grep the battery level by
adb shell dumpsys battery | grep level
You can have further information from The Android official site
Go to Settings > About phone > Battery Usage
- The top battery drainers:
Mobile apps are going to use battery, but some take it to the next level, and there is a common thread between those specific apps.
- Power-saver modes:
Check power saving mode in your mobile friends or foe..?
- Low battery Performance: Mobile app development and testing teams must also be aware of how an app performs on devices that do not throttle battery use when the tank is running on empty.