Automated mock generation for JavaScript

OData support
Honfi Dávid
Department of Measurement and Information Systems

The increasing quality requirements of today’s software are getting more and more important. One goal of software testing is to meet these requirements. My thesis covers a part of this topic. I take up an important aspect of unit testing during my work, which is the isolation of dependencies with mocks. In my thesis, I create a mock generator tool for JavaScript environments, which can help developers by automatically isolating dependencies between modules.

I start my work with researching the related literature, during which I present the types of software testing. I emphasize unit testing which I used in the rest of the thesis. The paper touches on the importance of mock files, which can replace the original resource demanding dependencies during tests. I present the types of software analysis, which can be used for exploration of dependencies. I also introduce the tools, which I work with in this thesis. Furthermore, I show how I got familiar with the Jest test- and Jalangi2 analysis frameworks. I design a workflow of a mock generator tool, which is based on the acquired knowledge from the researched literature. The tool can work in two different ways that cover the most likely behaviors, which a mock can have. Also, I propose the structure of the tool I implemented during my work. Furthermore, I introduce the problems arised during the implementation as well as their solutions in detail. In the thesis, I introduce the step-by-step usage of the tool through an example project. Based on the acquired experiences, present recommendations for the further development of the implemented tool.

The most important results I achieved during my work are: the gaining domain knowledge in code analysis and unit testing, identifying problems with the creation of mocks in JavaScript, acquiring knowledge in code analysis of JavaScript with Jalangi2 tool, and designing and implementing a new mock generator tool for JavaScript based on Jalangi2.


Please sign in to download the files of this thesis.