“Generating Fixtures for JavaScript Unit Testing”, Amin Milani Fard, Ali Mesbah, and Eric Wohlstadter.
In Proceedings of the IEEE/ACM International Conference on Automated Software Engineering (ASE), 11 pages, 2015
[PDF

Abstract

In today’s web applications, JavaScript code interacts with the Document Object Model (DOM) at runtime. This runtime interaction between JavaScript and the DOM is error-prone and challenging to test. In order to unit test a JavaScript function that has read/write DOM operations, a DOM instance has to be provided as a test fixture. This DOM fixture needs to be in the exact structure expected by the function under test. Otherwise, the test case can terminate prematurely due to a null exception. Generating these fixtures is challenging due to the dynamic nature of JavaScript and the hierarchical structure of the DOM. We present an automated technique, based on dynamic symbolic execution, which generates test fixtures for unit testing JavaScript functions. Our approach is implemented in a tool called Confix. Our empirical evaluation shows that Confix can effectively generate tests that cover DOM-dependent paths. We also find that Confix yields considerably higher coverage compared to an existing JavaScript input generation technique.

BibTeX

@inproceedings{amin:ase15,
  author = {Fard, Amin Milani and Mesbah, Ali and Wohlstadter, Eric},
  title = {Generating Fixtures for {JavaScript} Unit Testing},
  booktitle = {Proceedings of the IEEE/ACM International Conference on Automated Software Engineering (ASE)},
  publisher = {IEEE Computer Society},
  pages = {11 pages},
  year = {2015},
  url = {http://salt.ece.ubc.ca/publications/docs/ase15-confix.pdf}
}