Espresso Testing Framework - UI Performance



Positive User experience plays a very important role in the success of an application. User experience not only involves beautiful user interfaces but also how fast those beautiful user interfaces are rendered and what is the frame per second rate. User interface needs to run consistently at 60 frames per second to give good user experience.

Let us learn some of the option available in the android to analyze UI performance in this chapter.

dumpsys

dumpsys is an in-built tool available in the android device. It outputs current information about the system services. dumpsys has the option to dump information about particular category. Passing gfxinfo will provide animation information of the supplied package. The command is as follows,

> adb shell dumpsys gfxinfo <PACKAGE_NAME>

framestats

framestats is an option of the dumpsys command. Once dumpsys is invoked with framestats, it will dump detailed frame timing information of recent frames. The command is as follows,

> adb shell dumpsys gfxinfo <PACKAGE_NAME> framestats

It outputs the information as CSV (comma separated values). The output in CSV format helps to easily push the data into excel and subsequently extract useful information through excel formulas and charts.

systrace

systrace is also an in-build tool available in the android device. It captures and displays execution times of the application processes. systrace can be run using the below command in the android studio’s terminal,

python %ANDROID_HOME%/platform-tools/systrace/systrace.py --time=10 -o
my_trace_output.html gfx view res
Advertisements