“JSEFT: Automated JavaScript Unit Test Generation”, Shabnam Mirshokraie, Ali Mesbah, and Karthik Pattabiraman.
In Proceedings of the International Conference on Software Testing, Verification and Validation (ICST), 10 pages, 2015


The event-driven and highly dynamic nature of JavaScript, as well as its runtime interaction with the Document Object Model (DOM) make it challenging to test JavaScript-based applications. Current web test automation techniques target the generation of event sequences, but they ignore testing the JavaScript code at the unit level. Further they either ignore the oracle problem completely or simplify it through generic soft oracles such as HTML validation and runtime exceptions. We present a framework to automatically generate test cases for JavaScript applications at two complementary levels, namely events and individual JavaScript functions. Our approach employs a combination of function coverage maximization and function state abstraction algorithms to efficiently generate test cases. In addition, these test cases are strengthened by automatically generated mutation-based oracles. We empirically evaluate the implementation of our approach, called JSeft, to assess its efficacy. The results, on 13 JavaScript-based applications, show that the generated test cases achieve a coverage of 68 percent and that JSeft can detect injected JavaScript and DOM faults with a high accuracy (100 percent precision, 70 percent recall). We also find that JSeft outperforms an existing JavaScript test automation framework both in terms of coverage and detected faults.


  author = {Mirshokraie, Shabnam and Mesbah, Ali and Pattabiraman, Karthik},
  title = {JSEFT: Automated {JavaScript} Unit Test Generation},
  booktitle = {Proceedings of the International Conference on Software Testing, Verification and Validation (ICST)},
  publisher = {IEEE Computer Society},
  pages = {10 pages},
  year = {2015},
  url = {http://salt.ece.ubc.ca/publications/docs/icst15.pdf}