Computer Science ›› 2023, Vol. 50 ›› Issue (9): 101-107.doi: 10.11896/jsjkx.220800071

• Computer Software • Previous Articles     Next Articles

Study on REST API Test Case Generation Method Based on Dependency Model

LIU Yingying, YANG Qiuhui, YAO Bangguo, LIU Qiaoyun   

  1. College of Computer Science,Sichuan University,Chengdu 610065,China
  • Received:2022-08-07 Revised:2022-11-15 Online:2023-09-15 Published:2023-09-01
  • About author:LIU Yingying,born in 1998,postgra-duate.Her main research interest is software quality assurance.
    YANG Qiuhui,born in 1970,Ph.D,associate professor.Her main research interests include software quality assu-rance and testing and software enginee-ring.
  • Supported by:
    Natural Science Foundation of Sichuan Province,China(23NSFSC3752) and Sichuan University Postdoctoral Science Research Foundation(2022SCU12077).

Abstract: The prevalence of dependencies in REST API makes it difficult to generate a reasonable sequence of API calls with input parameters.Most existing approaches only consider one of these dependencies and require cumbersome manual preliminaries,thus the generated test cases are still less effective.To address the above problem,a test case generation method based on depen-dency model is proposed.By parsing the OpenAPI documentation,this method extracts the inter-operation dependencies and inter-parameter dependencies,establishes two dependency models,generates test cases from the models,and determines test oracles.Experimental results show that the proposed method achieves 100% input metric coverage,and 100%,91.67%,and 83.33% coverage for status code category,status code,and response resource type,respectively,and can detect internal interface defects within a limited time.Compared with RESTler and RESTest,the proposed method improves the maximum 36% of output metric coverage,triggeres the most number of abnormal response status codes,and detects a maximum of 10% increase in the percentage of abnormal responses.The method provides a valuable reference for the test case generation problem of REST API.

Key words: REST API, Test case generation, Inter-operation dependency, Inter-parameter dependency, BERT model

CLC Number: 

  • TP311.5
[1]FIELDING R T.Architectural styles and the design of network-based software architectures[M].Ann Arbor:University of California,Irvine,2000:76-105.
[2]ATLIDAKIS V,GODEFROID P,POLISHCHUNK M.Che-cking security properties of cloud service REST APIs[C]//2020 IEEE 13th International Conference on Software Testing,Validation and Verification.2020:387-397.
[3]SaltSecurity.91% of organizations had an API security incident last year[EB/OL].The State of API Security.[2021-02-26].https://salt.security/api-security-trends.
[4]ATLIDAKIS V,GODEFROID P,POLISHCHUNK M.Restler:Stateful rest API fuzzing[C]//2019 IEE ACM 41st Interna-tional Conference on Software Engineering.2019:748-758.
[5]VIGLIANISI E,DALLAGO M,CECCATO M.Resttestgen:automated black-box testing of restful apis[C]//2020 IEEE 13th Interna-tional Conference on Software Testing,Validation and Verification.2020:142-152.
[6]MARTIN-LOPEZ A,SEGURA S,RUIZ-CORTES A.RES-Test:automated black-box testing of RESTful web APIs[C]//Proceedings of the 30th ACM SIGSOFT International Sympo-sium on Software Testing and Analysis.2021:682-685.
[7]LARANJEIRO N,AGNELO J,BERNARDINO J.A black box tool for robustness testing of REST services[J].IEEE Access,2021,9:24738-24754.
[8]CORRADINI D,ZAMPIERI A,PASQUA M,et al.EmpiricalComparison of Black-box Test Case Generation Tools for RESTful APIs[C]//2021 IEEE 21st International Working Conference on Source Code Analysis and Manipulation.2021:226-236.
[9]MARTIN-LOPEZ A.Automated analysis of inter-parameter dependencies in web APIs[C]//Proceedings of the ACM/IEEE 42nd International Conference on Software Engineering:Companion Proceedings.2020:140-142.
[10]MARTIN-LOPEZ A,SEGURA S,RUIZ-CORTÉS A.A Catalogue of Inter-parameter Dependencies in RESTful Web APIs[M].Service-Oriented Computing.Cham:Springer International Publishing,2019:399-414.
[11]APIs.GURU.Browse APIs.APIs.guru[EB/OL].[2022-01-16].https://apis.guru/.
[12]WU S,HE Y.Enriching pre-trained language model with entity information for relation classification[C]//Proceedings of the 28th ACM International Conference on Information and Know-ledge Management.2019:2361-2364.
[13]Get Started with OR-Tools for Python[EB/OL]//Google Developers.[2022-01-17].https://developers.google.com/optimization/introduction/python.
[14]ARCURI A.RESTful API Automated Test Case Generationwith EvoMaster[J].ACM Transactions on Software Enginee-ring and Methodology,2019,28(1):3:1-3:37.
[15]CORRADINID,ZAMPIERI A,PASQUA M,et al.EmpiricalComparison of Black-box Test Case Generation Tools for RESTful APIs[C]//2021 IEEE 21st International Working Conference on Source Code Analysis and Manipulation.2021:226-236.
[16]MARTIN-LOPEZ A,SEGURA S,RUIZ-CORTÉS A.Test co-verage criteria for RESTful web APIs[C]//Proceedings of the 10th ACM SIGSOFT International Workshop on Automating TEST Case Design,Selection,and Evaluation.2019:15-21.
[17]CORRADINI D,ZAMPIERI A,PASQUA M,et al.Restats:A test coverage tool for RESTful APIs[C]//2021 IEEE International Conference on Software Maintenance and Evolution.2021:594-598.
[1] LIU Ziwen, YU Lijuan, SU Yixing, ZHAO Yao, SHI Zhu. Test Case Generation Based on Web Application Front-end Behavior Model [J]. Computer Science, 2023, 50(7): 18-26.
[2] LUO Liang, CHENG Chunling, LIU Qian, GUI Yaocheng. Answer Selection Model Based on MLP and Semantic Matrix [J]. Computer Science, 2023, 50(5): 270-276.
[3] YU Jia-qi, KANG Xiao-dong, BAI Cheng-cheng, LIU Han-qing. New Text Retrieval Model of Chinese Electronic Medical Records [J]. Computer Science, 2022, 49(6A): 32-38.
[4] YANG Yi, WANG Xi, ZHAO Chun-lei, BU Zhi-liang. Overview of Android GUI Automated Testing [J]. Computer Science, 2022, 49(11A): 210900231-10.
[5] ZHANG Da-lin, ZHANG Zhe-wei, WANG Nan, LIU Ji-qiang. AutoUnit:Automatic Test Generation Based on Active Learning and Prediction Guidance [J]. Computer Science, 2022, 49(11): 39-48.
[6] WANG Wen-xuan, HU Jun, HU Jian-cheng, KANG Jie-xiang, WANG Hui, GAO Zhong-jie. Test Case Generation Method Oriented to Tabular Form Formal Requirement Model [J]. Computer Science, 2021, 48(5): 16-24.
[7] JI Shun-hui, ZHANG Peng-cheng. Test Case Generation Approach for Data Flow Based on Dominance Relations [J]. Computer Science, 2020, 47(9): 40-46.
[8] ZHANG Na,TENG Sai-na,WU Biao,BAO Xiao-an. Test Case Generation Method Based on Particle Swarm Optimization Algorithm [J]. Computer Science, 2019, 46(7): 146-150.
[9] YANG Hong, HONG Mei, QU Yuan-yuan. Approach of Mutation Test Case Generation Based on Model Checking [J]. Computer Science, 2018, 45(11A): 488-493.
[10] HUANG Yu-yao, LI Feng-ying, CHANG Liang and MENG Yu. Symbolic ZBDD-based Generation Algorithm for Combinatorial Testing [J]. Computer Science, 2018, 45(1): 255-260.
[11] CHEN Jie-qiong, JIANG Shu-juan and ZHANG Zheng-guang. Approach for Test Case Generation Based on Data Flow Criterion [J]. Computer Science, 2017, 44(2): 107-111.
[12] ZHANG Xiong and LI Zhou-jun. Survey of Fuzz Testing Technology [J]. Computer Science, 2016, 43(5): 1-8.
[13] TAN Xin, PENG Yao-peng, YANG Shuai and ZHENG Wei. Automated Test Case Generation Based on SPEA2+SDE [J]. Computer Science, 2015, 42(Z11): 450-453.
[14] HOU Chao-fan,WU Ji and LIU Chao. Interoperability Test Case Generation Based on Testing Requirements [J]. Computer Science, 2014, 41(11): 162-168.
[15] . Survey on Fault-based Testing Techniques for Boolean Expressions [J]. Computer Science, 2013, 40(3): 16-23.
Viewed
Full text


Abstract

Cited

  Shared   
  Discussed   
No Suggested Reading articles found!