Skip to content

[QA] Add Unit Tests for Server Services and Controllers - #73

Merged
GravityDarkLab merged 20 commits into
mainfrom
71-server-add-unit-tests-for-core-services-with-cicd-compatibility
Jul 13, 2025
Merged

[QA] Add Unit Tests for Server Services and Controllers#73
GravityDarkLab merged 20 commits into
mainfrom
71-server-add-unit-tests-for-core-services-with-cicd-compatibility

Conversation

@GravityDarkLab

@GravityDarkLab GravityDarkLab commented Jul 13, 2025

Copy link
Copy Markdown
Collaborator

🚀 PR Summary: Add Unit Tests, Controller Coverage, and CI Integration


✅ What's Implemented

  • 🧪 User Service Tests

    • Added unit tests for UserServiceImpl
    • Added controller tests for UserController
  • 📘 Course Service Tests

    • Added unit tests for CourseServiceImpl
    • Added controller tests for CourseController
  • 🌐 Gateway Tests

    • Covered JWTUtils logic
    • Added tests for LoggingGlobalFilter

🛠 Workflow & Coverage Enhancements

  • 🧰 Adapted build and test GitHub Actions workflows for:

    • user-service
    • course-service
    • gateway
  • 📊 Test Coverage Reporting

    • Enabled Jacoco test coverage generation
    • Uploaded HTML + XML reports as workflow artifacts
    • Injected summary coverage info into GitHub Actions summary

🎯 Goal

Ensure core service logic and controllers are properly tested and integrated with CI/CD to maintain stability and enable scalable feature development.

@GravityDarkLab
GravityDarkLab requested a review from Copilot July 13, 2025 19:37

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Adds comprehensive unit tests across user, gateway, and course services, integrates JaCoCo coverage in builds, and updates CI workflows to generate and upload test coverage reports.

  • Introduce extensive Mockito-based tests for service and controller layers in all three modules.
  • Configure JaCoCo in each module’s Gradle build and refine application-test.yml for mocks and logging.
  • Update GitHub Actions workflows to run tests with coverage, verify coverage, and upload reports as artifacts.

Reviewed Changes

Copilot reviewed 19 out of 19 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
server/skillforge-user/src/test/resources/application-test.yml Simplify test profile, add JWT settings, adjust logging levels
server/skillforge-user/src/test/java/com/gitittogether/skillForge/server/user/config/TestConfig.java Add primary beans to mock repositories, encoders, and JWT utils
server/skillforge-user/build.gradle Apply JaCoCo plugin, configure reports and coverage verification
.github/workflows/build-and-test-server.yml Enhance CI to build with coverage, upload artifacts
server/skillforge-course/src/main/java/com/gitittogether/skillForge/server/course/controller/courses/CourseController.java Add @Valid to request bodies for create/update endpoints
Comments suppressed due to low confidence (3)

server/skillforge-user/src/test/java/com/gitittogether/skillForge/server/user/config/TestConfig.java:28

  • Missing import for JwtUtils in TestConfig. Add import com.gitittogether.skillForge.server.user.config.JwtUtils; to ensure this compiles.
    public JwtUtils jwtUtils() {

server/skillforge-course/src/test/java/com/gitittogether/skillForge/server/course/config/TestConfig.java:28

  • Missing import for JwtUtils in TestConfig. Add import com.gitittogether.skillForge.server.course.config.JwtUtils; to avoid compilation errors.
    public JwtUtils jwtUtils() {

server/skillforge-user/src/test/java/com/gitittogether/skillForge/server/user/UserServiceImplTest.java:447

  • [nitpick] This test duplicates the earlier shouldBookmarkCourseSuccessfully case. Consider removing or merging to reduce redundancy and simplify the test suite.
    void shouldBookmarkCourseSuccessfully_service() {

Comment thread server/skillforge-user/build.gradle
@GravityDarkLab
GravityDarkLab marked this pull request as ready for review July 13, 2025 20:09

@mahdibayouli mahdibayouli left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved! CI/CD-compatible unit tests and coverage reporting added across all services 🚀🚀

@GravityDarkLab GravityDarkLab changed the title 71 server add unit tests for core services with cicd compatibility [QA] Add Unit Tests for Server Services and Controllers Jul 13, 2025
@GravityDarkLab
GravityDarkLab merged commit c965a5e into main Jul 13, 2025
8 checks passed
@GravityDarkLab
GravityDarkLab deleted the 71-server-add-unit-tests-for-core-services-with-cicd-compatibility branch July 13, 2025 21:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Server] Add Unit Tests for Core Services with CI/CD Compatibility

3 participants