利用 API 响应进行测试细化
Utilizing API Response for Test Refinement
AI总结:
本文提出一种利用API响应消息的动态测试细化方法,通过智能体迭代添加约束修复测试场景,减少4xx响应并提高覆盖率,优于现有搜索式工具。
摘要:
大多数 Web 服务以 RESTful API 的形式提供。这引发了对 API 测试的活跃研究兴趣,以确保这些服务的可靠性。虽然过去提出的大多数测试技术依赖 API 规范生成测试用例,但这种方法的一个主要局限是:在规范不完整或不一致的情况下,测试用例可能不切实际,并会因无效输入导致大量 4xx 响应。这表明测试质量较差。基于学习的方法可以学习有效输入,但通常需要大量请求-响应对来学习约束,使其无法在工业界直接使用。为了解决这一局限,本文提出了一种利用响应消息的动态测试细化方法。响应用于推断 API 测试流程中需要修复测试场景的位置。该方法使用智能体向 API 规范添加约束,进一步用于生成考虑从响应中学习到的约束的测试场景。遵循贪婪方法,从 API 测试系统中获得测试场景的迭代学习和细化。所提方法减少了 4xx 响应数量,向生成具有高覆盖率、有助于功能测试的更现实测试用例迈进了一步。与最先进的基于搜索的 API 测试工具相比,通过较少的 API 请求获得了高覆盖率。
英文摘要:
Most of the web services are offered in the form of RESTful APIs. This has led to an active research interest in API testing to ensure the reliability of these services. While most of the testing techniques proposed in the past rely on the API specification to generate the test cases, a major limitation of such an approach is that in the case of an incomplete or inconsistent specification, the test cases may not be realistic in nature and would result in a lot of 4xx response due to invalid input. This is indicative of poor test quality. Learning-based approaches may learn about valid inputs but often require a large number of request-response pairs to learn the constraints, making it infeasible to be readily used in the industry. To address this limitation, this paper proposes a dynamic test refinement approach that leverages the response message. The response is used to infer the point in the API testing flow where a test scenario fix is required. Using an intelligent agent, the approach adds constraints to the API specification that are further used to generate a test scenario accounting for the learned constraint from the response. Following a greedy approach, the iterative learning and refinement of test scenarios are obtained from the API testing system. The proposed approach led to a decrease in the number of 4xx responses, taking a step closer to generating more realistic test cases with high coverage that would aid in functional testing. A high coverage was obtained from a lesser number of API requests, as compared with the state-of-the-art search-based API Testing tools.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。