How nextgentech2/api-bdd-framework works
This is a reusable Cucumber/RestAssured API test framework. QA engineers author Gherkin scenarios that configure endpoints and request data, send HTTP operations, then assert status, body, and schema while carrying tokens or IDs between steps. The main runtime path is feature steps → API service → request construction/client → external API, with responses stored in thread-local scenario state for later checks and extraction. README-documented payload templates, dynamic values, schema checks, and failure logging are included; some wiring is supported by documentation because the step-definition excerpt is partial.
Main entry points: ApiSteps.java Cucumber steps · ApiService.java API service · RestClient.java REST client · ScenarioContext.java Scenario state
Components 15
Scenario authoring
- Gherkin scenarios
src/test/resources/features - Payload templates
src/test/resources/payloads/payloads.json
Step execution
- Cucumber steps
src/main/java/com/nextgentech/steps/ApiSteps.java - Scenario state
src/main/java/com/nextgentech/api/utils/ScenarioContext.java - Failure hook
src/main/java/com/nextgentech/steps/Hooks.java
API transport
- API configuration
src/main/java/com/nextgentech/api/utils/ApiConfig.java - API service
src/main/java/com/nextgentech/api/services/ApiService.java - Request builder
src/main/java/com/nextgentech/api/models/RequestBuilder.java - REST client
src/main/java/com/nextgentech/api/client/RestClient.java
Response validation
- JSON schemas
src/test/resources/schemas - API response
src/main/java/com/nextgentech/api/models/ApiResponse.java - Response validator
src/main/java/com/nextgentech/api/utils/ResponseValidator.java - Cucumber report
src/main/java/com/nextgentech/CucumberReportGenerator.java
Other components
- QA engineer
- Target API
Connections 17
- QA engineer → Gherkin scenarios: authors
- Gherkin scenarios → Cucumber steps: dispatches
- Payload templates → Cucumber steps: loads templates
- JSON schemas → Cucumber steps: validates against
- Cucumber steps → Scenario state: stores and reads
- Cucumber steps → API service: invokes requests
- API service → API configuration: reads settings
- API service → Request builder: builds specification
- API service → REST client: dispatches request
- REST client → Target API: sends HTTP
- Target API → REST client: returns response
- REST client → API service: returns response
- API service → API response: wraps response
- Cucumber steps → Response validator: validates response
- Cucumber steps → Scenario state: saves response
- Failure hook → Scenario state: reads response
- Failure hook → Cucumber report: logs failure details