一句话:提出 ARTE,首个基于语义的方法,利用 API 规范与知识库为 Web API 参数自动生成真实测试输入。
自动测试 Web API 需要为诸如地址、坐标或国家代码等参数生成输入数据,而随机生成对这些类型的参数很难产生有意义的值,这成为当前测试用例生成方法的主要障碍。本文提出 ARTE,这是首个基于语义的、为 Web API 自动生成真实测试输入的方法。ARTE 利用被测 API 的规范,在 DBpedia 等知识库中为 API 参数搜索有意义的测试输入。该方法已集成到先进的 API 测试工具 RESTest 中,实现了前所未有的自动化水平,相比现有 fuzzing 技术最多可多生成 100% 的有效 API 调用,平均多 30%。在 26 个真实 API 上的评估表明,ARTE 能为每 10 个参数中的 7 个生成真实输入,优于相关方法。
Testing web APIs automatically requires generating input data values such as addressess, coordinates or country codes. Generating meaningful values for these types of parameters randomly is rarely feasible, which means a major obstacle for current test case generation approaches. In this paper, we present ARTE, the first semantic-based approach for the Automated generation of Realistic TEst inputs for web APIs. Specifically, ARTE leverages the specification of the API under test to search for meaningful test inputs for the API parameters in knowledge bases like DBpedia. Our approach has been integrated into RESTest, a state-of-the-art tool for API testing, achieving an unprecedented level of automation which allows to generate up to 100% more valid API calls than existing fuzzing techniques, 30% on average. Evaluation results on a set of 26 real-world APIs show that ARTE can generate realistic inputs for 7 out of every 10 parameters, outperforming related approaches.