A Java-based API testing framework for Todo app endpoints using RestAssured and TestNG. Built for clarity and maintainability.
- Full CRUD Operations: Complete test coverage for Todo API endpoints
- Dynamic Data Generation: Randomized test data using JavaFaker
- Model-Based Testing: POJOs with Jackson annotations for request/response handling
- Centralized Configuration: Reusable specifications and error messages
- Detailed Reporting: Allure integration with step-by-step traces
- CI/CD Ready: GitHub Actions pipeline for automated testing
- Token Authentication: OAuth2 token handling for secure endpoints
| Component | Technology |
|---|---|
| Language | Java 21 |
| Testing Framework | RestAssured 5.3.0 |
| Test Runner | TestNG 7.8.0 |
| JSON Processing | Jackson |
| Test Data | JavaFaker |
| Reporting | Allure |
| CI/CD | GitHub Actions |
| Build Tool | Maven |
src/
├── main/java/com/qacart/todo/
│ ├── apis/ # API client implementations (UserApi, TodoApi)
│ ├── base/ # Base request specifications, common configurations
│ ├── data/ # API routes and error message constants
│ ├── models/ # Domain objects (User, Todo, Error)
│ └── steps/ # Test utilities and data generation helpers (UserSteps, TodoSteps)
├── test/java/com/qacart/todo/
│ └── testcases/ # Test suites (UserTest, TodoTest)
├── resources/ # Configuration files
└── pom.xml # Dependency management
- Java 21+
- Maven 3.6+
- Allure CLI (installation guide)
git clone https://github.com/your-username/todo-api-testing-framework.git
cd todo-api-testing-framework
mvn clean installmvn testRun specific test classes:
mvn test -Dtest=UserTest # User management tests
mvn test -Dtest=TodoTest # Todo operations testsGenerating Reports After tests run, generate and view the Allure report:
- After running tests, generate and view the Allure report:
allure serve target/allure-results| Module | Features Verified | Test Cases |
|---|---|---|
| User | Registration, Login, and error handling tests | 3 functional API tests |
| Todo | Full CRUD operations and validation scenarios | 6 functional API tests |
-
API Clients (
apis/)
Encapsulate HTTP methods (e.g., login, create todo) with authentication and response handling. -
Models (
models/)
POJOs with Jackson annotations and builder pattern for cleaner data setup. -
Test Utilities (
steps/)
Generate test data and group actions into reusable workflows. -
Configuration (
base/,data/)
Includes base request specifications, API routes, and error messages.
The GitHub Actions workflow automatically runs your test suite on every push and pull request, and can generate Allure reports as artifacts.
Diagram showing the GitHub Actions workflow that runs automated tests and generates reports on every commit.
Adding New Tests
-
Create a new test class in testcases/
-
Use existing models and API clients
-
Generate test data using steps/
-
Use Allure annotations for reporting:
@Feature("New Feature")
@Story("User Story")
@Test(description = "Test case description")Environment Configuration Modify Specs.getRequestSpec() to support environment switching:
public class Specs {
// Returns the request specification with a base URI.
// The base URI can be overridden by setting the 'env' system property.
public static RequestSpecification getRequestSpec() {
return new RequestSpecBuilder()
.setBaseUri(System.getProperty("env", "https://todo.qacart.com"))
.setContentType(ContentType.JSON)
.build();
}
}Run tests with a custom environment URL:
mvn test -Denv=https://staging.todo-api.comFork the repository
Create your branch:
git checkout -b feature/your-featureCommit your changes:
git commit -m "Add new feature"Push the branch:
git push origin feature/your-featureOpen a pull request
Please follow the existing code style and include relevant test cases.
Distributed under the MIT License. See the LICENSE file for more details.