Test cases play a significant role in software testing, which is a vital method for guaranteeing the reliability and security of embedded operating system. According to the existing result, the knowledge of historical test cases cannot be completely utilized, and the reuse function of test cases in traditional situations is weak. Aiming at these defects, a recommendation model based on knowledge graph for embedded operating system test cases reuse is proposed. Firstly, this paper uses knowledge graph to store and retrieve data with complex relationships. Secondly, the ontology model is designed and the domain knowledge graph is created based on the entities and relationships extracted from historical test cases. Then, this paper chooses unsupervised contrastive learning natural language processing methods for matching Chinese text similarity. Finally, a reuse recommendation model about embedded operating system test cases has been built. Experiments demonstrate that the ontology model proposed in this study can assist testers in effectively reusing test cases and achieve an 94.305% coverage rate, which significantly reduces testing costs and has a significant impact on engineering applications.
近年来,随着复杂的自然语言处理(natural language processing,NLP)技术的出现,知识图谱(knowledge graph,KG)得到了广泛普及[10],其在知识存储、检索和推理方面具有明显优势。建立专业领域知识图谱通常采用“自上而下”的方式,根据建模需求和业务领域构建领域本体作为知识图谱的模式层,再通过业务数据对本体实例化[11]。在软件工程中,知识图谱的典型应用主要包括了以下几种:建立领域知识库管理系统(例如,医疗、金融投资,政府管理和安全领域等)、设计和开发软件工程项目库,以及智能搜索等[12]。测试人员需要理解领域知识,从软件文档中提取需求的相关信息,以编写正确和完整的测试用例,这是一个耗时且成本高昂的过程。知识图谱可以从处理复杂的依赖关系、穷举测试及领域可视化三个方面帮助测试人员减轻工作量[13]。文献[14]开发Kara工具,利用知识图谱和自动测试结果生成具有领域知识的众包测试需求。文献[10]提出一种KG创建工具,从非结构化和稀疏语料库中创建KG,用于自动生成汽车领域软件的测试用例。文献[12]提出了一种面向雷达软件的测试用例复用检索算法,在知识图谱中实现了实体特征属性文本的语义相似度匹配任务,并将知识推荐和协同过滤推荐技术结合起来,构建测试用例复用推荐模型,进行复用设计和缺陷匹配。文献[15]构建软件测试领域知识本体,利用本体相似度概念实现软件测评知识的重用及共享。文献[16]建立基于本体定义的软件测试过程,使测试阶段的维护更便利。文献[17]利用知识图谱构建目标系统测试链,以支持与软件漏洞相关的推理任务。文献[18,19]利用本体模型实现测试文档及测试用例的生成。这些实际的应用证实了知识图谱在软件测试领域的可行性和实用性。
为了解决EOS历史测试用例不能充分利用,可复用性差的问题,本文提出了基于知识图谱的嵌入式操作系统测试用例的复用推荐模型。构建EOS测试领域的本体模型,使用图形化数据库Neo4j[20]可视化测试数据,协助测试人员有效地分析历史测试数据;并使用SimCSE(simple contrastive learning of sentence embeddings)[21]模型执行中文语义相似度任务,推荐可复用的测试用例。最后基于中标麒麟操作系统和SylixOS的测试用例数据验证了方法的有效性,为嵌入式操作系统测试的复用研究提供了新的解决思路。
SHENGL F, XUB, XIAW W, et al. Embedded Systems and Its Development Applications [M]. 2nd Ed. Beijing: Publishing House of Electronics Industry, 2011: 1-2(Ch).
WANGY. Application of black box testing technology in embedded software testing[J]. Automobile Applied Technology, 2022,47(1): 201-204. DOI: 10.16638/j.cnki.1671-7988.2022.001.046(Ch ).
[5]
JIND S, WANGZ, LIM Y, et al. Construction and application of knowledge graph of domestic operating system testing[C]// Proceedings of the 4th International Conference on Computer Science and Software Engineering. New York: ACM,2021: 268-273. DOI: 10.1145/3494885.3494933 .
[6]
MUY M, GAOX X, SHENM E. Research of reuse technology of test case based on function calling path[J]. Chinese Journal of Electronics, 2018, 27(4): 768-775. DOI: 10.1049/cje.2018.04.012 .
XIAC L, ZHENGW, TANL J, et al. Test case reuse method based on knowledge graph[J]. Computer Engineering and Design, 2022, 43(5): 1273-1279.DOI:10.16208/j.issn1000-7024.2022.05.010(Ch ).
LIY Y, HUANGS, HUIZ W, et al. Test case retrieval method for different data model[J]. Computer Science, 2017, 44(11): 221-225.DOI: 10.11896/j.issn.1002-137X.2017.11.033(Ch ).
[13]
ZHANGN, CHAIH Y, HANX Y. Research on the reuse of test case for warship equipment software[C]// 2018 IEEE International Conference on Software Quality, Reliability and Security Companion (QRS⁃C). New York: IEEE Press, 2018: 64-69.DOI: 10.1109/QRS-C.2018.00025 .
[14]
GUOS J, ZHANGJ, TONGW Q, et al. An application of ontology to test case reuse[C]// 2011 International Conference on Mechatronic Science, Electric Engineering and Computer (MEC). New York: IEEE Press, 2011: 775-778.DOI: 10.1109/MEC.2011.6025579 .
[15]
NAYAKA, KESRIV, DUBEYR K. Knowledge graph based automated generation of test cases in software engineering[C]// Proceedings of the 7th ACM IKDD CoDS and 25th COMAD. New York: ACM, 2020: 289-295.DOI: 10.1145/3371158.3371202 .
LUOH R, ZHUW X, SHIY Q, et al. Construction of knowledge graph of software test asset for uncertain knowledge[J]. Computer Technology and Development, 2022, 32(7):111-116. DOI: 10.3969/j.issn.1673-629X.2022.07.019(Ch ).
LIH, LIUX. Radar software test case reusing based on knowledge graph[J]. Measurement & Control Technology, 2021, 40(6): 18-26. DOI: 10.19708/j.ckjs.2021.06.004(Ch ).
[20]
KESRIV, NAYAKA, PONNALAGUK. AutoKG—An automotive domain knowledge graph for software testing: A position paper[C]// 2021 IEEE International Conference on Software Testing, Verification and Validation Workshops (ICSTW). New York: IEEE Press, 2021: 234-238. DOI: 10.1109/ICSTW52544.2021.00047 .
[21]
GUOC, HET K, YUANW, et al. Crowdsourced requirements generation for automatic testing via knowledge graph[C]// Proceedings of the 29th ACM SIGSOFT International Symposium on Software Testing and Analysis. New York: ACM, 2020: 545-548.DOI: 10.1145/3395363.3404363 .
[22]
SUNZ, HUC, LIC L, et al. Domain ontology construction and evaluation for the entire process of software testing[J]. IEEE Access, 2020, 8: 205374-205385. DOI: 10.1109/ACCESS.2020.3037188 .
[23]
POPERESHNYAKS, VECHERKOVSKAYAA. Modeling ontologies in software testing[C]// 2019 IEEE 14th International Conference on Computer Sciences and Information Technologies (CSIT). New York: IEEE Press, 2019, 3: 236-239.DOI: 10.1109/STC-CSIT.2019.8929785 .
[24]
ZHAOY, YANGY R, TIANB, et al. An Invocation chain test and evaluation method based on knowledge graph[C]// 2020 International Conference on Networking and Network Applications (NaNA). New York: IEEE Press, 2021: 277-281.DOI: 10.1109/NaNA51271.2020.00054 .
[25]
CHENP, XIA. Research on industrial software testing knowledge database based on ontology[C]// 2019 6th International Conference on Dependable Systems and Their Applications (DSA). New York: IEEE Press, 2020: 425-429. DOI: 10.1109/DSA.2019.00066 .
[26]
CRAPOA W, MOITRAA. Using OWL ontologies as a domain-specific language for capturing requirements for formal analysis and test case generation[C]// 2019 IEEE 13th International Conference on Semantic Computing (ICSC). New York: IEEE Press, 2019: 361-366.DOI: 10.1109/ICOSC.2019.8665630 .
[27]
DB-Engines. DB-Engines Ranking of Graph DBMS [EB/OL]. [2022-09-27].
General Administration of Quality Supervision, Inspection and Quarantine of the People’s Republic of China,Standardization Administration of the People’s Republic of China. Systems and Software Engineering—Systems and Software Quality Requirements and Evaluation(SQuaRE)—Part51:Requirements for Quality of Ready to Use Software Product(RUSP)and Instructions for Testing:GB/T 25000.51-2016 [S]. Beijing: Standards Press of China, 2016(Ch).
XUZ L, SHENGY P, HEL R, et al. Review on knowledge graph techniques[J]. Journal of University of Electronic Science and Technology of China, 2016, 45(4): 589-606. DOI: 10.3969/j.issn.1001-0548.2016.04.012(Ch ).
YUL Y, GUOZ G, CHENG, et al. Summary of knowledge graph construction oriented knowledge extraction technology[J]. Journal of Information Engineering University, 2020, 21(2): 227-235 (Ch). DOI: 10.3969/j.issn.1671-0673.2020.01.017 .
[37]
AUERS, BIZERC, KOBILAROVG, et al. DBpedia: A nucleus for a web of open data[C]// The Semantic Web. Berlin: Springer, 2007: 722-735. DOI: 10.1007/978-3-540-76298-0_52 .