Skip to content

Raytek/bookmarks-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

📌 Bookmark API - QA Focused Project

This project is a REST API built with Spring Boot for managing bookmarks.
It was developed with a strong focus on software quality, automated testing, and validation of API behavior.


🚀 Overview

The API allows basic CRUD operations for bookmarks, including:

  • Create bookmarks
  • Retrieve bookmarks
  • Update bookmarks
  • Delete bookmarks

Beyond the API itself, the main goal of this project is to demonstrate testing strategies and quality assurance practices applied to backend services.


🧪 QA & Testing Focus

This project emphasizes real-world testing practices, including:

  • Validation of REST endpoints using MockMvc
  • Integration testing with Testcontainers (PostgreSQL)
  • Unit testing with Mockito
  • Input validation and error handling (e.g., HTTP 400 responses)
  • Service interaction verification
  • High test coverage with meaningful scenarios

✔️ Example Scenarios Covered

  • Successful bookmark update
  • Invalid payload handling (Bad Request)
  • Resource not found scenarios
  • Data consistency validation

🧱 Test Architecture

The test strategy is structured across different levels:

🔹 Controller Tests

  • Use MockMvc to simulate HTTP requests
  • Validate status codes and request/response behavior
  • Ensure proper validation handling (e.g., invalid payloads)

🔹 Service Layer Tests

  • Use Mockito for mocking dependencies
  • Validate business logic in isolation

🔹 Integration Tests

  • Use Testcontainers with PostgreSQL
  • Ensure real database interaction
  • Validate persistence and data integrity

📊 Test Coverage

Test coverage is measured using JaCoCo, ensuring high confidence in the application behavior.

  • Coverage: ~98%
  • Includes positive and negative scenarios
  • Focus on business logic and validation

▶️ Generate coverage report

Run:

./gradlew clean jacocoTestReport

Then open:

build/reports/jacoco/test/html/index.html

📚 References

This project was based on and extended from:

https://blog.jetbrains.com/idea/2024/10/how-to-build-a-crud-rest-api-using-spring-boot/

While the initial structure follows the article, the application was significantly refactored and extended with a strong focus on testability and quality.

Key improvements include:

  • Refactoring the architecture from a 2-layer structure into a 3-layer design (Controller → Service → Repository)
  • Enabling proper isolation of service layer tests
  • Improving separation of concerns to support unit and integration testing
  • Adding validation scenarios and error handling tests
  • Introducing automated testing practices using MockMvc, Mockito, and Testcontainers

About

Spring Boot REST API demonstrating best practices in automated testing and API validation.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages