Browser's Memory Profiling Automation

Lucy Liu · Theseus (Ammattikorkeakoulujen) · 2017

This is a commission thesis done for Comptel Oyj’s Necterday UI Platform, Team Terra. The commissioning party wanted to have automated memory profiling for browser so it would be easier for the developers to see the quality of their code and fix the possible memory leaks. Memory leak happens when the memory that is allocated to perform some operation is not freed after that given operation is completed, resulting in that the program will eventually use up all the memory that it needs to work normally. We can do memory profiling manually by using browser’s developer tools to record the performance. During the recording user should interact with the application and repeat the same actions for multiple times to get better feedback. Developer tool is able to draw a graph where user can see how much memory has been allocated. Usually it is recommended to suspect memory leak when the graph resembles a sawtooth curve. Automation has many advantages, but most importantly it saves developers or testers time. Especially tests that need a lot of precise inputs are better handled automatically than manually. To be even thinking about automation, one should have the manual testing side in “flawless” state. Automation initial cost is high and it is not cheap to change or alter the test cases. As there has been no previous attempts to do this memory profiling automation, at least in Team Terra, we have to pretty much start from the zero and do the basic research and planning. In this work, we use Team Terra’s current tools for testing and development, but also introduce some new tools to get the log of memory profiling visualized. In the implementation, we use Google Chrome’s command line flags to start the memory profiling from command console. First, we run this command along with automated unit tests using Karma, then we do the same for automated functional tests that are handled by Nightwatch.js. These commands will give us profiling log file that is in raw JSON-format. The file has to be translated into valid JSON, it includes irrelevant information also, so we have to parse the data and create new file. We chose ElasticSearch and Kibana, to be our database and user interface tool for showing infographic based on the data, respectively. In our parsing-script we also send the new data to the database where the UI tool, Kibana, gets that data and draws charts according to it. In the end, we use Jenkins CI to do the final automation so it runs this whole process with given bash commands on certain time intervals.

Read the paper · More papers on PaperTik