Phương pháp sinh bộ kiểm thử từ biểu đồ tuần tự UML 2 0 và ứng dụng cho kiểm thử phần mềm

13 509 0
Phương pháp sinh bộ kiểm thử từ biểu đồ tuần tự UML 2 0 và ứng dụng cho kiểm thử phần mềm

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

Thông tin tài liệu

ĐẠI HỌC QUỐC GIA HÀ NỘI TRƢỜNG ĐẠI HỌC CÔNG NGHỆ TRẦN THỊ MÙI PHƢƠNG PHÁP SINH BỘ KIỂM THỬ TỪ BIỂU ĐỒ TUẦN TỰ UML 2.0 VÀ ỨNG DỤNG CHO KIỂM THỬ PHẦN MỀM LUẬN VĂN THẠC SĨ Ngành: Hệ thống thông tin HÀ NỘI – 2015 ĐẠI HỌC QUỐC GIA HÀ NỘI TRƢỜNG ĐẠI HỌC CÔNG NGHỆ TRẦN THỊ MÙI PHƢƠNG PHÁP SINH BỘ KIỂM THỬ TỪ BIỂU ĐỒ TUẦN TỰ UML 2.0 VÀ ỨNG DỤNG CHO KIỂM THỬ PHẦN MỀM Ngành: Hệ thống thông tin Chuyên ngành: Hệ thống thông tin Mã số: 60 48 01 04 LUẬN VĂN THẠC SĨ Ngành: Hệ thống thông tin NGƢỜI HƢỚNG DẪN KHOA HỌC: TS Phạm Ngọc Hùng HÀ NỘI – 2015 VIETNAM NATIONAL UNIVERSITY, HANOI UNIVERSITY OF ENGINEERING AND TECHNOLOGY TRAN THI MUI A METHOD AND TOOL SUPPORTING FOR AUTOMATED TESTING OF UML 2.0 SEQUENCE DIAGRAMS THE MS THESIS Major: Information Systems Supervisor: Dr Pham Ngoc Hung HANOI - 2015 LỜI CẢM ƠN Đầu tiên, xin gửi lời cảm ơn chân thành sâu sắc tới thầy Phạm Ngọc Hùng – Ngƣời trực tiếp hƣớng dẫn nhiệt tình, giúp đỡ động viên nhiều, cho có hội đƣợc tiếp xúc với tài liệu tham khảo quý giá, góp ý cho lời khuyên chân thành trình nghiên cứu để hoàn thành đề tài Tiếp theo xin gửi lời cảm ơn đến thầy cô giảng viên Trƣờng Đại học Công Nghệ - Đại học Quốc Gia Hà Nội – ngƣời tận tâm truyền đạt kiến thức quý báu làm tảng cho suốt năm học Cuối cùng, xin gửi lời biết ơn sâu sắc tới gia đình bên cạnh tôi, mang lại cho nguồn động viên tinh thần to lớn tạo điều kiện thuận lợi cho trình học tập hoàn thành luận văn Mặc dù cố gắng nhƣng luận văn không tránh khỏi thiếu sót Rất mong nhận đƣợc ý kiến đóng góp quý báu Thầy, Cô giáo bạn để luận văn đƣợc hoàn thiện Xin trân trọng cảm ơn! Hà Nội, ngày 22 tháng 11 năm 2015 Học viên: Trần Thị Mùi TÓM TẮT Luận văn tập trung nghiên cứu phƣơng pháp sinh kiểm thử từ biểu đồ UML 2.0 dựa lý thuyết kiểm thử mô hình nhằm tự động hóa trình kiểm thử, nâng cao hiệu quả, tiết kiệm chi phí thời gian Phƣơng pháp đƣợc thực thông qua bƣớc sau Đầu tiên, để có đƣợc mô hình làm đầu vào cho kiểm thử, phƣơng pháp thực chuyển đổi biểu đồ đồ thị dòng điều khiển cách tiến hành bóc, tách khối (fragment) biểu đồ Các khối lồng nhau, dựa vào quan hệ chúng, tiến hành xây dựng đồ thị cho khối, sau lồng chúng lại nhằm sinh đồ thị dòng điều khiển tƣơng ứng với biểu đồ Kế tiếp, đồ thị dòng điều khiển đƣợc phân tích để xây dựng tập đƣờng kiểm thử Vận dụng kỹ thuật thực thi tƣợng trƣng (Symbolic Execution - SE) nhằm xây dựng hệ ràng buộc tƣơng ứng cho tập đƣờng kiểm thử Cuối cùng, sử dụng công cụ SMT solver để giải hệ ràng buộc nhằm tìm kiếm nghiệm từ sinh ca kiểm thử Một công cụ hỗ trợ phƣơng pháp đƣợc cài đặt thử nghiệm với số ví dụ đơn giản nhằm minh chứng cho tính đắn hiệu phƣơng pháp Kết thực nghiệm cho thấy tiềm ứng dụng công cụ việc kiểm thử tự động công ty Từ khóa: Kiểm thử dựa mô hình, kiểm thử tự động, biểu đồ tuần tự, đồ thị dòng điều khiển, ca kiểm thử, độ bao phủ ABSTRACT This thesis researches a method to generate a set of test cases from the UML 2.0 sequence diagrams based on model-based testing in order to automate the testing process, increase effectiveness, reduce cost and time of testing The method follows the following steps At first, in order to have the input model for testing, it analyzes and divides the input diagram into fragments These fragments can be sequential or nested based on their relationship After that, it builds the corresponding graph for each of the fragments and merges them together in order to generate the corresponding control flow graph for the input sequence diagram The final control flow graph is analyzed to generate a set of testing paths Symbolic Execution (SE) technique is used to create restrictions associated with that set of testing paths Finally, the method uses SMT solver to solve the set of restrictions to find solution and then to generate a set of test cases A tool is also implemented and tested with some simple examples in order to show the correctness and effectiveness of the method The experimental results give us the potential application of the tool in automation testing in companies Keywords: Model base testing, automated testing, sequence diagram, control flow testing, test case LỜI CAM ĐOAN Tôi xin cam đoan nghiên cứu sinh tự động kiểm thử từ biểu đồ đƣợc trình bày luận văn dƣới hƣớng dẫn TS Phạm Ngọc Hùng Những viết không chép từ tài liệu, không sử dụng kết ngƣời khác mà không trích dẫn cụ thể Tôi xin cam đoan công cụ kiểm thử tự động trình bày luận văn tự phát triển, không chép mã nguồn ngƣời khác Nếu sai hoàn toàn chịu trách nhiệm theo quy định Trƣờng Đại học Công Nghệ - Đại học Quốc Gia Hà Nội Hà nội, ngày 22 tháng 11 năm 2015 Học viên: Trần Thị Mùi MỤC LỤC LỜI CẢM ƠN TÓM TẮT ABSTRACT LỜI CAM ĐOAN DANH SÁCH BẢNG BIỂU 10 DANH SÁCH HÌNH VẼ Error! Bookmark not defined BẢNG THUẬT NGỮ Error! Bookmark not defined Chƣơng GIỚI THIỆU Error! Bookmark not defined Chƣơng TỔNG QUAN KIỂM THỬ DỰA TRÊN MÔ HÌNHError! Bookmark not defined 2.1 Khái niệm kiểm thử dựa mô hình Error! Bookmark not defined 2.2 Quy trình chung kiểm thử dựa mô hìnhError! Bookmark not defined 2.3 Phƣơng pháp đặc tả mô hình máy trạng thái UMLError! Bookmark not define 2.4 Thuận lợi khó khăn kiểm thử tự động dựa mô hìnhError! Bookmark not Chƣơng PHƢƠNG PHÁP SINH ĐỒ THỊ DÒNG ĐIỀU KHIỂN TỪ BIỂU ĐỒ TUẦN TỰ Error! Bookmark not defined 3.1 Biểu đồ Error! Bookmark not defined 3.2 Đồ thị dòng điều khiển Error! Bookmark not defined 3.3 Đƣờng kiểm thử Error! Bookmark not defined 3.4 Chuyển đổi biểu đồ sang đƣờng kiểm thửError! Bookmark not defined 3.5 Định dạng chuẩn viết tệp xmi từ biểu đồ tuần tựError! Bookmark not defined 3.6 Thuật toán sinh tự động đƣờng kiểm thửError! Bookmark not defined 3.6.1 Thuật toán phân tích biểu đồ Error! Bookmark not defined 3.6.2 Thuật toán chuyển cấu trúc liệu biểu đồ sang đƣờng kiểm thửError! Bookmark not d 3.6.3 Thuật toán xác định đƣờng kiểm thử cho khối alt Error! Bookmark not defined 3.6.4 Thuật toán xác định đƣờng kiểm thử cho khối opt breakError! Bookmark not defined 3.6.5 Thuật toán xác định đƣờng kiểm thử cho khối loop Error! Bookmark not defined 3.6.6 Thuật toán xác định đƣờng kiểm thử cho khối par seqError! Bookmark not defined 3.6.7.Thuật toán xác định đƣờng kiểm thử cho khối weak Error! Bookmark not defined 3.6.8 Thuật toán xác định đƣờng kiểm thử cho khối strict Error! Bookmark not defined 3.6.9 Thuật toán xác định đƣờng kiểm thử cho khối ignore Error! Bookmark not defined Chƣơng PHƢƠNG PHÁP SINH BỘ KIỂM THỬ TỪ ĐỒ THỊ DÒNG ĐIỀU KHIỂN Error! Bookmark not defined 4.1 Xây dựng hệ ràng buộc Error! Bookmark not defined 4.2 Tìm nghiệm thỏa mãn hệ ràng buộc Error! Bookmark not defined 4.2.1 Giải hệ sử dụng kỹ thuật sinh ngẫu nhiên Error! Bookmark not defined 4.2.2 Giải hệ sử dụng SMT-Solver Error! Bookmark not defined 4.2.3 Nhận xét ƣu điểm, nhƣợc điểm hai hƣớng sinh ca kiểm thửError! Bookmark not d Chƣơng THỰC NGHIỆM Error! Bookmark not defined 5.1 Giới thiệu công cụ Error! Bookmark not defined 5.2 Thực nghiệm Error! Bookmark not defined 5.3 Ý nghĩa thực nghiệm Error! Bookmark not defined Chƣơng KẾT LUẬN Error! Bookmark not defined TÀI LIỆU THAM KHẢO 11 DANH SÁCH BẢNG BIỂU Bảng 4.1 Độ ƣu tiên toán tử Error! Bookmark not defined Bảng 5.1 Môi trƣờng thử nghiệm công cụ sinh ca kiểm thử từ thiết kế Error! Bookmark not defined TÀI LIỆU THAM KHẢO Tiếng Việt [1] Phạm Ngọc Hùng, Trƣơng Anh Hoàng, Đặng Văn Hƣng (2014), ―Giáo trình kiểm thử phần mềm‖, Nhà xuất giáo dục Việt Nam [2] Đỗ Đức Giáo (2011), ―Toán rời rạc ứng dụng tin học‖, Nhà xuất giáo dục Việt Nam [3] Vũ Thị Đào, Tô Văn Khánh, Nguyễn Việt Hà (2014), ―Phương pháp sinh ca kiểm thử tự động từ mô hình thiết kế UML ngôn ngữ ràngbuộc đối tượng OCL”, Tạp trí ―Các công trình nghiên cứu, phát triển ứng dụng CNTT-TT Tập V-1, Số 11 (31)‖ [4] Nguyễn Đức Anh (2015), ―Khóa luận tốt nghiệp”, Trƣờng Đại học Công nghệ, Đại học Quốc Gia, Hà Nội Tiếng Anh [5] Vahid Garousi, Lionel C Briand, and Yvan Labiche (2008), ―Control Flow Analysis of UML 2.0 Sequence Diagrams” - Software Quality Engineering Laboratory (SQUALL), Department of Systems and Computer Engineering, Carleton University, 1125 Colonel By Drive, Ottawa, ON K1S5B6, Canada {vahid, briand, labiche} @ sce.carleton.ca [6] R.V Binder (1996), ―Testing object-oriented software: a survey, Software TestingVerification and Reliability”, 6(3/4), 125-252 [7] R Mall (2009), ―Fundamentals of Software Engineering, Prentice Hall, 3th edition” [8] J C King (1976), ―Symbolic execution and program testing‖, Communciations of the ACM, vol 19, no 7, , pp 385–394 [9] Manish Mishra, Shashi Mishra and Rabins Porwal (2012), ―Basic Principle for testcase Generation Automatically‖, VSRD-IJCSIT, Vol (9), pp.772-781 [10] Abdurazik Aynur and Offutt Jeff (2000),―Using uml collaboration diagrams for static checking and test generation”, Proceedings of the 3rd international conference on The unified modeling language: advancing the standard (Berlin, Heidelberg), UML’00, Springer-Verlag, pp 383–395 [11] El-Far I K and Whittaker J.A (2002), ―Model-based software testing”, Encyclopedia of Software Engineering 825—-837 [12] J.C Corb ett, M.B Dwyer, J Hatcliff, S Laubach , C.S Pasareanu, Robby a nd Hong jun Zheng, "Bandera: extracting finite-state mo dels from Java source co de", Software Engineering, Pro ceedings of the 2000 Internat ional Conference on, pp 439-448d, 2000 [13] O Tkac huk, M.B Dwyer and C.S Pasareanu, ―Automated environment generati on for software mo del checking―, Automated Software Engineering, Pro c eedings 18th IEEE International Conference on, pp 116-127, 2003 [14] D Lore nzoli, L Marian i and M Pezzè, ―Automatic generation of software b ehavioral mo dels", ACM, Pro ceedings of the 30th international conference on Software engineering, pp 501-510, 2008 [15] L B Cuong and P N Hung, ―A Metho d for Gene rating Mo dels of Black-b ox Comp onents ", 4th International Conference on Knowledge and Systems Engineering (KSE 2012), IEEE Computer So cie ty Press, pp 177-222, 2012 [16] A Gro ce, D Peled, and M Y annak a ki s, ―Black box checking", J Autom Lang Comb., p p 225-246, Nov 2001 [17] A Gro ce, D Peled, and M Y annak a ki s, ―Adaptive Mo del Checking", Logic Journal of the IGPL, vol 14, no 5, pp 729-744, Oct 2006 [18] H.M Duong, L.K Trin h and P N Hung, ―An Assume-Guarantee Mo d el Checker for Comp onent-Based Systems", The 10th IEEE-RIVF International Conference on Computing and Communication Technologies, 2013 [19] L B Cuong and P N Hung, ―A Method for Generating Models of Black-box Components‖, 4th International Conference on Knowledge and Systems Engineering (KSE 2012), IEEE Computer Society Press, pp 177-222, 2012 [20] D Lorenzoli, L Mariani and M Pezz` e, ―Automatic generation of software behavioral models‖, ACM, Proceedings of the 30th international conference on Software engineering, pp 501-510, 2008 [21] J.C Corbett, M.B Dwyer, J Hatcliff, S Laubach, C.S Pasareanu, Robby and Hongjun Zheng, ‖Bandera: extracting finite-state models from Java source code‖, Software Engineering, Proceedings of the 2000 International Conference on, pp 439-448d, 2000 [22] O Tkachuk, M.B Dwyer and C.S Pasareanu, ―Automated environment generation for software model checking‖, Automated Software Engineering, Proceedings 18th IEEE International Conference on, pp 116-127, 2003 [23] H M Duong, L K Trinh, and P N Hung, ―An Assume-Guarantee Model Checker for Component-Based Systems‖, The 10th IEEE-RIVF International Conference on Computing and Communication Technologies, 2013 (accepted) [24] A Groce, D Peled, and M Y annak akis, ―Black box checking‖, J Autom Lang Comb., pp 225-246, Nov 2001 [25] A Groce, D Peled, and M Y annak akis, ―Adaptive Model Checking‖, Logic Journal of the IGPL, vol 14, no 5, pp 729-744, Oct 2006 [26] OMG document, UML 2.0 Superstructure Specification, 2003 http://www.omg.org/cgi-bin/doc?ptc/03-08-02 [27] UML sequence diagram http://www.uml-diagrams.org/sequence-diagrams-combined-fragment.html [28] Interaction operators in sequence diagrams http://pic.dhe.ibm.com/infocenter/rsarthlp/v8r5/topic/com.ibm.xtools.sequen ce.doc/topics/rinteracoperate.html [29] Business and Information System Modelling Solutions http://www.zicomi.com/combinedFragmentNegative.jsp [...]... Technologies, 20 13 (accepted) [24 ] A Groce, D Peled, and M Y annak akis, ―Black box checking‖, J Autom Lang Comb., pp 22 5 -24 6, Nov 20 01 [25 ] A Groce, D Peled, and M Y annak akis, ―Adaptive Model Checking‖, Logic Journal of the IGPL, vol 14, no 5, pp 729 -744, Oct 20 06 [26 ] OMG document, UML 2. 0 Superstructure Specification, 20 03 http://www.omg.org/cgi-bin/doc?ptc /03 -08 - 02 [27 ] UML sequence diagram http://www .uml- diagrams.org/sequence-diagrams-combined-fragment.html... Đặng Văn Hƣng ( 20 14), ―Giáo trình kiểm thử phần mềm , Nhà xuất bản giáo dục Việt Nam [2] Đỗ Đức Giáo ( 20 11), ―Toán rời rạc ứng dụng trong tin học‖, Nhà xuất bản giáo dục Việt Nam [3] Vũ Thị Đào, Tô Văn Khánh, Nguyễn Việt Hà ( 20 14), Phương pháp sinh các ca kiểm thử tự động từ các mô hình thiết kế UML và ngôn ngữ ràngbuộc đối tượng OCL”, Tạp trí ―Các công trình nghiên cứu, phát triển và ứng dụng CNTT-TT... conference on Software engineering, pp 501 -5 10, 20 08 [15] L B Cuong and P N Hung, ―A Metho d for Gene rating Mo dels of Black-b ox Comp onents ", 4th International Conference on Knowledge and Systems Engineering (KSE 20 12) , IEEE Computer So cie ty Press, pp 177 -22 2, 20 12 [16] A Gro ce, D Peled, and M Y annak a ki s, ―Black box checking", J Autom Lang Comb., p p 22 5 -24 6, Nov 20 01 [17] A Gro ce, D Peled, and... Proceedings of the 20 00 International Conference on, pp 439-448d, 20 00 [22 ] O Tkachuk, M.B Dwyer and C.S Pasareanu, ―Automated environment generation for software model checking‖, Automated Software Engineering, Proceedings 18th IEEE International Conference on, pp 116- 127 , 20 03 [23 ] H M Duong, L K Trinh, and P N Hung, ―An Assume-Guarantee Model Checker for Component-Based Systems‖, The 10th IEEE-RIVF... International Conference on Knowledge and Systems Engineering (KSE 20 12) , IEEE Computer Society Press, pp 177 -22 2, 20 12 [ 20 ] D Lorenzoli, L Mariani and M Pezz` e, ―Automatic generation of software behavioral models‖, ACM, Proceedings of the 30th international conference on Software engineering, pp 501 -5 10, 20 08 [21 ] J.C Corbett, M.B Dwyer, J Hatcliff, S Laubach, C.S Pasareanu, Robby and Hongjun Zheng, ‖Bandera:... 125 -25 2 [7] R Mall ( 20 09 ), ―Fundamentals of Software Engineering, Prentice Hall, 3th edition” [8] J C King (1976), ―Symbolic execution and program testing‖, Communciations of the ACM, vol 19, no 7, , pp 385–394 [9] Manish Mishra, Shashi Mishra and Rabins Porwal ( 20 12) , ―Basic Principle for testcase Generation Automatically‖, VSRD-IJCSIT, Vol 2 (9), pp.7 72- 781 [ 10] Abdurazik Aynur and Offutt Jeff ( 20 00 ),―Using... the 20 00 Internat ional Conference on, pp 439-448d, 20 00 [13] O Tkac huk, M.B Dwyer and C.S Pasareanu, ―Automated environment generati on for software mo del checking―, Automated Software Engineering, Pro c eedings 18th IEEE International Conference on, pp 116- 127 , 20 03 [14] D Lore nzoli, L Marian i and M Pezzè, ―Automatic generation of software b ehavioral mo dels", ACM, Pro ceedings of the 30th international... and Offutt Jeff ( 20 00 ),―Using uml collaboration diagrams for static checking and test generation”, Proceedings of the 3rd international conference on The unified modeling language: advancing the standard (Berlin, Heidelberg), UML 00 , Springer-Verlag, pp 383–395 [11] El-Far I K and Whittaker J.A ( 20 02 ) , ―Model-based software testing”, Encyclopedia of Software Engineering 825 —-837 [ 12] J.C Corb ett, M.B... no 5, pp 729 -744, Oct 20 06 [18] H.M Duong, L.K Trin h and P N Hung, ―An Assume-Guarantee Mo d el Checker for Comp onent-Based Systems", The 10th IEEE-RIVF International Conference on Computing and Communication Technologies, 20 13 [19] L B Cuong and P N Hung, ―A Method for Generating Models of Black-box Components‖, 4th International Conference on Knowledge and Systems Engineering (KSE 20 12) , IEEE Computer... V-1, Số 11 (31)‖ [4] Nguyễn Đức Anh ( 20 15), ―Khóa luận tốt nghiệp”, Trƣờng Đại học Công nghệ, Đại học Quốc Gia, Hà Nội Tiếng Anh [5] Vahid Garousi, Lionel C Briand, and Yvan Labiche ( 20 08 ), ―Control Flow Analysis of UML 2. 0 Sequence Diagrams” - Software Quality Engineering Laboratory (SQUALL), Department of Systems and Computer Engineering, Carleton University, 1 125 Colonel By Drive, Ottawa, ON K1S5B6,

Ngày đăng: 27/08/2016, 22:49

Từ khóa liên quan

Tài liệu cùng người dùng

Tài liệu liên quan