How svsatish/bdd-service-automation works
Project Type and Purpose
• This is a BDD Service Automation Framework for testing the Petstore Swagger API.
• It is not a typical full-stack application, but a test-automation tool structured around Cucumber, TestNG, and REST-Assured.
A. Feature Layer
• Gherkin feature files (.feature) under src/test/resources/features
B. Glue Layer (Step Definitions)
• Cucumber step definition classes in com.example.api.stepdefinitions
C. Model Layer
• POJO request/response classes in com.example.api.models.user
D. Service/Utility Layer
• RestUtil: wraps HTTP calls (REST-Assured)
• ConfigManager (Singleton): loads dev.properties/qa.properties
• ReportGenerator: produces custom HTML/JSON reports
E. Test Runner
• TestRunner extends AbstractTestNGCucumberTests, configured via @CucumberOptions and testng.xml
F. External System
• Petstore Swagger API (https://petstore.swagger.io/v2)
G. Build & Reporting
• Maven (pom.xml) orchestrates compile/test phases.
• Cucumber HTML/JSON reports under reports/
Architectural Patterns & Design Principles
• Singleton Pattern: ConfigManager
• Builder Pattern (POJO payloads via Lombok’s @Builder)
• Factory/Strategy Patterns (for generating dynamic test data or assertion strategies)
• Template Method Pattern: AbstractTestNGCucumberTests parent logic
• Separation of Concerns:
• Feature files vs. step code vs. utilities vs. models vs. runner
• DRY: shared methods in RestUtil, ConfigManager, ReportGenerator