• DocumentCode
    3722984
  • Title

    Generating Fixtures for JavaScript Unit Testing (T)

  • Author

    Amin Milani Fard;Ali Mesbah;Eric Wohlstadter

  • Author_Institution
    Univ. of British Columbia, Vancouver, BC, Canada
  • fYear
    2015
  • Firstpage
    190
  • Lastpage
    200
  • 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.
  • Keywords
    "Testing","Runtime","HTML","Fixtures","Computer bugs","Concrete","Generators"
  • Publisher
    ieee
  • Conference_Titel
    Automated Software Engineering (ASE), 2015 30th IEEE/ACM International Conference on
  • Type

    conf

  • DOI
    10.1109/ASE.2015.26
  • Filename
    7372008