Automatically Identifying Calling-Prone Higher-Order Functions of Scala Programs to Assist Testers
- PDF / 712,516 Bytes
- 17 Pages / 595 x 842 pts (A4) Page_size
- 52 Downloads / 205 Views
Automatically Identifying Calling-Prone Higher-Order Functions of Scala Programs to Assist Testers Yi-Sen Xu1 , Xiang-Yang Jia1 , Member, CCF, Fan Wu2 , Lingbo Li2 , and Ji-Feng Xuan1,∗ , Member, CCF, ACM, IEEE 1 2
School of Computer Science, Wuhan University, Wuhan 430072, China Turing Intelligence Technology Limited, London, EC2Y 9ST, U.K.
E-mail: {xuyisen, jxy}@whu.edu.cn; {fan, lingbo}@turintech.ai; [email protected] Received April 11, 2020; revised October 31, 2020. Abstract For the rapid development of internetware, functional programming languages, such as Haskell and Scala, can be used to implement complex domain-specific applications. In functional programming languages, a higher-order function is a function that takes functions as parameters or returns a function. Using higher-order functions in programs can increase the generality and reduce the redundancy of source code. To test a higher-order function, a tester needs to check the requirements and write another function as the test input. However, due to the complex structure of higher-order functions, testing higher-order functions is a time-consuming and labor-intensive task. Testers have to spend an amount of manual effort in testing all higher-order functions. Such testing is infeasible if the time budget is limited, such as a period before a project release. In practice, not every higher-order function is actually called. We refer to higher-order functions that are about to be called as calling-prone ones. Calling-prone higher-order functions should be tested first. In this paper, we propose an automatic approach, namely Phof, which predicts whether a higher-order function of Scala programs will be called in the future, i.e., identifying calling-prone higher-order functions. Our approach can assist testers to reduce the number of higher-order functions of Scala programs under test. In Phof, we extracted 24 features from source code and logs to train a predictive model based on known higher-order function calls. We empirically evaluated our approach on 4 832 higher-order functions from 27 real-world Scala projects. Experimental results show that Phof based on the random forest algorithm and the Synthetic Minority Oversampling Technique Processing strategy (SMOTE) performs well in the prediction of calls of higher-order functions. Our work can be used to support the scheduling of limited test resources. Keywords
1
higher-order function, testing tool, test management, Scala program, internetware
Introduction
Internetware, a widely-used software paradigm, connects domain applications via Internet-based computing [1, 2] . For the rapid development of internetware, functional programming languages, such as Haskell, Scala, and Lisp, can be used to implement complex domain-specific applications. As an important feature of functional programming languages, higher-
order functions are a family of functions that take functions as inputs or return functions. Due to the high scalability, algorithms written in higher-order functions can be generalized by cha
Data Loading...