Skip to main content

Test Android app battery consumption with Battery Historian Tool


Requirement:- 

1. Android ADB
2. Download the open source Battery Historian python script from GitHub.
3. Unzip the file to extract the Battery Historian folder. Inside the folder, find the historian.py file and move it to the Android SDK platform-tools folder.           

Steps:-

1.  Connect your mobile device to the computer.
2.  On your computer, open a terminal window.
3.  Change to the directory where you have saved historian.py.
      D:\Android\sdk\platform-tools>
4.  Shut down your running adb server.
      >adb kill-server
5.  Restart your adb server.
       D:\Android\sdk\platform-tools>adb start-server
6.  Check for connected devices.
       D:\Android\sdk\platform-tools>adb devices
7.  Reset battery data gathering.
     D:\Android\sdk\platform-tools>adb shell dumpsys batterystats --reset
     Output: - Battery Stats reset
     Note : - Resetting erases old battery collection data; otherwise, the output will be huge.
9.  Disconnect your device from your computer so that you are only drawing current from 
     the device's battery.   
10.Play with your app for short time.
11.Reconnect your phone to your computer and make sure your phone is recognized.
      D:\Android\sdk\platform-tools>adb devices
12.Dump all the battery data. This can take a while:
      D:\Android\sdk\platform-tools>adb shell dumpsys batterystats > batterystats.txt
      Output:- "Failed to get bug report's version, which is only available on devices
      running Android 7.0 or later. Trying a plain-text bug report instead".
      You will get this message if you are running Android version 5 or 6.
13.Create HTML version of the data dump for Battery Historian.
     D:\Android\sdk\platform-tools>historian.py bugreport.txt>Vijayblogappbatterystats.html
14.Go to writable directory folder i.e. Android SDK platform-tools and find 
      "Vijayblogappbatterystats.html"
15.Open the "Vijayblogappbatterystats.html" file in your browser.



  

Comments

Popular posts from this blog

Collect console logs for iOS devices

Mostly I work in a windows environment and it is necessary to get console logs for iOS devices to find out the root cause of the issue. We can get iOS app crash log from this path ( C:\Users\AppData\Roaming\Apple Computer\Logs\CrashReporter\MobileDevice\DSS-Iphone 6 ) in windows machine using iTunes. But we need an entire app log to understand what goes wrong in the application. And after some research, I found iTools which allow you to manage iOS devices and also show entire device logs. This tool helps me to do my testing. As per my understanding, this tool will not run without iTunes. iTools was also affected by the latest iTunes update. Now I have found some other tool called 'iOSLogInfo'. Download and run iOSLogInfo to get console log for iOS devices in windows. Requirements:- iOSLogInfo ( Download link - https://www.blackberry.com/blackberrytraining/web/KB_Resources/KB36986_iOSLogInfo_4.3.4.zip    ) iTunes for windows Steps:- Download and save iOSLogInfo z

Android Application Automation Testing using MonkeyTalk IDE Professional

Steps to install and run the MonkeyTalk scripts 1. Download Monkey Talk IDE and AspectJ from given link:     https://www.cloudmonkeymobile.com/monkeytalk     Download Eclipse 4.3.1 or 4.3.2 (for Windows) from given link and copy in    your C Drive.     https://www.eclipse.org/downloads/packages/eclipse-standard-432/keplersr2 2. Launch Eclipse and install AspectJ for respective eclipse version.      aspectj - http://download.eclipse.org/tools/ajdt/37/update 3. Now get the app source code from your developer which you want to test and import it in eclipse. 4. Right Click on your project >> Configure >> Convert to AspectJ project.      5. Check you have "libs" folder or not.If you have then OK or else create a new "libs" folder. 6. Now open Monkey Talk\monkeytalk\agents\android\ monkeytalk-agent-2.0.5.jar folder that we downloaded in step 1. Drag & copy the agent.jar file in libs folder. 7. Now Right Click on newly c

MIND MAP - A ULTIMATE THINKING TOOL FOR SOFTWARE TESTING

I am the only tester in my team testing all Android, iOS and web projects. Traditional way to prepare test documentations like test strategy, Test Plan and test cases takes  more time. It's not possible for me to keep track all the features I have tested and need to test when I am having a multiple project's release on the same day . Still doing conventional approach of testing, i.e. maintain and execute test cases and mark them as "Pass/Fail". Getting limited time for testing because of maintaining all these test documents. In some releases I have missed lots of scenarios/functionalities to test due to less time for testing and this makes me unhappy after every release. After a long search I came to know the blog about "Mobile Testing Mind Map" in adventuresinqa.com.  A mind map technique helped me to design rapid, clear, higher coverage and more efficient test cases using mind map technique. Then, I started using this technique for all the projects.