Sunday, April 02, 2017

Testing Android UI Performance

In a previous post, we were analyzing how to Detect memory leaks on Android apps. That is a very important step in testing and analyzing your application's performance.
Once you are done, you may want to sure that user interactions with your app are smooth, and they run at a consistent 60 frames per second mark.

We will explain here how AndroidViewClient/culebra can help automating and simplifying some steps that usually require manual interaction. In such way, you can measure UI performance, and produce charts that will help you understand and locate the problems 

Latest AndroidViewClient/culebra versions have introduced the ability to plot some metrics from your device or emulator directly. The Dumpsys module obtains and parses dumpsys information to greatly facilitate its usage converting it to objects.

def __plot_dumpsys_gfxinfo(self, pkg):
    self.plot.append(Dumpsys(self.device,        Dumpsys.GFXINFO, pkg, Dumpsys.FRAMESTATS)) \
        .plot(_type=Dumpsys.FRAMESTATS)

This helper method (that can be found in AndroidViewClient/culebra tests) appends to the plot the framestats information obtained from dumpsys gfxinfo for the given package pkg. Then it creates the histogram chart.

This first chart shows the information obtained by running OPEN LIST VIEW from Automated Performance Testing after scrolling the lists.


 This second chart is then obtained by running OPEN RECYCLER VIEW from the same example.

The vertical lines indicate 60 and 30 FPS respectively.
In this case, the improvements made by the RecyclerView are obvious.

As always, you can find more information about AndroidViewClient/culebra in its wiki at https://github.com/dtmilano/AndroidViewClient/wiki, about CulebraTester at http://culebra.dtmilano.com/ and https://github.com/dtmilano/CulebraTester-public/wiki and if you have any question you can ask in Stackoverflow using http://stackoverflow.com/questions/tagged/androidviewclient.



 

No comments: