基于有限状态机的Web服务测试用例生成方法
详细信息    本馆镜像全文|  推荐本文 |  |   获取CNKI官网全文
摘要
随着信息技术的发展,软件规模的不断扩大,如何保证和提高软件质量成为软件界最为关心的问题之一。近年来,Web服务的松散藕合性、简单性、高度可集成性、规范性、开放性和行业支持等特点使其得到了迅猛的发展,Web服务的出现解决了语言差异、平台差异、协议差异、数据差异所带来的高代价的系统集成问题,显著降低了开发的代价,但Web服务的可靠质量是服务选择、应用和集成的关键依据之一,因此,确保Web服务的质量成了一个至关重要的问题。软件测试作为保证软件质量的关键技术之一,能够有效地发现软件中的故障。软件测试的核心问题是测试用例的产生。好的测试用例不仅能有效的发现软件中的缺陷,并可以减少软件测试的工作量。测试用例的生成将直接关系到Web服务测试的效率和成本。随着面向服务软件开发技术的广泛应用和软件测试自动化的要求,基于模型的软件测试逐渐得到重视。在几种有代表性的基于模型的软件测试中,基于有限状态机的测试模型已经成为软件测试研究领域的一个热点。它能够很好地反映被测试系统中动态行为的交互信息,容易被开发和测试人员理解,并且它的使用可降低软件测试成本,提高软件测试效率和自动化程度,改进了传统测试方法技术中的很多不足。
     为了提高Web服务的可靠性,本文利用有限状态机模型来构建Web服务测试模型,并在得到的测试模型基础上生成Web服务的测试用例。本文的主要思想是用有限状态机模型来描述Web服务对象行为以及Web服务对象之间的交互特性,以便生成Web服务的测试用例。本文在结合Web服务和有限状态机特点的基础上,为了能构建基于有限状态机的Web服务测试模型,文中用有限状态机模型的状态来描述Web服务交互产生的中间状态,并且有限状态机模型的状态迁移及其标注描述Web服务与用户间的消息交换,然后,借助正则表达式来描述Web服务交互过程的所有消息交换序列。正则表达式结合Web服务的WSDL文档可生成测试数据。为使得Web服务测试用例能自动生成,本文还给出了满足有限状态机模型测试覆盖准则的用例生成算法。
     本文以股票交易服务(Trading Stocks)为例,通过实验验证了该方法的有效性。通过基于有限状态机模型构建Web服务测试模型,并结合形式化方法和测试覆盖准则,本文的研究可以降低Web服务测试成本,提高Web服务测试效率和自动化程度,为有限状态机模型在Web服务测试中应用起到一定的推动作用。
It is a concerning issue of improving and verifying the quality of software with the process of IT and the scale of software. Recently, Web Services have been developed rapidly because of its properties, such as, loosely coupling, simplicity, high compositionality, based standard, opening and industry supporting. Web Services reduces the developing cost because it bridges the gaps of language difference, platform difference, protocol difference and data difference while a system is integrated. But, the reliable quality of the Web Services is one of the key factors for services selection, application and integration, it is important to insure the Web Services quality. Software testing is one of the key technologies that ensure the quality of software. It can find software failures effectively. The core problem is test cases generation in software testing. A good test case not only can effectively find software defects, but also can reduce the workload of software testing. The test cases will be directly related to the efficiency and cost of the Web Service test. With the service-oriented software development technology widely applications and software test automation requirements, model-based software testing is paid attention gradually. Specially, the testing model based on finite state machine has become a hot research field. It can deeply describe the dynamic interactions of information, which are easily understood by the development and testing staff, so it reduces the software testing costs, enhances the efficiency and automation degree of software testing and improves many disadvantages of the traditional testing methods.
     This thesis presents a Web Services testing model based on Finite State Machine Model (FSM) in order to improve the reliability of Web Services and testing cases can be generated by the model. The main idea is using FSM to describe the Web Services object behaviors and objects interactions in order to generate the Web Services test case. In order to build the Web Services testing model, this paper depicts the middle states of interactions, which are described by the FSM's nodes, between Web Services and users by means of abstraction the characteristics of Web services and FSM. The FSM's transitions are expressed by exchanged messages during the interactions. Furthermore, the sequences of exchanged messages of the interaction can be depicted by regular expressions so that testing case can be produced with WSDL description. The algorithm of testing case generation meeting the coverage criteria is presented to enable Web services to generate test cases automatically.
     The method and algorithm are exemplified by a stock trading service. By means of FSM-based model to build Web service testing model and mixture of formal methods and test coverage criteria, this research can reduce the Web service testing costs, raise the efficiency and automation of Web service testing, it play a certain role to promoting the application of FSM in Web services testing.
引文
[1]郑人杰.软件测试、质量与可靠性[M].北京.国防工业出版社,1994.
    [2]白晓颖,戴桂兰.Web服务测试研究[J].计算机科学,2006,33(02).252-256.
    [3]颜炯,王戟,陈火旺.基于模型的软件测试综述[J].计算机科学,2004,31(02):184-187.
    [4]Looker N,Xu J.Assessing the Dependability of SOAP RPC-Based Web Services by Fault Injection[J].IEEE International Workshop on ObjectOriented Real-Time Dependable Systems,Capri Island,Italy,2003,01(03):163-167.
    [5]Tsai W T,Paul R,Wang Y,et al.Extending WSDL to Facilitate Web Services Testing[J].Proceedings of 7th IEEE International Symposium on High Assurance Systems Engineering(HASE'02).Tokyo,Japan,2002:171-172.
    [6]Tsai W,Chen Y,Cao Z,et al.Testing Web Services Using Progressive Group Testing[J].Lecture Notes in Computer Science,2004,3309:314-322.
    [7]Peterson J L.Petri Net Theory and the Modeling of Systems[M].Upper Saddle River,NJ,USA:Prentice Hall PTR,1981.
    [8]Hamadi R,Benatallah B.A Petri net-based model for web service composition[C].Proceedings of the 14th Australasian database conference,Adelaide,Australia,2003,17(11):191-200.
    [9]Narayanan S,Mcilraith S.Analysis and simulation of Web Services[J].Computer Networks,2003,42(05):675-693.
    [10]Foster H,Uchitel S,Magee J,et al.Compatibility verification for web service choreography[C].IEEE,2004:738-741.
    [11]Ponge J,Benatallah B,Casati F,et al.Fine-Grained Compatibility and Replaceability Analysis of Timed Web Service Protocols[J].ConceptualModeling-ER,2007,48-01:599-614.
    [12]Wombacher A,Fankhauser P,Mahleko B,et al.Matchmaking for Business Processes Based on Choreographies[J].Proceedings of the 2004 IEEE International Conference on e-Technology,e-Commerce and e-Service(EEE'04),2004:359-368.
    [13]Milner R.A Calculus of Communicating Systems[M].Secaucus,NJ,USA:Springer-Verlag New York,Inc,1982.
    [14]Hoare C A R.Communicating sequential processes[J].Communications of the ACM,1978,21(8):666-677.
    [15]Milner R.Communicating and Mobile Systems:the Pi-Calculus[M].Cambridge University Press,1999.
    [16]Bordeaux L,Sala(u丨¨)n G.Using Process Algebra for Web Services:Early Results and Perspectives[J].Technologies for E-Services,2005,3324:54-68.
    [17]Brogi A,Canal C,Pimentel E,et al.Formalizing Web Service Choreographies[C].Proceedings of the First International Workshop on Web Services and Formal Methods(WSFM),2004,105:73-94.
    [18]Heckel R.Towards Contract-based Testing of WebServices[J].Electronic Notes in Theoretical Computer Science,2004,116:145-156.
    [19]Siblini R,Mansour N.Testing web services[C].The 3rd ACS IEEE International Conference on Computer Systems and Applications,2005:135-141.
    [20]Reiko H,Leonardo M..Automatic Conformance Testing of Web Serviees[J].Springer,2005,34(42):34-48.
    [21]Antonia B,Andrea P.The audition framework for testing Web services interoperability[J].Proceedings of IEEE Computer Society on EUROMICRO,2005:134-142.
    [22]Bai X,Dong W,Tsai W,et al.WSDL-Based Automatic Test Case Generation for Web Services Testing[C].Proc.of the 2005 IEEE International Workshop on Service-oriented System Engineering[SOSE'05],2005:207-212.
    [23]Offutt J.Generating Test Cases for Web Services Using Data Pertur-bation[J].ACM,2004,29(05):1-10.
    [24]姜瑛,辛国茂,单锦辉.一种Web服务的测试数据自动生成方法[J].计算机学报,2005,28(4):568-577.
    [25]Zheng Y,Zhou J,Krause P.An Automatic Test Case Generation Framework for Web Services[J].软件学报,2007,2(3):64-77.
    [26]ChangSup Keum,Sungwon Kang,In-Young Ko,.et al.Generating Test Cases for Web Services Using Extended Finite State Machine[C].IFIP International Federation for Information Processing.2006,LNCS 3964:103-117.
    [27]杨利利,李必信.Web服务测试问题综述[J].计算机科学.2008,35(9):258-265.
    [28]黄宁,余莹,张大勇.Web服务软件测试技术的研究与实现[J].计算机工程与应用,2004,48(35):147-149.
    [29]Sommerville Ian.Requirements Engineering:A Good Practice[M].Chichester UK:Wiley,1997.
    [30]Binder,Robert V.Testing object-oriented software:a survey[J].Software Testing,Verification and Reliability,1996,6(4):125-252.
    [31]Maurer P M.The Design and Implementation of a Grammar-based Data Generator[J].Software Practice and Experience,1992,22(3):223-244.
    [32]Cai K,Li Y,Ning W.Optimal software testing in the setting of controlled Markov chains[J].European Journal of Operational Research,2005,162(2):552-579.
    [33]张涌,钱乐秋,王渊峰.基于扩展有限状态机测试中测试输入数据自动选取的研究[J].计算机学报,2003,26(10):1296-1303.
    [34]Hong H S,Kim Y G,Cha S D,et al.A Test Sequence Selection Method for State_Charts[J].Journal of Software Testing,Verification,and Reliability,2000,10(4):203-227.
    [35]Offutt J,Abdurazik A.Generating Tests from UML Specifications[C].Springer,1999,17(23):76-78.
    [36]王之梁,吴建平,尹霞.基于通信多端口有限状态机的协议互操作性测试生成研究[J].计算机学报,2006,29(11):1989-1919.
    [37]Narayanan S,Mcllraith S A.Simulation,Verification and Automated Composition of Web Services[J].ACM,2002:77-88.
    [38]Nakajima S.Model-Checking Verification for Reliable Web Service[J].Proc of OO PSLA'02 Workshop on Object-Oriented Web Services,2002.
    [39]Foster H.Model-based Verification of Web Service Compositions[J].18th IEEE International Conference on Automated Software Engineering,2003:152-161.
    [40]廖军,谭浩,刘锦德.基于Pi-演算的Web服务组合的描述和验证[J].计算机学报,2004,28(4):635-643.
    [41]年晓玲.基于扩展有限状态机软件测试用例自动生成的研究[D].西南交通大学,2005.
    [42]蒋运承,汤庸,邓培民.基于有限状态自动机的服务组合模型[J].智能系统学报,2006,1(2):49-57.
    [43]Huaikou M,Ling L.A Test Class Framework for Generating Test Cases from Z S_pecifications[J].Proceedings of the 6th IEEE International Conference on Compl_ex Computer Systems,2000,0(10):164-171.
    [44]Offutt A,Jefferson,Liu S.Generating Test Data from SOFL Specifications[J].The Journal of Systems and Software,1999,49(1):49-62.
    [45]Offutt J,Liu S,Abdurazik A,et al.Generating test data from state- based specific_ations[J].Software Testing,Verification and Reliability,2003,13(1):25-53.
    [46]Dick J,Faivre A.Automating the Generation and Sequencing of Test Cases from Model-Based Specifications[C].Proceedings of the First International Symposium of Formal Methods Europe on Industrial Strength Formal Methods,1993:268-284.
    [47]Stocks P,Carrington D.A Framework for Specification-Based Testing[J].IEEE Transactions on Software Engineering,1996,22(11):777-793.
    [48]P Ammann J O.Introduction to Software Testing[M].Coverage Criteria,2005.
    [49]钱忠胜.基于模型的web应用测试用例生成方法[D].上海大学,2008.
    [50]Sipser M.计算理论导引[M].北京:机械工业出版社,2006.
    [51]吕映芝,张素琴.编译原理[M].清华大学出版社,1998.

© 2004-2018 中国地质图书馆版权所有 京ICP备05064691号 京公网安备11010802017129号

地址:北京市海淀区学院路29号 邮编:100083

电话:办公室:(+86 10)66554848;文献借阅、咨询服务、科技查新:66554700