Battery Stress Testing on Androids Kristel Kruustük , Kristel is Testlio's co-founder. April 5th, 2017 As much as we love our technology, it has its limits. Just like we only have so much energy to go run a marathon (who am I kidding, I don’t run, I look like Jabba the Hutt), phones burn through a finite amount of energy resources used by apps before we need to fill them back up with juice. There are a lot of battery testing resources when it comes to Android application testing. There’s even a native battery analyzer that’s built into Android’s OS. Thankfully, there are also several apps in the Google Play store that’ll help narrow down your app’s battery usage. We’ve narrowed it down to some of our favorites. We also cover a sample battery testing cycle and suggest possibilities as to why your app might be using too much power. How To Test Battery Health On An Android Note that none of testing methods these requires root access, which is, for the intents and purposes of testing, just fine – most of your user base probably haven’t rooted their phones. 1. Android’s Built-In Battery App The native battery analyzer can analyze each application and identify the one that’s gulping down the most juice, which is immensely useful right out the gate. All Android builds have a native battery analyzer (accessible by going to Settings > Device > Battery). One of the most practical benefits of the native battery analyzer is its ubiquity; it comes preinstalled on all Android devices. If your test phone library has, say, 20 phones, you won’t have to install it individually on each phone. When you open this UI, you’ll see the charge amount, a list of your apps with a percentage of battery usage, and a time frame in days, hours, minutes, and seconds. For example 1d 9h 11m 7s. This functionality can give you some useful information, but it’s difficult to focus on your app at the precise moment you’re targeting because to reset the stats, you have to charge fully to 100% and then unplug the device. Doing that in a test cycle can be time-consuming, although the stats hold up for accuracy if you have the time. 2. GSam Battery Monitor Unlike the native Android battery analyzer, the GSam Battery Monitor can reset testing cycles on the fly, which means you don’t have to drain and recharge the battery to do your application’s power monitoring. Battery usage settings you can monitor include: App power usage since the phone was last unplugged, app power usage since the phone’s last full charge, and app power usage since the screen was last shut off. The most useful part about these features is that you don’t have to wait to fully charge to get an information reset, and the GSam Battery Monitor can also tell you which functions of your app cause the most battery use. Another helpful feature is that you can export your app’s analysis and send it via email, making it easy to import the information into project management software. Your product manager will breathe a little easier with all your development data in one place. 3. Clean Master Clean Master is another battery testing app with a particularly useful function: notifications. It’ll let you know if an app is battering (pun intended) the phone’s CPU or battery. Knowing that you’ll be notified with battery or CPU usage problems on the fly will give you more time to focus on other testing issues in the meantime. While CPU usage issues don’t necessarily have a direct correlation on battery use, the CPU Cooler in Clean Master’s Tools section is handy regardless. This will show if your app is overusing the CPU in any fashion. This tool can help you hunt down problems with the overall performance of your app, such as code or design issues. Examples of Application Functions That Might Tax Battery Ask yourself these questions if you’re concerned about potential battery abuse: Does your app handle large amounts of data to/from it? An example: Can users export or import a large file such as photos or video? Does your application handle streaming? Does your application do a lot of location checking? Does your app send analytic data from your app to a 3rd party like Google Analytics? Does your app frequently sync between the user and a server? Does your app use excessive wakelocks (when your app keeps the phone awake to send or receive data from your server – or another function)? We recommend you run Clean Master to monitor battery usage spikes just in case of any anomalies. Related: Testing the performance of mobile apps How to Perform Battery Testing Battery testing is something you’ll need to do in a methodical way. While every application is different, we’ve come up with an example of a mobile app testing workflow. Set your phone/app up for the test (get ready to sync, or get ready to download/export/stream, etc). Note your current battery stats (overall percentage, percentage used by your app currently, etc). Perform the test. Note the new battery stats. Keep a log of this data for comparison purposes. Repeat testing for any features/functions that could potentially be problematic. Do this testing with varying levels of overall battery (low/half/full), noting any differences along the way. Confirm that your app’s other features/functions are working properly. For example, if your user turns off location checking in an application that needs geographic information, what happens to battery usage? When it comes down to testing your app’s battery drainage and stress testing, using different angles of attack is the best approach. Each of these monitoring services we mentioned will help you get a better fix on what you need to improve upon, and with mobile apps, it’s all about efficiency. Want to take your QA testing to the next level? Try a free demo with us.