Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống
1
/ 36 trang
THÔNG TIN TÀI LIỆU
Thông tin cơ bản
Định dạng
Số trang
36
Dung lượng
5,34 MB
Nội dung
VIETNAM – KOREA UNIVERSITY OF INFORMATION AND COMMUNICATION TECHNOLOGY FALCULTY OF COMPUTER SCIENCE MAJOR COURSE PROJECT SOFTWARE QUALITY ASSURANCE AND TESTING Students conducting : NGUYEN PHUOC THINH PHAN MINH DUC TRAN VAN PHUC Lecturers providing guidance: PhD NGUYEN QUANG VU Class : 20SE2 || 20SE2 || 20SE3 Da Nang, May 2023 VIETNAM – KOREA UNIVERSITY OF INFORMATION AND COMMUNICATION TECHNOLOGY FALCULTY OF COMPUTER SCIENCE MAJOR COURSE PROJECT SOFTWARE QUALITY ASSURANCE AND TESTING Da Nang, May 2023 TABLE OF CONTENTS Contents Chapter Introduction to Selenium 1.1 Overview 1.1.1 Introduction to Selenium 1.1.2 History of Selenium 1.2 Key Features of Selenium 1.2.1 Selenium WebDriver 1.2.2 Selenium IDE 1.2.3 Selenium Grid 1.2.4 Selenium RC 1.3 Selenium Supported Browsers 1.3.1 Mozilla Firefox 1.3.2 Google Chrome 1.3.3 Microsoft Edge 1.4 Selenium Integration with Programming Languages 1.4.1 Java 1.4.2 Python 1.4.3 C# 1.5 Benefits of Using Selenium WebDriver 1.5.1 Cross-browser Compatibility 1.5.2 Language Support 1.5.3 Enhanced Interactions with Web Elements 1.5.4 Parallel Execution 1.5.5 Integration with Test Frameworks 1.6 Conclusion Chapter Install and use Selenium 2.1 Installation Requirements 2.2 Installation Selenium WebDriver 2.2.1 Download and Install Java 2.2.2 Download and Configure Eclipse IDE 2.2.3 Download Selenium WebDriver Java Client 10 2.2.4 Configure Selenium WebDriver 10 2.3 Write and run simple test cases with Selenium WebDriver 11 2.4 Conclution 11 Chapter Using Selenium to test Lazada website 13 3.1 Introduction to Lazada 13 3.2 Test Scenario 13 3.3 Test Case 15 3.4 Execute test cases using selenium 19 3.4.1 TS-01 19 3.4.2 TS-02 20 3.4.3 TS-03 21 3.4.4 TS-04 24 3.4.5 TS-05 25 3.4.6 TS-06 26 3.4.7 TS-07 28 REFERENCE 31 LIST OF FIGURES Figure - Logo Selenium Figure - Selenium WebDriver logo Figure - Selenium IDE logo Figure - Selenium Grid logo Figure - Selenium RC Figure - Selenium with Firefox Figure - Selenium with Chrome Figure - Selenium with Microsoft Edge Figure - Selenium with Java Figure 10 - Selenium with Python Figure 11 - Selenium with C# Figure 12 - Download Eclipse IDE Figure 13 - Default interface of Eclipse IDE Figure 14 - Download link of Java Client Driver 10 Figure 15 - Logo Lazada 13 Figure 16 - Execute TC-001 19 Figure 17 - Execute TC-002 19 Figure 18 - Execute TC-003 20 Figure 19 - Execute TC-004 20 Figure 20 - Execute TC-005 21 Figure 21 - Execute TC-006 21 Figure 22 - Execute TC-007 22 Figure 23 - Execute TC-008 23 Figure 24 - Execute TC-009 24 Figure 25 - Execute TC-010 24 Figure 26 - Execute TC-011 24 Figure 27 - Execute TC-012 25 Figure 28 - Execute TC-013 25 Figure 29 - Execute TC-014 26 Figure 30 - Execute TC-015 26 Figure 31 - Execute TC-016 27 Figure 32 - Execute TC-017 27 Figure 33 - Execute TC-018 28 Figure 34 - Execute TC-019 29 Figure 35 - Execute TC-020 29 Figure 36 - Execute TC-021 30 Chapter Introduction to Selenium 1.1 Overview 1.1.1 Introduction to Selenium Figure - Logo Selenium Selenium is a powerful open-source automation framework used for web application testing It provides a suite of tools and libraries for automating web browsers across different platforms 1.1.2 History of Selenium The development of Selenium began in 2004 as a project by Jason Huggins It was initially designed as an internal tool at ThoughtWorks to automate testing for a web application Later, Selenium evolved into a full-fledged open-source framework with contributions from various developers and organizations 1.2 Key Features of Selenium 1.2.1 Selenium WebDriver Figure - Selenium WebDriver logo Selenium WebDriver is a crucial component of the Selenium framework It is a programming interface that allows interaction with web browsers and enables the automation of web-based tasks WebDriver supports multiple programming languages and provides a rich set of functions for interacting with web elements, navigating through web pages, and executing actions such as clicking buttons, entering text, and handling alerts 1.2.2 Selenium IDE Figure - Selenium IDE logo Selenium IDE (Integrated Development Environment) is a record-and-playback tool that allows users to create and execute automation scripts without the need for programming knowledge It provides a graphical user interface (GUI) for recording user interactions and generating test scripts 1.2.3 Selenium Grid Figure - Selenium Grid logo Selenium Grid is a distributed testing framework that enables parallel execution of tests on multiple machines and browsers simultaneously It allows for efficient test execution across different environments and configurations, enhancing scalability and reducing testing time 1.2.4 Selenium RC Figure - Selenium RC Selenium RC (Remote Control) has been a leading testing framework of the Selenium project for a long time It is the first automation testing tool for the web that allows users to use their preferred programming language Starting from version 2.25.0, RC can support the following programming languages: Java, C#, PHP, Python, Perl, Ruby 1.3 Selenium Supported Browsers 1.3.1 Mozilla Firefox Figure - Selenium with Firefox Selenium supports Mozilla Firefox as one of the major browsers for test automation It provides a Firefox-specific driver that facilitates interaction with Firefox instances 1.3.2 Google Chrome Figure - Selenium with Chrome Selenium also supports Google Chrome for automation The ChromeDriver, a separate executable, is used as the driver for controlling Chrome instances 1.3.3 Microsoft Edge Figure - Selenium with Microsoft Edge With the introduction of the Chromium-based Microsoft Edge, Selenium now supports automation on this browser as well The EdgeDriver serves as the interface between Selenium WebDriver and the Edge browser 1.4 Selenium Integration with Programming Languages 1.4.1 Java Figure - Selenium with Java Java is one of the most popular programming languages used for Selenium automation Selenium WebDriver provides robust Java bindings that allow developers to write test scripts using Java not logged into an account logged Logout while performing Logged TC-012 other activities on the website Successfully remove a TC-013 product from the shopping cart TC-014 TS-05 TC-015 TC-016 TS-06 TC-017 TC-018 Remove a product from the shopping cart when the cart is empty Remove a product from the shopping cart when there are multiple items in the cart Successfully update the quantity of a product in the shopping cart Update the quantity of a product in the shopping cart when the cart is empty Update the quantity of a product in >=1 product on the cart https://www.lazada "loggout" vn/ link Open https://www.lazada vn/ Access to cart Click on "User" icon Click on Logout Open https://www.lazada vn/ Access to cart Tap on "Delete" icon Successful logout Successful remove product product on the cart Open Message: https://www.lazada "Cart is vn/ empty" Access to cart >1 product on the cart Open https://www.lazada Successful vn/ remove Access to cart product Tap on "Delete" icon >=1 product on the cart Open https://www.lazada Successful vn/ update Access to cart product Tap on "+" or "-" icon product on the cart Open Message: https://www.lazada "Cart is vn/ empty" >1 product on the Open Successful https://www.lazada update vn/ product 17 the shopping cart when there are multiple items in the cart Successfully TC-019 make a purchase TC-020 TS-07 Make a purchase without logging in Make a purchase with a quantity of TC-021 products exceeding the available inventory cart Logged & >1 product on the cart Not logged Logged & product on the cart with quantity exceeds quantity in stock Access to cart Tap on "+" or "-" icon Open https://www.lazada vn/ Access and perform a Checkout process Open https://www.lazada vn/ Access and perform a Checkout process Successfully make a purchase Requires login and redirect to Login page Open https://www.lazada Successfully vn/ make a Access and purchase perform a Checkout process 18 3.4 Execute test cases using selenium 3.4.1 TS-01 *TC-001: Figure 16 - Execute TC-001 *TC-002: Figure 17 - Execute TC-002 *TC-003: 19 Figure 18 - Execute TC-003 3.4.2 TS-02 *TC-004: Figure 19 - Execute TC-004 *TC-005: 20 Figure 20 - Execute TC-005 *TC-006: Figure 21 - Execute TC-006 3.4.3 TS-03 *TC-007: 21 Figure 22 - Execute TC-007 *TC-008: 22 Figure 23 - Execute TC-008 *TC-009: 23 Figure 24 - Execute TC-009 3.4.4 TS-04 *TC-010: Figure 25 - Execute TC-010 *TC-011: Figure 26 - Execute TC-011 *TC-012: 24 Figure 27 - Execute TC-012 3.4.5 TS-05 *TC-013: Figure 28 - Execute TC-013 25 *TC-014: Figure 29 - Execute TC-014 *TC-015: Figure 30 - Execute TC-015 3.4.6 TS-06 *TC-016: 26 Figure 31 - Execute TC-016 *TC-017: Figure 32 - Execute TC-017 *TC-018: 27 Figure 33 - Execute TC-018 3.4.7 TS-07 *TC-019: 28 Figure 34 - Execute TC-019 *TC-020: Figure 35 - Execute TC-020 *TC-021: 29 Figure 36 - Execute TC-021 30 REFERENCE [1] - https://www.selenium.dev/ [2] - https://www.w3schools.com/ [3] - https://www.lazada.vn/ [4] - https://anhtester.com/blog/selenium-java 31