This project contains automated API tests for the /register endpoint of a mock user registration service. The tests are written in Java using Cucumber for BDD-style feature files and RestAssured for HTTP request handling. The goal is to verify the correctness of the endpoint for various positive, negative, and edge test scenarios according to the specified requirements.
ProjectRoot/
│
├── src/
│ ├── main/
│ │ └── java/
│ │ └── utils/ # Utility classes like ConfigReader
│ │
│ └── test/
│ ├── java/
│ │ ├── runner/ # Test runner class (e.g., CucumberTestRunner.java)
│ │ ├── stepdefinitions/ # Step definitions using RestAssured
│ │ └── hook/ # Cucumber hooks for setup/teardown
│ │
│ └── resources/
│ └── features/ # Cucumber feature files in Gherkin
│
├── pom.xml # Maven project configuration
├── README.md # Project documentation
└── target/
└── cucumber-report.html # HTML report generated post-test execution
- Java(Project uses JDK 21 as latest LTS version)
- Maven - build tool
To compile and run all tests:
mvn clean testTest reports are generated at target/cucumber-report.html. Open this file in your browser to review detailed test results.
- Test scenarios are written in Gherkin syntax using Cucumber to clearly describe behavior and expected outcomes.
- Tests cover all critical cases: successful registration, missing parameters, validation errors, and wrong HTTP methods.
- RestAssured is used to send HTTP requests and validate API responses including status codes and response payloads.
- Cucumber hooks configure base URL and setup common test context.
- The tests are modular and reusable, with step definitions separated from feature files.
- Logging: Add logging for requests and responses (e.g., SLF4J, Log4j) to improve debugging and traceability.
- CI/CD Integration: Configure pipeline (GitHub Actions, Jenkins, GitLab CI) to run tests automatically on every commit or pull request.
- Parameterization: Externalize base URLs and test data to support multiple environments without code changes.
- Enhanced Reporting: Use more detailed reporting plugins or tools (e.g., Allure Reports) for richer test results and history tracking.
- Parallel Test Execution: Enable parallel execution in Maven or Cucumber to speed up test runs.
- Retry and Flaky Test Handling: Implement retry logic or flakiness detection to increase reliability.
- Expand Test Coverage: Add tests for other endpoints or integrate end-to-end workflows.