Generating Fixtures for Java']JavaScript Unit Testing

被引:12
作者
Fard, Amin Milani [1 ]
Mesbah, Ali [1 ]
Wohlstadter, Eric [1 ]
机构
[1] Univ British Columbia, Vancouver, BC, Canada
来源
2015 30TH IEEE/ACM INTERNATIONAL CONFERENCE ON AUTOMATED SOFTWARE ENGINEERING (ASE) | 2015年
关键词
Test fixture; test generation; dynamic symbolic execution; concolic execution; DOM; !text type='Java']Java[!/text]Script; web applications;
D O I
10.1109/ASE.2015.26
中图分类号
TP31 [计算机软件];
学科分类号
081202 ; 0835 ;
摘要
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 errorprone 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.
引用
收藏
页码:190 / 200
页数:11
相关论文
共 29 条
  • [1] Understanding Java']JavaScript Event-Based Interactions
    Alimadadi, Saba
    Sequeira, Sheldon
    Mesbah, Ali
    Pattabiraman, Karthik
    [J]. 36TH INTERNATIONAL CONFERENCE ON SOFTWARE ENGINEERING (ICSE 2014), 2014, : 367 - 377
  • [2] Alshraideh Mohammad, 2008, Journal of Computer Sciences, V4, P1012, DOI 10.3844/jcssp.2008.1012.1019
  • [3] Artzi S, 2011, 2011 33RD INTERNATIONAL CONFERENCE ON SOFTWARE ENGINEERING (ICSE), P571, DOI 10.1145/1985793.1985871
  • [4] Benedikt Michael., 2005, PODS, P25, DOI DOI 10.1145/1065167.1065172
  • [5] Clark J., 1999, XML path language (XPath) version 1.0
  • [6] Fard A. M., 2014, Proceedings of the 29th ACM/IEEE International Conference on Automated Software Engineering, ASE'14, P67
  • [7] Fard A. M., 2013, PROC IEEE 24 INT S S, P278
  • [8] Efficient Static Analysis of XML Paths and Types
    Geneves, Pierre
    Layaida, Nabil
    Schmitt, Alan
    [J]. PLDI'07: PROCEEDINGS OF THE 2007 ACM SIGPLAN CONFERENCE ON PROGRAMMING LANGUAGE DESIGN AND IMPLEMENTATION, 2007, : 342 - 351
  • [9] Gibbs, 2013, P 2013 9 JOINT M FDN, P488, DOI DOI 10.1145/2491411.2491447
  • [10] GitHut, 2015, SMALL PLAC DISC LANG