Enhancing REST API Testing with NLP Techniques

Enhancing REST API Testing with NLP Techniques
复制标题

DOI:
10.1145/3597926.3598131
复制
发表时间:
2023-07
期刊:
Proceedings of the 32nd ACM SIGSOFT International Symposium on Software Testing and Analysis
影响因子:
--
通讯作者:
Myeongsoo Kim;Davide Corradini;S. Sinha;A. Orso;Michele Pasqua;Rachel Tzoref;M. Ceccato
Myeongsoo Kim;Davide Corradini;S. Sinha;A. Orso;Michele Pasqua;Rachel Tzoref;M. Ceccato
中科院分区:
其他
文献类型:
--
作者:
Myeongsoo Kim;Davide Corradini;S. Sinha;A. Orso;Michele Pasqua;Rachel Tzoref;M. Ceccato

文献摘要

相似文献

RESTful服务通常使用OpenAPI规范进行记录。尽管已经提出了许多自动化测试技术,利用这些规范的机器可读部分来指导测试生成,但它们的人类可读部分大多被忽视了。这是一个错失的机会,因为规范中的自然语言描述通常包含相关信息,包括示例值和参数间依赖关系,这些信息可用于改进测试生成。本着这种精神,我们提出了NLPtoREST,这是一种应用自然语言处理技术来辅助REST API测试的自动化方法。给定一个API及其规范,NLPtoREST从规范的可读部分提取额外的OpenAPI规则。然后,通过添加这些规则来增强原始规范,测试工具可以透明地使用增强的规范来执行更好的测试用例生成。由于自然语言的内在模糊性或文档与实现之间的不匹配,规则提取可能不准确,因此NLPtoREST还包含了一个旨在消除虚假规则的验证步骤。我们进行了研究来评估我们的规则提取和验证方法的有效性,以及增强规范对八种最先进的REST API测试工具性能的影响。我们的结果是令人鼓舞的,并表明NLPtoREST可以提取许多相关的规则,具有较高的准确性,这反过来可以显着提高测试工具的性能。
RESTful services are commonly documented using OpenAPI specifications. Although numerous automated testing techniques have been proposed that leverage the machine-readable part of these specifications to guide test generation, their human-readable part has been mostly neglected. This is a missed opportunity, as natural language descriptions in the specifications often contain relevant information, including example values and inter-parameter dependencies, that can be used to improve test generation. In this spirit, we propose NLPtoREST, an automated approach that applies natural language processing techniques to assist REST API testing. Given an API and its specification, NLPtoREST extracts additional OpenAPI rules from the human-readable part of the specification. It then enhances the original specification by adding these rules to it. Testing tools can transparently use the enhanced specification to perform better test case generation. Because rule extraction can be inaccurate, due to either the intrinsic ambiguity of natural language or mismatches between documentation and implementation, NLPtoREST also incorporates a validation step aimed at eliminating spurious rules. We performed studies to assess the effectiveness of our rule extraction and validation approach, and the impact of enhanced specifications on the performance of eight state-of-the-art REST API testing tools. Our results are encouraging and show that NLPtoREST can extract many relevant rules with high accuracy, which can in turn significantly improve testing tools’ performance.