当前位置: X-MOL 学术J. Comput. Sci. Tech. › 论文详情
Our official English website, www.x-mol.net, welcomes your feedback! (Note: you will need to create a separate account there.)
Automatically Identifying Calling-Prone Higher-Order Functions of Scala Programs to Assist Testers
Journal of Computer Science and Technology ( IF 1.2 ) Pub Date : 2020-11-01 , DOI: 10.1007/s11390-020-0526-y
Yi-Sen Xu , Xiang-Yang Jia , Fan Wu , Lingbo Li , Ji-Feng Xuan

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.

中文翻译:

自动识别 Scala 程序中容易调用的高阶函数以协助测试人员

为了互联网件的快速发展,可以使用函数式编程语言,如 Haskell 和 Scala,来实现复杂的特定领域应用程序。在函数式编程语言中,高阶函数是将函数作为参数或返回函数的函数。在程序中使用高阶函数可以增加通用性,减少源代码的冗余。要测试高阶函数,测试人员需要检查需求并编写另一个函数作为测试输入。然而,由于高阶函数的结构复杂,测试高阶函数是一项耗时耗力的工作。测试人员必须花费大量的人工来测试所有高阶函数。如果时间预算有限,这种测试是不可行的,例如项目发布之前的一段时间。实际上,并不是每个高阶函数都会被真正调用。我们将即将被调用的高阶函数称为易调用函数。应首先测试易于调用的高阶函数。在本文中,我们提出了一种自动方法,即Phof,它预测将来是否会调用Scala程序的高阶函数,即识别容易调用的高阶函数。我们的方法可以帮助测试人员减少被测 Scala 程序的高阶函数的数量。在 Phof 中,我们从源代码和日志中提取了 24 个特征,以训练基于已知高阶函数调用的预测模型。我们对来自 27 个实际 Scala 项目的 4 832 个高阶函数进行了经验评估。实验结果表明,基于随机森林算法和合成少数过采样技术处理策略(SMOTE)的Phof在预测高阶函数的调用方面表现良好。我们的工作可用于支持有限测试资源的调度。
更新日期:2020-11-01
down
wechat
bug