How nzjahngere/009_exception_hunters works
Project Type and Purpose
• This is an automated testing framework dedicated to end-to-end testing of an online shopping platform. The framework covers UI, API, functional, and negative testing scenarios.
• Technologies used include Java, Selenium WebDriver, Cucumber (for BDD), Rest Assured (for API testing), JUnit, and Maven for build and dependency management.
• It follows best practices such as the Page Object Model (POM) to ensure maintainability.
File Structure
• Even though the provided file tree isn’t grouped into subdirectories like “src/main” or “src/test”, the README clarifies the intended structure:
• Page Objects reside in src/main/java/com/saucedemo.
• Step Definitions and the Test Runner live in src/test/java/com/saucedemo.
• Cucumber Feature Files (written in Gherkin) are stored in resources/features.
• The pom.xml defines the Maven build configuration.
• You also see several .java files corresponding to page objects (e.g., CartPage.java, CheckoutPage.java) and step definitions (e.g., ShoppingCartSteps.java, CheckoutAndPaymentSteps.java) alongside .feature files that drive the test scenarios.
• There are also various test plans and reports on execution (e.g., PDFs and Excel files), indicating an emphasis on comprehensive reporting and quality assurance.
Main Components
a. Test Artifacts:
• Cucumber Feature Files (Gherkin scenarios) that define test cases.
• Step Definitions in Java that map to the Gherkin steps.
• Page Objects (POM) which interact with the UI elements of the Sauce Demo application.
b. Test Execution and Build System:
• Maven (pom.xml) serves as the build tool that compiles and runs tests.
• JUnit is used for test assertions and running the test cases.
c. Testing Framework Components:
• Selenium WebDriver for automating browser interactions during UI tests.
• Rest Assured for API testing.
d. Test Reports:
• Cucumber HTML Reports generated in the target directory after test execution.
e. External Dependencies:
• Web drivers for browsers (Google Chrome/Firefox).
• The Sauce Demo application itself serves as the system under test.
Relationships and Interactions
• The feature files feed directly into the step definitions.
• Step definitions invoke methods on corresponding Page Objects (POM), which abstract the UI elements and interactions.
• Selenium WebDriver is called within the Page Objects to interact with the browser.
• For API tests, step definitions call Rest Assured based routines.
• The Maven build process orchestrates the compilation, test execution, and report generation.
• Generated reports are stored in the target directory and can be accessed via a browser.
Architectural Patterns and Principles
• Use of the Page Object Model (POM) to segregate the UI interactions.
• Adoption of Behavior Driven Development (BDD) with Cucumber for clear, human-readable test cases.
• Separation of concerns is evident: feature definition, test logic (step definitions), and UI interaction logic (page objects) are clearly separated.
• Modular design ensures that UI and API tests are maintained independently while integrated under the same testing framework.
Detail and Clarity
• That every component is clearly labeled.
• Keep components as granular as possible to capture the essential architecture and integration points of the system.