[论文解读] Automatic Creation of Acceptance Tests by Extracting Conditionals from Requirements: NLP Approach and Case Study
本论文提出 CiRA,一种支持工具的 NLP 方法,可从非正式自然语言需求中的条件语句自动生成最小化接受测试用例。通过提取细粒度的因果关系并将其建模为因果图(Cause-Effect Graphs),CiRA 在与三家工业合作伙伴的真实案例研究中,实现了 71.8% 的自动测试用例生成率,并识别出此前遗漏的 80 个测试用例。
Acceptance testing is crucial to determine whether a system fulfills end-user requirements. However, the creation of acceptance tests is a laborious task entailing two major challenges: (1) practitioners need to determine the right set of test cases that fully covers a requirement, and (2) they need to create test cases manually due to insufficient tool support. Existing approaches for automatically deriving test cases require semi-formal or even formal notations of requirements, though unrestricted natural language is prevalent in practice. In this paper, we present our tool-supported approach CiRA (Conditionals in Requirements Artifacts) capable of creating the minimal set of required test cases from conditional statements in informal requirements. We demonstrate the feasibility of CiRA in a case study with three industry partners. In our study, out of 578 manually created test cases, 71.8 % can be generated automatically. Additionally, CiRA discovered 80 relevant test cases that were missed in manual test case design. CiRA is publicly available at www.cira.bth.se/demo/.
研究动机与目标
- 解决软件测试中人工编写接受测试用例过程繁琐且易出错的挑战。
- 克服缺乏工具支持、无法从非正式、无结构的自然语言需求中自动推导测试用例的局限。
- 开发一种方法,生成满足要求的最小测试用例集合,同时确保需求的全面覆盖。
- 通过识别在人工流程中被忽略的遗漏测试用例,提升测试设计质量。
提出的方法
- 应用 NLP 技术检测非正式自然语言需求中的条件语句。
- 使用带有子词分词的序列标注方法,从条件语句中提取细粒度的因果关系。
- 将提取的关系建模为因果图(Cause-Effect Graph, CEG),以表示条件与结果之间的逻辑依赖关系。
- 基于组合测试设计原则,从 CEG 中推导出最小化的必要测试用例集合。
- 将输出结果与现有测试自动化工具(如 Selenium、Robot Framework)集成,以支持执行。
- 利用迁移学习和子词嵌入技术,提升对未登录词和语法变化的鲁棒性。
实验结果
研究问题
- RQ1RQ1:如何有效提取自然语言需求中的条件语句,并以细粒度形式建模其隐含的因果关系,以支持测试用例的推导?
- RQ2RQ2:该自动化方法能否生成与人工设计过程相同的测试用例?
- RQ3RQ3:人工创建与自动生成功能之间存在差异的根本原因是什么?
主要发现
- CiRA 在案例研究中成功生成了 578 个手动创建测试用例中的 71.8%,表明其与人工测试设计具有高度一致性。
- 该工具发现了 80 个在人工测试用例设计过程中完全被遗漏的相关测试用例,凸显其提升测试覆盖率的能力。
- 通过子词分词技术,该方法优于以往基于 NLP 的方法,能够更好地处理未登录词和语法变化。
- 与依存句法分析相比,采用序列标注方法在真实世界非正式需求文本上展现出更高的鲁棒性和泛化能力。
- 因果图模型能有效捕捉逻辑依赖关系,从而支持推导出最小化的必要测试用例集合。
- 该工具已公开发布,包含源代码、标注数据集和在线演示,支持可复现性与工业界应用。
更好的研究,从现在开始
从阅读论文到最终审阅,大幅缩短您的研究时间。
无需绑定信用卡
本解读由 AI 生成,并经人工编辑审核。